Difference between revisions of "OCR"

From Open Food Facts wiki
Jump to navigation Jump to search
(Created page with "== Status == == Roadmap == OCR/Roadmap")
 
(10 intermediate revisions by 2 users not shown)
Line 1: Line 1:
== Status ==
+
OCR (aka Optical Character Recognition) is an important building block for Open Food Facts. As most users feeds in images (convenient from mobile device), we have to extract information from those image, and OCR is one of the best way to do this.{{Box
== Roadmap ==
+
| 1    =  Slack channel
 +
| 2    =  [https://openfoodfacts.slack.com/messages/ocr/ #ocr]
 +
}}
 +
=== Current state ===
 +
* On-demand OCR extraction of ingredients [https://cloud.google.com/vision/overview/docs/ Google Cloud Vision], as google gently give us with free credits.
 +
* Each photo, when uploaded is sent to the OCR<ref group="Code">See [https://github.com/openfoodfacts/openfoodfacts-server/blob/main/scripts/process_new_image_off.sh process_new_image_off.sh]  called through [https://github.com/openfoodfacts/openfoodfacts-server/blob/main/conf/incron.conf incron]</ref>
 +
* you can retrieve the OCR file associated to a photo replacing the <code>.jpg</code> extension in original image by <code>.json</code>
 +
 
 +
== Archive ==
 +
 
 +
=== Tesseract ===
 +
Previously we were using Tesseract on demand (but not storing output)
 +
* Uses the French dictionary for all languages
 +
<pre>
 +
-- /home/off-fr/cgi# grep get_ocr *
 +
Ingredients.pm:use Image::OCR::Tesseract 'get_ocr';
 +
Ingredients.pm: $text =  decode utf8=>get_ocr($image,undef,'fra');
 +
</pre>
 +
* Has a small custom dictionary for French ( /usr/share/tesseract-ocr/tessdata/fra.user-words)
 +
**https://code.google.com/p/tesseract-ocr/wiki/FAQ#How_do_I_provide_my_own_dictionary
 +
 
 +
=== Old Roadmap ===
 
[[OCR/Roadmap]]
 
[[OCR/Roadmap]]
 +
=== Old OCR results ===
 +
[[OCR/Results]]
 +
 +
== References ==
 +
<references group="Code" />
 +
[[Category:OCR]]
 +
[[Category:Artificial Intelligence]]
 +
 +
<references group="Code" />

Revision as of 16:21, 21 March 2022

OCR (aka Optical Character Recognition) is an important building block for Open Food Facts. As most users feeds in images (convenient from mobile device), we have to extract information from those image, and OCR is one of the best way to do this.

Slack channel

Current state

  • On-demand OCR extraction of ingredients Google Cloud Vision, as google gently give us with free credits.
  • Each photo, when uploaded is sent to the OCR[Code 1]
  • you can retrieve the OCR file associated to a photo replacing the .jpg extension in original image by .json

Archive

Tesseract

Previously we were using Tesseract on demand (but not storing output)

  • Uses the French dictionary for all languages
-- /home/off-fr/cgi# grep get_ocr *
Ingredients.pm:use Image::OCR::Tesseract 'get_ocr';
Ingredients.pm: $text =  decode utf8=>get_ocr($image,undef,'fra');

Old Roadmap

OCR/Roadmap

Old OCR results

OCR/Results

References

  1. See process_new_image_off.sh called through incron