1
$\begingroup$

So the task at hand is to detect the denomination of any currency banknote. The dataset I have is about 2k images of each denomination (12 in total). An example banknote (after noise removal, erosion , dilation etc) looks like this:

enter image description here

enter image description here

Is it possible to somehow fine-tune a digit-detection (in the wild) model (such as those trained using the SHVN dataset) to make it a multi-digit detector? Or is it preferred to simply use a multi-digit detector as the base model and train it (transfer learning?) using my banknotes dataset?

I also wanted some ideas on localizing the position of the number on the banknote, as then the detection using CNN would be more reliable, if I feed it the cropped out image which just contains the number. I tried using pyTesseract for this, but even after tinkering with the settings, it did not give satisfactory results. Are there any other methods that can be used for this kind of localization?

Thank you in advance.

$\endgroup$

2 Answers 2

1
$\begingroup$

What you're looking for is called Optical Character Recognition. A really good example of using CNNs to do OCR in keras is here.

$\endgroup$
1
$\begingroup$

This is a very common problem statement which can be solved using a Computer Vision model.

Is it possible to somehow fine-tune a digit-detection (in the wild) model (such as those trained using the SHVN dataset) to make it a multi-digit detector?

This may or may not give you proper results as the model originally is trained on single digit detection. Hence you might run into some issues.

Or is it preferred to simply use a multi-digit detector as the base model and train it (transfer learning?) using my banknotes dataset?

This IMO would probably give you proper results as the model is originally trained for multi digit detection and your task is similar as well. Anyways you should try both approaches and see which one works the best.I might be proved wrong!

Also there is a third approach which I think would also work:

This is a two fold problem where in the first stage you either use a Bounding Box object detection or a segmentation object detection model to detect the digits you want.

Next crop the detected area using open-cv or Pillow

Then use an OCR engine on the cropped images to extract the text.

Make sure tho change the config parameters of pytesseract to just detect digits in order to improve the accuracy of the OCR.

Let me know which approach worked for you!

Cheers!

$\endgroup$
1
  • 1
    $\begingroup$ The third approach is definitely the way to go here. Get bounding boxes with your digits and then run them through OCR. Detecting a bunch of single digits and trying to link them together based on their pixel locations would be...annoying to say the least. just wanted to qualify that I'm pretty sure "digits" and "char_whitelist" have both been defunct in tesseract since version 4.0. If you want to use them you have to use an old version. I will say that if you code in the common number => letter mistakes provided in the docs, it's pretty good with digits even on default settings. $\endgroup$
    – Jeremiah
    Dec 19, 2023 at 18:37

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.