crtdrops
NOTE · ENGLISH ·

The camera that saw cards that were not there

Three readers against 156 cards, as bars: the templates read 53 right and name 1 that was not there; Gemma 3 4B with an open question, 93 right and 86 not there; Qwen2.5-VL 3B with an open question, 120 right and 110 not there. On the right, the empty table: the templates and Qwen say nothing; Gemma names 3 cards.

I have played poker at home with friends and in an online card room, almost always with play chips, and I have always looked at it through the math. This time the question was not about odds but about eyes: can a camera fixed over the table tell which cards are face up? Where does it get it wrong? And the part I cared about most: does it say it sees cards that are not there?

This is a test for practising at home, not for playing online or in a casino. One deck, one table, one camera and one night of photos: it shows where each reader fails, not an accuracy rate “in general”. The code, the truth for every photo and every reader’s full answer are published (in Spanish).

The setup

An OAK camera with a 12 MP IMX378 sensor, fixed above the table looking down and connected over USB to a mini PC with an Intel N100 and 16 GB of RAM, no separate graphics card. Photos come out at 4000 × 3000. Everything runs on that mini PC: nothing goes to the internet.

The deck is in order, so the truth for each photo falls out on its own, without writing anything down. Each photo fits 3 rows of 6 cards: one pass through the deck is 3 photos, of 18, 18 and 16 cards. The three conditions use the same 52 cards; in A and B they are also in the same places.

Condition What changes Photos Cards
A ceiling light, cards spread out 3 52
B a lamp from the side that washes out some cards 3 52
D the same cards fanned, like an open hand 3 52
V the empty table, not a single card 2 0

Part of photo A-02, under the ceiling light: five columns of spread cards, hearts from 10 to 6 on top, clubs and the K and Q of hearts in the middle, clubs at the bottom.

The same area in photo B-02, with the side lamp: the glare washes out the 9 and 8 of hearts and the index of the 8 almost disappears.

Photo D-03, fanned: from the K of spades, whole on top, to the indices of the other spades and of the J, Q and K of clubs, rotated along the fan.

Condition C, with the camera tilted, did not get done. Photos A, B-01 and B-02 were taken with autofocus; B-03, D and V with the lens locked, because the autofocus left B-03 blurry twice. Photo B-01 came out somewhat soft and could not be retaken, so in B it is not only the lamp.

The V photos matter most to me: any card a reader names there is not there. And the mat has a logo with text printed on it, one more temptation for a reader looking for something to read.

The readers

  1. Classic vision, as in 2001. No model. The corner of each card (rank on top, suit below) is cropped from three photos of the same deck, and in each new photo it looks for where a corner resembles one of those 52 templates, upright or upside down. The resemblance goes from 0 to 1; if it passes a threshold, the card counts.
  2. Gemma 3 4B, a language model with vision, running locally.
  3. Qwen2.5-VL 3B, another local vision model, smaller.

Both models get the photo reduced to 1280 × 960, always with the same seed and no randomness in the answer (temperature 0).

For each photo three things are counted: right (cards that were there and it named), not there (distinct cards it named that were not in that photo) and repeated (the same card named again). The open answers are turned into cards by a program that reads phrases like “Jack of Hearts” or “Diamonds: 6, 5, 4”; I checked all of them by hand.

What happened

The 156 cards in photos A, B and D, together:

Reader Question Right Not there Repeated On the empty table Seconds per photo
Classic, 7 sizes — 53 1 0 nothing 131
Gemma 3 4B JSON with sample 88 124 33 A♠ and 10♥, in both 103–127
Gemma 3 4B JSON without sample 111 108 39 nothing 102–140
Gemma 3 4B open 93 86 4 J♥; A♠ and J♠ 102–134
Qwen2.5-VL 3B JSON with sample 2 2 0 A♠ and 10♥, in both 216–222
Qwen2.5-VL 3B open 120 110 289 nothing 215–359

The seconds for the classic reader and for the questions with a sample come from a separate measurement, with the mini PC doing nothing else. The rest come from the run itself; for Qwen’s open question I left out three photos in which the server apparently reused what it had already computed for that image (it had just seen it). The time grows with the length of the answer.

By condition:

Reader A, ceiling B, lamp D, fan
Classic, 7 sizes 29 / 52 24 / 52 0 / 52
Gemma 3 4B, JSON without sample 25 / 52 43 / 52 43 / 52
Gemma 3 4B, open 33 / 52 33 / 52 27 / 52
Qwen2.5-VL 3B, open 47 / 52 34 / 52 39 / 52

Four things.

1. The way I asked changed everything. With the JSON question, Qwen returned an empty list in 6 of the 9 photos with cards, and in the other three it only named the A♠ and the 10♥ from the sample, one or both: its 2 right cards are those, in the two photos where they really were. With the open question, the same model read 120 right. It was not blind; the question, or having to answer in JSON, got in its way. Careful with those 120: 35 come from two photos in which it recited almost the whole deck (49 and 50 distinct cards), and that way any card that is there comes out “right”.

2. On the empty table, both models copied the sample. With the original question, both said they saw the A♠ and the 10♥ in both empty-table photos: exactly the sample answer. Without the sample, Gemma said nothing there; with the open question, neither did Qwen: it took the mat for a laptop and read the text of the logo. But with the open question, which did not warn that there might be no cards, Gemma saw cards again: a J♥ “on the left side” in one photo, the A♠ and the J♠ in the other. None of the ways I tried with both kept both models silent on the empty table and reading well on the rest.

3. No way of asking read a lot without naming a lot of cards that were not there. The two that read the most, Qwen open and Gemma without the sample, named 110 and 108 cards that were not in the photo. Qwen open also repeated 289: in three photos it got stuck in a loop up to the answer length limit (1,000 pieces of text, tokens), and in two of them it named 132 cards for photos of 18 and 16. The extra cards are not random noise: in photo B-01, which has ♦ A…K and ♥ A…5, Gemma with the original question added 7♠, 6♠, 5♠, 4♠, 3♠ and 2♠, plus the A♠ from the sample. It seems to repeat, in other suits, the sequence it does see.

4. The 2001 reader almost never named a card that was not there. None on the empty table and none where there was no card; once it got the suit wrong: it read 8♠ where the 8♣ was. What it lacks is sight: 53 of 156, and none in the fan.

What happened to the 2001 reader

Its first version was worse, and the reason is worth telling. It looked for each template at three sizes, from 0.9 to 1.1, and under the ceiling light it read 17 of 52, all from the middle row. The templates were shot with the deck laid out the opposite way from the test photos: the top cards ended up where the bottom ones had been, closer to or farther from the camera, and looked a different size. The middle row was the only one that stayed in place. With seven sizes, from 0.7 to 1.3, it went up to 29. The tables use that second version; I made the change after seeing the failure.

I fixed the threshold rule before looking at the test photos, and it uses only the templates: in each template photo I searched for the cards of the other two, which were not there. The highest resemblance a foreign card gave was 0.791, and the threshold went 0.05 above it: 0.841. It is strict on purpose. If I lower it to 0.75, a number I chose after seeing the results, it reads 89 of 156 and names 7 cards that were not there. With a lower threshold, more. That figure does not count as a result, because the threshold came from the same photos it measures; it only says there is room.

In the fan, the corners are rotated and this reader only looks for upright or upside-down corners. Most likely it is not that it sees badly but that it cannot rotate, but I did not try the version that rotates the templates.

It is not fast either: 131 seconds per photo, because it compares the 52 templates, in two orientations and seven sizes, against the whole photo. Nobody tuned it.

What this test does not let you conclude

What I take away

For a reader that is going to decide something, “did not see it” and “named one that was not there” do not weigh the same. A card that was not seen can be asked for again; a card that was not there enters the count as if it were true. The template reader fails almost always quietly and on the safe side. The models, with the right question, read more, but no way of asking them read a lot without naming many cards that were not there, and how they failed depended on how I asked: the same model went from seeing nothing to seeing too much. And with a sample in the question, facing an empty table, both handed the sample back to me.

Afterwards, with the same data, I tried an idea: accept a card from the model only if the template reader also finds it somewhere in the photo. I tried three thresholds and kept the one that left the fewest cards that were not there, 0.7: with Qwen and the open question, 78 right and 5 not there remain. It sounds good, until you compare it with the template reader alone, with the threshold at 0.75: 89 right and 7 not there. And in the fan the filter throws away almost everything the model read right (from 39 to 5), because there the template reader cannot see. I chose both thresholds after seeing the results, so these are not figures to show off. What does show is that, at this table, what held back the extra cards was the boring reader.

Israel Negrete Lepe is an electronics engineer. Twenty-five years making different systems work together under real conditions: from the sensor, the vehicle or the transaction to the backend, the data, security and operations. Today, increasingly, edge AI. I take on projects by the hour or by deliverable: israel0negrete@gmail.com.