Optical Character Recognition (OCR), a technique for reading the text in an image or from a camera feed, is applied actively through modern manufacturing facilities. OCR is used across barcode reading, sell-by date verification, label verification, reading return slips, and more.
Consider the following image:
An OCR system returns the following characters:
PART NUMBER 10629101
In this guide, we are going to discuss, briefly, what OCR is and how it is used in manufacturing. We will also share guidance on how you can implement OCR in your manufacturing facility.
Without further ado, let’s get started!
What is Optical Character Recognition?
Optical Character Recognition (OCR) involves reading text in an image. For example, you can read the lot code on a product to make sure it shows the expected value or you can check to ensure an expiry date contains all of the required information.
OCR has evolved significantly as a result of breakthroughs in computer vision. A common approach to OCR is to use an AI-powered computer vision system such as DocTR to read the characters in an image. Purpose-built OCR models are trained on a vast range of text with the goal of reading as many characters as possible.
Another common approach is to train a custom object detection model that identifies characters in the typeface(s) you use in your products. This will achieve better accuracy as custom models can be more effective when trained on data similar to the environment in which they are deployed.
Use Cases for OCR in Manufacturing
There are many use cases for OCR in manufacturing. For example, you can use OCR to:
- Verify dates on a product.
- Ensure a label has all the required text.
- Scan return slips for required information.
- Read ID numbers (i.e. ISBNs).
You can connect OCR to manufacturing execution systems to meet your requirements. For instance, you could use OCR to scan a box before it is prepared for shipping. This could be used to update an internal system so that it knows the parcel is about to be shipped. You could use OCR to scan return slips so that consumers can be notified when their parcel has been received by a warehouse. This could trigger an automated return.
How to Use OCR in Manufacturing
Earlier in this guide, we mentioned two ways to apply OCR in manufacturing:
- Use an out-of-the-box system, or;
- Train a custom model.
We recommend trying an out-of-the-box system to see how well it works for your use case. If an existing model struggles to read your text, you can use a custom model to identify characters.
Roboflow Inference supports DocTR for use in OCR. DocTR can be run with Inference in a few lines of Python code. This code can be directly integrated into your existing business logic, or used to develop new business logic.
Consider the following image of a product label:
Here are the results from DocTR reading the label:
PART NUMBER 10629101
DocTR successfully read the text on the label.
To learn about how to use DocTR, and how to run DocTR on your own hardware, refer to the Roboflow Inference documentation.
One drawback of DocTR is that it is slower than running a custom model. For optimal performance, training a custom model may be more appropriate.
If DocTR struggles to read your text, or DocTR is too slow for your use case, you can train a custom system to recognize characters. This involves annotating characters on labels to build a system that identifies the exact typeface of characters on your product. You would label A, B, C, 1, 2, 3, etc. We recommend labeling at least 100 images to get started with multiple examples of each letter.
If you train a custom model, you can run OCR at multiple frames per second.
To learn more about training a custom model, refer to the Roboflow Getting Started guide.
OCR is the process of reading text characters in an image. You can use OCR to read text visible on a camera and then process the text as necessary. For example, you could read sell-by dates to ensure the date is correct and that there are no numbers missing. You could scan return slips for use in flagging when a product has been received by a warehouse.
You can use a pre-trained model like DocTR to read characters in text. This is recommended since you can deploy a system substantially faster than you would if you trained your own character recognition model. If DocTR struggles for your use case, you can train a character recognition model. This process is time consuming but will allow you to more precisely read characters in an image.