Immich OCR, tested on photos of pages
69
of 206 German umlauts, default model
Use the Latin model for accents
Immich 3.4.1 reads text in photos with PP-OCRv5_mobile by default. On 3 German page photos, it got 69 of 206 umlauts right.
I saved this as config.sh. It sets the model and maxResolution:
curl -s -H "x-api-key: $IMMICH_KEY" "$IMMICH/api/system-config" |
jq --arg m "$1" --argjson r "$2" '.machineLearning.ocr.modelName = $m | .machineLearning.ocr.maxResolution = $r' |
curl -s -X PUT -H "x-api-key: $IMMICH_KEY" -H "Content-Type: application/json" -d @- "$IMMICH/api/system-config" |
jq -c .machineLearning.ocr
sh config.sh LATIN__PP-OCRv5_mobile 736 printed:
{"enabled":true,"modelName":"LATIN__PP-OCRv5_mobile","maxResolution":736,"minDetectionScore":0.5,"minRecognitionScore":0.8}
| Model | Umlauts, of 206 | English words, of 1,955 |
|---|---|---|
PP-OCRv5_mobile (default) |
69 | 1,876 |
LATIN__PP-OCRv5_mobile |
139 | 1,892 |
PP-OCRv5_server |
42 | 1,827 |
Then read every photo again
After each change, I ran OCR again on all photos with rerun.sh:
curl -s -X PUT -H "x-api-key: $IMMICH_KEY" -H "Content-Type: application/json" \
-d '{"command": "start", "force": true}' "$IMMICH/api/jobs/ocr" | jq -c .jobCounts
With force, Immich deletes the old OCR text first. The 3.4.1 API marks this endpoint deprecated, but it ran.
A higher maxResolution did not help
OCR reads the preview, 1440 px on the short side, not the original. maxResolution shrinks that preview again to find the lines.
1,876 English words at 736, the default
1,863 English words at 1440
I did not test small text in a large photo.
The server model was slow
141 s for 13 photos, PP-OCRv5_server
17 s for 13 photos, the Latin model
Both on 2 CPUs. The server model also ran German words together, like "nachder", and found 25 text boxes on a page where the Latin model found 39.
Two columns get mixed
Immich sorts text boxes top to bottom, then left to right. On a two-column magazine page, that joins the lines of both columns.
494 of 972 words in order, Immich
954 of 972, our Actor
Our Actor reads two-column pages column by column since build 0.1.65.
Search finds the OCR words
I searched the OCR text with search.sh:
jq -n --arg t "$1" '{filter: {ocr: {matches: $t}}}' |
curl -s -X POST -H "x-api-key: $IMMICH_KEY" -H "Content-Type: application/json" -d @- \
"$IMMICH/api/search/metadata" | jq .assets.total
| Word | Found | Photos with it |
|---|---|---|
| Hatton | 4 | 4 |
| yacht | 2 | 2 |
| lifeboat | 1 | 1 |
Smart search was off. OCR search did not need it.
Want Markdown out? Use the Actor
Immich OCR is free and keeps the text with the photo. Our OCR Actor gives Markdown from a file URL. On a PDF of the 3 German pages:
curl -s -X POST "https://api.apify.com/v2/acts/brasspage~pdf-ocr-to-markdown/run-sync-get-dataset-items" \
-H "Authorization: Bearer $APIFY_TOKEN" \
-H "Content-Type: application/json" \
-d '{"documentUrls": ["https://api.apify.com/v2/key-value-stores/sTnmNrGoSsi7tLQvs/records/paperless-german-3-pages.pdf"], "language": "deu"}' \
| jq -r '.[].markdown' > german.md
192 of 206 umlauts, Immich 139
1,874 English words, Immich 1,892
Immich read English better and faster: 17 s for all 13 photos. The Actor took 141 s for the 10 English pages. It costs $0.006 a page.
How I tested it
- Photos: the 10 pages of the scan of OCR in n8n as JPG files, 1920 px wide. Proofread Wikisource book scans, 1,955 true words.
- German: the 3 pages of Paperless-ngx OCR as JPG files, 1,887 words, 206 umlauts. One is a two-column magazine page.
- Score: true words found in order, with the scorer of the tessdata test. German: words and umlauts right, the scorer of Tesseract German.
- Immich 3.4.1 on arm64 from the release docker-compose.yml, machine learning on 2 CPUs. Smart search and face detection were off, so the times are OCR only.
- The code blocks above are the files that ran, with IMMICH and IMMICH_KEY set. The Actor: two real runs, build 0.1.65.
What I did not test
- Phone photos with an angle or glare, and handwriting.
- The PP-OCRv6 models, a GPU, and the mobile app.
- The search box of the web app.
Two ways to skip the work
Run it yourself. Our Apify Actor turns scanned PDFs into Markdown, tables included.
Or send us the scan. Tack, our AI, does the job for $29, up to 50 pages. First page free.
Questions people ask
Why does Immich OCR miss accents and umlauts?
The default model, PP-OCRv5_mobile, got 69 of 206 German umlauts in my test. LATIN__PP-OCRv5_mobile got 139. Set the model, then run OCR again on all photos.
Does a higher OCR resolution help in Immich?
Not on my page photos. OCR reads the 1440 px preview. maxResolution 1440 found 1,863 English words, the default 736 found 1,876.
Is the PP-OCRv5_server model better in Immich?
Not in my test. On 2 CPUs it took 141 s for 13 photos, against 17 s for the Latin model. It found fewer words and ran German words together.