Skip to content

Your first plate

Point anpr infer at a photo with a car in it:

Terminal window
anpr infer car.jpg

You get a table with one row per plate the detector found:

Column Meaning
BBox Where the plate is in the image, as (x1,y1)-(x2,y2) in pixels.
Det conf How sure the detector is that this is a plate, from 0 to 1.
Raw OCR The characters exactly as the OCR model read them.
Plate The reading after the Turkish format check, such as 34 ABC 1234, or (invalid) if it doesn’t fit the format.
Province The province the code belongs to, such as İstanbul.

Add --json to get the same result as JSON, for scripts:

Terminal window
anpr infer car.jpg --json

The CLI doesn’t write anything to the database.

Start the service:

Terminal window
anpr serve

Open http://localhost:8000. The page has two ways in:

  • Upload an image. It goes to POST /api/v1/infer and the plates are listed under it.
  • Start the webcam. The page sends frames over /ws/stream and shows each plate as it is read. Once a plate has been read on enough frames, it is marked as confirmed and stored as a hash.

The interactive API reference, generated by FastAPI, is at http://localhost:8000/docs.

If you didn’t set ANPR_PLATE_HMAC_PEPPER, the service makes up a random pepper and warns you. That is fine for trying it out. For real use, set one; see Configuration.