This question is about detection of a number having multiple digits in a single image.

I have a trained model in tensorflow using Deep CNN for image recognition. the training was done on cropped images which only had a digit and its label.

Now, the task is to identify any number from the image using this trained model.

I would like this model to work on arbitrary sized number. so how do i extract certain features from the image to be predicted so that individual digit can be detected.

For reference this is the link to the google research paper though it does not elaborate on the issue

here is the data

this question is similar but it does not answer fully as digits nay be too small and close to each other.


1 Answer 1


For this problem, I could provide you with 2 approaches, 1. Naive approach 2. Actually used for object detection.

Talking about the Naive approach, in this approach we can build an end to end pipeline for digits extraction using the following pipeline:

  1. Take images and clean image (maybe take threshold or tune brightness and contrast to remove noise and artefacts)
  2. Take the cleaned image and find the contours of the text inside the image over the text and then finally detect the numbers.

This is certainly one solution but has a lot of complications involved alongwith. To solve this problem, here is other approach that is used in actual OCR. For this, we follow this pipeline:

  1. Take a cleaned image
  2. From left to right (In the order of actual human reading pattern) run a sliding window and after Non-max suppression, find the text.
  3. For each text found using the sliding window, run the prediction and store the prediction in the required format of your choice.

Although this too contains a number of complications and problems related to a number of other problems, this is still the best method and can be tuned as per the requirement to extract the exact required text.

  • $\begingroup$ Thank you for your answer, maybe it's good to refer to general object detection approaches that can be applied for this task too; for instance, YOLO or faster RCNN. $\endgroup$ Apr 5, 2019 at 7:18

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.