Coin Recognition
A local desktop application that reads the year and mint mark off a US cent. Machine learning handles the worn coins, OCR handles the clear ones, and a confidence-scored hybrid decides between them.
It works on partial coin images. You do not need the whole penny.
Built for people who look at a lot of cents
This is a focused tool with a narrow job: identify the year and mint mark on the right side of a US cent. It is honest about the edges of that job.
It is for you if
- You are a collector or numismatist sorting or cataloguing cents from photographs.
- You have a folder of coin images and want the year and mint mark read in a batch, then exported to CSV or JSON.
- You are curious how a hybrid ML-and-OCR reader is put together and want to run it locally.
- You want a tool that runs on your machine, keeps your images local and needs no account.
It is not for you if
- You need to grade a coin's condition or value. This reads the year and mint mark, nothing more.
- You work with coins other than US cents. The historical validation and region logic are penny-specific.
- You expect flawless reads on badly worn coins. Where the text is gone, the model guesses and tells you its confidence.
- You want a phone app or a hosted service. This is a local desktop application.
Two readers, one confidence-scored answer
A machine-learning classifier and an OCR engine read every coin independently. Neither is trusted blindly. A hybrid layer weighs both against their confidence and against what is historically possible, then commits to a single year and mint mark.
Machine-learning reader
A scikit-learn classifier over shape and texture features identifies the coin even when the text is worn or unclear, the case OCR struggles with most.
OCR reader
Tesseract reads the digits and mint-mark letters directly, restricted to a whitelist of valid characters. When the text is crisp, it is the stronger signal.
Hybrid decision
Confidence scores from both readers are compared and cross-checked against historical mint-and-year combinations, with a fallback to the ML reader when OCR is uncertain.
Single or batch, exportable
Process one image with tunable enhancement, or a whole folder at once. Results export to CSV or JSON. A PySide6 desktop interface throughout.
From a photograph to a validated read
Each coin passes through four stages. The image is prepared, the year and mint-mark regions are located, both readers run, and the hybrid layer commits to an answer it can justify.
Preprocess
The image is prepared for text: greyscale, adaptive contrast, edge-preserving denoise and thresholding to lift the digits off the field.
Locate regions
Contour, Hough and template-matching passes find where the year and the mint mark sit on the coin, so each reader looks in the right place.
Read, twice
The ML classifier and Tesseract OCR each read the located regions independently, and each returns its own confidence alongside its answer.
Decide and validate
The hybrid layer weighs both reads, checks the result against historically valid mint-and-year combinations, and falls back to ML when OCR is weak.
Why a hybrid, and not just OCR
OCR is excellent on a clean, well-lit coin and unreliable on a worn one. The ML classifier is the reverse: steadier on worn coins, weaker where a single stray mark changes a digit. Reading with both and trusting the more confident one, within what history allows, beats either reader alone.
The historical check is the cheap, decisive guard. A mint mark only appears on cents for specific spans of years, so an otherwise plausible read that pairs an impossible mint and year is rejected before it ever reaches you.
| Mint mark | Meaning | Valid on cents in |
|---|---|---|
| S | San Francisco | 1909 to 1974 |
| D | Denver | 1911 onward |
| P | Philadelphia | 1979, 1980 and 2017 onward |
| W | West Point | 2019 only |
The ranges above are the guard rails the hybrid layer uses to reject impossible mint-and-year pairs. They are penny-specific, which is one reason the tool is scoped to US cents.
Run it from a clone
Coin Recognition is a Python desktop application built on PySide6, OpenCV, scikit-learn and Tesseract OCR. Clone it, install the dependencies and launch the interface. Everything runs locally.
# Clone and enter the project git clone https://github.com/oernster/coin-analysis.git cd coin-analysis # Install the dependencies python -m pip install -r requirements.txt # Launch the desktop application python run.py
Point it at a photo of the right side of a US cent, with the year and mint mark visible. Partial images are fine. Use the Single Image tab for one coin, or the Batch Processing tab for a folder, then export the results to CSV or JSON. Tesseract OCR must be installed on your system for the OCR reader to run.