726dd9803a
- passage-confirmation: unexplained passages as the audit witness and the phase-1 order (2026-11-19), first recordings, and the decisions of 2026-11-22: the zone flow (last crossing counts, no decision while the zone is busy, an uncrossed open is abandoned) and the read-then-fire relay rules. - zone-anpr-poc: the prototype on park-lab, its builds, the live R2 trials and the turn-back judged as passed; park-lab as the worst-case site. - zone-anpr-plate-trials: plate reading measured (inverting does not help; the still is the main reader; the plate reads only on a short stretch of the approach), the day and wet-night trials, and the two fixes that followed. - zone-anpr-poc-review: the code review of 2026-11-21 with a status table of what the later builds fixed. - vision-hardening: the work list the user deferred to another session. - zkteco-cmp200-barrier, append-only-event-chain, reconciliation, open-questions, overview, index, log: cross-references and updates. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01RZgP5oZdzvo92Eouc9eRv5
278 lines
17 KiB
Markdown
278 lines
17 KiB
Markdown
---
|
||
type: concept
|
||
tags: [parking, vision, anpr, plate, night, glare, poc, park-lab]
|
||
sources: []
|
||
updated: 2026-11-22
|
||
---
|
||
|
||
# Zone ANPR PoC — plate reading, and the day and night trials
|
||
|
||
How the [[zone-anpr-poc]] reads the plate, what was measured about it, and the trials of
|
||
2026-11-22 by day and on a wet night. The flow and the relays are on [[zone-anpr-poc]]; what is
|
||
left to harden is on [[vision-hardening]].
|
||
|
||
**In short:**
|
||
|
||
- The plate reads only on a **short stretch of the approach**. Once the car stands at the line the
|
||
camera sees it almost edge-on.
|
||
- The **hi-res still is the main reader**. The stream frames are a faster, weaker second source.
|
||
- Re-toning the picture (inverting, contrast, darkening) does not help.
|
||
- On a **wet night** the headlight flare decided the result: 5 plates decided in 11 entry visits
|
||
with a plate in view, 2 of them wrong.
|
||
- The night also showed a pass judged abandoned. Two fixes followed, and held on the next run.
|
||
|
||
## What the 2026-11-21 night showed
|
||
|
||
- **When it works:** the plate reads reliably in the 1–2 s **while the car approaches**.
|
||
- **When it fails:** once the car stops close to the camera, the plate is at a steep angle next
|
||
to the car's own headlight, and comes out burnt white. At 16:59 that gave 37 reads, all garbage
|
||
("AAJ27").
|
||
- **The plate is not needed for the verdict.** Several visits were judged right without one.
|
||
- **Camera-side fix, not tried yet:** a faster night shutter or lower exposure.
|
||
|
||
## Would inverting the picture help? (measured 2026-11-22)
|
||
|
||
The user asked whether inverting the picture would help. The PoC's own plate reader was run on
|
||
the 1280×720 frames of three night visits, as recorded and re-toned three ways. Counted: reads of
|
||
`AA927AU` with every character ≥ 0.9.
|
||
|
||
| Visit | Frames | As recorded | Inverted | Contrast (CLAHE) | Darkened |
|
||
|---|---|---|---|---|---|
|
||
| 17:28, approaching and driving through | 46 | 38 | 18 | 41 | 20 |
|
||
| 17:00, stopped close | 51 | 0 | 0 | 0 | 0 |
|
||
| 17:59, standing 50 s | 78 | 0 | 0 | 0 | 0 |
|
||
|
||
- **Inverting makes it worse**, and helps nowhere.
|
||
- **The stopped plate is not burnt white**, which corrects the second bullet of the section
|
||
above: no pixel of the plate area is clipped in the 17:59 visit, and at most 9% in the 17:00
|
||
one. Its brightness is ordinary (mean 116 of 255).
|
||
- **It is seen almost edge-on.** The plate is 82 px wide while the car approaches, and 26–40 px
|
||
wide once it stands at the line, for seven characters. No re-toning brings that back.
|
||
- **Limit:** this used the stream frames. The 8MP stills of failed reads were not kept, so what
|
||
they looked like is not known.
|
||
|
||
## Correction: the stream frames are the weaker reader
|
||
|
||
The 17:28 visit above was a favourable one. All 20 entry visits of that night were then replayed
|
||
through the stream frames alone:
|
||
|
||
| | Visits decided, of 20 |
|
||
|---|---|
|
||
| Hi-res stills, as run that night | 8 |
|
||
| Stream frames alone | 3 (after 1.5 s, 1.8 s and 2.4 s) |
|
||
|
||
- Every visit the stream decided, the stills had decided too.
|
||
- **Why:** a stream read is only right when the plate is large enough. Of 652 stream reads:
|
||
|
||
| Plate width in the 1280 px frame | Reads | Sure and right | Sure and wrong | Unsure |
|
||
|---|---|---|---|---|
|
||
| under 65 px | 465 | 1 | 2 | 462 |
|
||
| 65–90 px | 172 | 133 | 0 | 39 |
|
||
| over 90 px | 15 | 0 | 0 | 15 |
|
||
|
||
The plate is that size for only part of the approach. The still has three times the pixels.
|
||
- **Caveats:** one car, one night; the recorded frames are re-compressed (quality 80); the 20
|
||
visits include drive-outs, which show no front plate.
|
||
|
||
**What follows for the parking system:** the hi-res still stays the main reader. The stream
|
||
frames are a second, faster source that costs the camera nothing: five tries a second against one
|
||
still in 450–850 ms. Do not expect a read from a car standing at the line with this camera
|
||
position.
|
||
|
||
## The plate build (2026-11-22)
|
||
|
||
- **Two sources, one consensus.** Every processed stream frame is read in the background, and a
|
||
still is fetched at most every 0.5 s. Both vote for the same decision (3 votes, 75% agreement,
|
||
every character ≥ 0.9), and reading stops when it is reached.
|
||
- **The stills alone can also decide,** so a sure but wrong stream vote cannot block them. The
|
||
17:36 visit had two such votes ("AA927XU").
|
||
- **A small plate in the stream does not vote:** under 5% of the frame's width (64 px of 1280),
|
||
`stream_min_plate_w`. Provisional: it was chosen on the same 652 reads it is scored on.
|
||
- **Tries are capped only while the car stands** (75 stream reads, 20 stills, starting again when
|
||
the car moves), so a slow approach is read all the way.
|
||
- **Every still's car crop is kept with its read** beside the visit's clip (`still_NN_…jpg`,
|
||
`stills.jsonl`, the first 15 per visit), so failed night reads can be looked at afterwards.
|
||
- **A new HTTP client for every still,** which removes the permanent `digest auth failed` state
|
||
of finding 13 on [[zone-anpr-poc-review]].
|
||
- **Recorded for each read:** source, plate width, seconds into the visit (`reads-all.jsonl`).
|
||
**For each visit:** tries, reads and votes per source, and seconds until the decision
|
||
(`reads.jsonl`).
|
||
- `test_flow.py` had 57 checks at this build.
|
||
- **Deployed to park-lab** at 11:15 UTC on 2026-11-22; `zg2` came up disarmed. The file before it
|
||
is kept as `zone_anpr.py.bak-20261122-preplate`.
|
||
- **Daytime baseline, before this build** (stills only, 2026-11-22 10:02–10:18 UTC): the plate
|
||
was decided in all eight visits where the car showed its front.
|
||
|
||
## Day trial (2026-11-22, 11:25–11:29 UTC, AA927AU)
|
||
|
||
The user drove a pass in and out, then abandonments, at higher speeds than in the morning.
|
||
|
||
| Start | Camera | Verdict | Speed | Plate | Decided after | Stream votes / reads | Still votes / reads / tries |
|
||
|---|---|---|---|---|---|---|---|
|
||
| 11:25:33 | entry | abandoned (dry run, before arming) | 0.02 | undecided, 1 vote | – | 0 / 23 | 1 / 2 / 25 |
|
||
| 11:27:10 | entry | passed | 0.05 | no read | – | 0 / 6 | 0 / 1 / 8 |
|
||
| 11:27:48 | exit | abandoned (the drive-out) | 0.04 | undecided, 1 vote | – | 0 / 8 | 1 / 3 / 6 |
|
||
| 11:28:12 | entry | abandoned, R2 | 0.07 | **decided** | 4.8 s | 2 / 9 | 2 / 2 / 4 |
|
||
| 11:28:24 | entry | abandoned, R2 | 0.08 | **decided** | 5.8 s | 1 / 10 | 2 / 4 / 10 |
|
||
| 11:28:45 | entry | abandoned, R2 | 0.05 | undecided, 1 vote | – | 0 / 4 | 1 / 1 / 9 |
|
||
| 11:29:00 | entry | abandoned, R2 | 0.08 | undecided, 2 votes | – | 1 / 15 | 1 / 1 / 5 |
|
||
|
||
Speed is how fast the car's box crossed the picture in its first 1.5 s, in picture widths a
|
||
second. The morning's visits were 0.02–0.04.
|
||
|
||
- **Verdicts and relays: all right.** Every entry visit was judged as driven, and R2 went out on
|
||
each of the four armed abandonments. Detection stayed at 4.9–5.0 a second with the stream reads
|
||
running; the process used 9–15% of the host during a visit, against 6% idle.
|
||
- **Plates: worse than the morning.** Two of the six entry visits were decided, and late. In the
|
||
morning, on stills only and at lower speed, all eight were, within about a second.
|
||
- **The readable moment is short when the car comes faster.** One second after the visit starts,
|
||
the car's box was 790–877 px wide in this trial, against 634–712 px in the morning: the car is
|
||
already close and seen from the side. The kept stills show it: in the 11:28:45 visit, stills 1
|
||
to 8 show no plate at all, and still 9, taken as the car backed away, reads right.
|
||
- **Stills timed out 9 times in 67 tries**, none in the morning's about 20. Each one costs a 2–4 s
|
||
pause, in the part of the visit that matters. Most came on the second still of a visit, half a
|
||
second after the first. In the old build the gap between stills was about 0.6–0.85 s.
|
||
**Hypothesis, not shown:** the camera's picture endpoint hangs when asked again too soon.
|
||
- **The stream added little:** 67 reads with a plate, 10 of them with the plate at 64 px or
|
||
wider, 4 votes, all right. Under 64 px there were 3 right and 1 wrong sure reads, so the size
|
||
gate held.
|
||
- **Why the morning was better (user's question, worked out from the kept stills and the
|
||
recorded boxes):** the plate can be read only on a short stretch, and reading starts near its
|
||
end.
|
||
- Of the 42 kept stills, every right read was taken with the car's front edge left of about
|
||
x = 900 of 1280. Past that the car is side-on and no still found a plate.
|
||
- A visit, and with it the reading, starts when the car enters the zone: front edge at 853–904
|
||
in the morning and 757–930 in this trial. That is already the end of the stretch.
|
||
- In the morning the front edge moved at 70–113 px a second, so the three stills (one about
|
||
every 0.4 s) were all taken in time. In this trial it moved at 136–249 px a second, so the
|
||
first still already showed the car past the stretch. The one slow visit of this trial
|
||
(11:25:33, 54 px a second) had its first still read right.
|
||
- **Ruled out:** the zone redrawn at 10:36 starts a visit on the same frame as the old one, on all
|
||
twelve recorded visits. The crop cut for the still was too far behind the car in only 3 of 42
|
||
stills. The timeouts hit later stills, when the car was already past the stretch.
|
||
|
||
## Night trial, wet lens (2026-11-22, 16:25–16:29 UTC, AA927AU)
|
||
|
||
Relays armed at 16:26:27, close live. What the car did is read from the recorded frames. **The
|
||
user confirmed the 16:27:00 visit was a crossing.**
|
||
|
||
| Start | What the frames show | Verdict | R2 | Plate | Decided after |
|
||
|---|---|---|---|---|---|
|
||
| 16:27:00 | stood 26 s at the line, then **drove through** | **abandoned (wrong)** | sent 3 s after the car had passed | no read: 0 of 14 kept stills found a plate | – |
|
||
| 16:28:12 | came up, reversed out | abandoned | sent | decided AA927AU | 1.3 s (2 stream votes, 1 still) |
|
||
| 16:28:27 | came up, stood, reversed out | abandoned | sent | decided AA927AU | 2.8 s (3 stills) |
|
||
| 16:28:47 | came up, stood, reversed out | abandoned | sent | **decided A927AU (wrong)** | 2.8 s (3 stills) |
|
||
|
||
Two entry visits before arming (16:25:30, 16:25:50) were dry runs; what was driven is not clear
|
||
from the frames.
|
||
|
||
- **Glare on a wet lens is the night problem.** In every frame the near headlight is a burnt-out
|
||
blob about a quarter of the car wide, with flare spread by the drops. The car's box swells and
|
||
shrinks with it, twice to the whole picture. In one visit the followed car was matched in only
|
||
3.8 of the detector's 5 looks a second.
|
||
- **A pass was judged abandoned (16:27:00), and R2 fired behind the car.** The car stood on the
|
||
line and then drove through fast and blurred. The very last matched box, on the blur, lay on
|
||
side A outside the zone. That one frame turned the last side from "line" to "a" and counted as
|
||
"seen leaving the zone". Replayed without that frame the verdict is `passed` and no R2. This is
|
||
the single-frame weakness that the review could not show at the time ([[zone-anpr-poc-review]]),
|
||
now seen for real. In the product this would write a real entry as abandoned.
|
||
- **A wrong plate was decided with full agreement (16:28:47).** The flare covered the plate's
|
||
first letter, and three stills in a row read `A927AU`, each sure. The consensus cannot catch
|
||
it, because every still has the same flare. Night reads in all: stills 4 right and 3 wrong,
|
||
stream 3 right and 2 wrong, all the wrong ones this same text.
|
||
- **Plates were otherwise faster than at midday:** 1.3 s and 2.8 s. The car came slower (0.05–0.06
|
||
picture widths a second), and the right reads were again taken with the front edge left of
|
||
about x = 1030.
|
||
- **A car standing side-on in the glare reads nothing:** 143 stream tries and 35 stills at
|
||
16:27:00, three of them timed out.
|
||
- **The exit camera** took five visits with no plate, one of them 145 s long, and sent R1 once,
|
||
18 s after the pass.
|
||
- **The barrier opened at 16:27:00 without a plate, because the PoC opens for any car** (a trial
|
||
setting, [[zone-anpr-poc]]). The user asked why. With the real rule, open on a known
|
||
plate, this car would have got no open from the camera: it was never read. And a car that
|
||
reaches the line unread is side-on there and cannot be read any more, so the real design needs
|
||
the plate before the line, or another way in (ticket, operator).
|
||
|
||
### Day and night side by side
|
||
|
||
Entry visits with the relays armed:
|
||
|
||
| | Midday | Night, wet lens |
|
||
|---|---|---|
|
||
| Verdicts right | 5 of 5 | 3 of 4 (a pass judged abandoned) |
|
||
| Plate decided | 2 of 5 | 3 of 4, one of them wrong |
|
||
| Time to the plate | 4.8 s, 5.8 s | 1.3 s, 2.8 s, 2.8 s |
|
||
| Approach speed | 0.05–0.08 | 0.05–0.06 |
|
||
|
||
## The two fixes after the night trial
|
||
|
||
Built and deployed on 2026-11-22 at 16:54 UTC; `zg2` came up disarmed.
|
||
|
||
1. **A side must hold before it counts.**
|
||
- A new side (A, on the line, B) is taken only after two looks in a row (`side_hold`).
|
||
- "Seen outside the zone" needs two looks in a row as well.
|
||
- The leaving edge is judged on the last box that agreed with the car's side.
|
||
- One exception, found by replaying the older recordings: a last look that has not held still
|
||
counts when its box is at the picture's left or right edge and the box before it was not. That
|
||
is a car driving out of view, which cannot be seen twice. Without it, the plain rule turned
|
||
the pass of 2026-11-21 17:01 into an abandonment.
|
||
2. **A read does not vote when the picture is burnt out right beside the plate.**
|
||
- Measured in the strip just left and just right of the plate, each a quarter of the plate
|
||
wide: the share of pixels at 250 or more in every channel. From 5% up, no vote
|
||
(`plate_glare_max`).
|
||
- On the 20 kept stills with a read: the four with the flare on the plate scored 18–43%, the
|
||
other sixteen 0%. All three sure reads of `A927AU` are now barred, and all ten right and
|
||
sure reads still vote.
|
||
- It is a check on the picture, not a rule about the plate's format.
|
||
- Each read's value is recorded (`glare` in `reads-all.jsonl` and `stills.jsonl`).
|
||
|
||
**Checked before deploying:**
|
||
- `test_flow.py`: 65 checks pass, locally and inside the container.
|
||
- Every recorded entry visit of both days, 39 in all, replayed through the code before and after:
|
||
37 come out the same. The 16:27:00 pass is now `passed` with no R2. One three-frame visit of
|
||
2026-11-21 (16:36:41) changes from `passed` to `abandoned`; what that car did is not known.
|
||
- **Not covered:** a plate cut off by the edge of the still's crop still votes (`AA927`, sure, at
|
||
11:28:12). The flare and the wet lens themselves are not cured, only kept from voting.
|
||
- The file before this is kept as `zone_anpr.py.bak-20261122-prefixes`.
|
||
|
||
## Second night run, after the fixes (2026-11-22, 17:00–17:04 UTC, wet lens)
|
||
|
||
Relays armed at 17:01:10. What the car did is read from the recorded frames and stills; the user
|
||
has not confirmed it.
|
||
|
||
| Start | Camera | What the frames show | Verdict | Relays | Plate |
|
||
|---|---|---|---|---|---|
|
||
| 17:00:49 | entry | car seen from behind, stood, left | abandoned | dry run | decided AA927AU, 2.2 s |
|
||
| 17:01:01 | entry | car seen from behind, stood 15 s, left | abandoned | R2 | **decided AA927AJ (wrong)**, 4.8 s |
|
||
| 17:01:18 | entry | **no car at the line: a glare box as the car backed away** | abandoned (B → A) | **R1, then R2 two seconds later** | – |
|
||
| 17:01:32 | entry | drove through | passed | R1 | no read |
|
||
| 17:01:48 | exit | the same car, driving on | abandoned | R1 | no read |
|
||
| 17:02:06 | entry | drove out past the entry camera | abandoned (B → A) | R1, R2 | – |
|
||
| 17:02:26 | entry | came up, left | abandoned | R1, R2 | undecided, **27AU** twice |
|
||
| 17:02:43 | entry | drove through | passed | R1 | undecided, AA927AU twice |
|
||
| 17:03:11 | exit | a drive-out | abandoned | R1 | decided AA927AU, 0.3 s |
|
||
| 17:03:35 | entry | came up, backed away | abandoned | R1, R2 | undecided, AA927AU twice |
|
||
| 17:03:50 | entry | came up, backed away | abandoned | R1, R2 | no read |
|
||
|
||
- **Fix 1 held:** both drive-throughs were judged `passed`, with no R2 behind the car.
|
||
- **Fix 2 bars burnt-out flare only.** It barred one sure still and 22 stream reads. Two other
|
||
kinds of sure, wrong read got through, both scoring 0 on the check:
|
||
- `AA927AJ`, three stills: the **rear** plate seen at a steep angle, the last letter misread;
|
||
- `27AU`, two stills: a **hazy** flare ghost from the wet lens lay over the first three
|
||
characters. It washes the picture out without burning it out (brightness about 200 of 255
|
||
beside the plate, nothing at 235 or more).
|
||
- **Glare boxes act like cars.** At night the detector at times returns a box nearly as large as
|
||
the picture. One started a visit two seconds after an abandonment (17:01:18): R1 opened and R2
|
||
closed again. Two others ended the last two visits; those came out `abandoned` only because
|
||
`close_on_lost` is on.
|
||
- **The followed car went unmatched more often:** in four visits it was matched in only 3.1–4.1
|
||
looks a second. The detector itself held 5 a second throughout (`metrics.jsonl`).
|
||
- **Plates on the wet night, both runs together:** 5 decided in 11 entry visits with a plate in
|
||
view, 2 of them wrong.
|
||
|
||
## What is left
|
||
|
||
The open items from these trials (the readable stretch and reading before the visit, the hazy
|
||
flare, the steep rear plate, the plate cut by the crop, the still timeouts) are collected, with
|
||
their evidence, on [[vision-hardening]].
|