NMAC427 / SwiftOCR

Fast and simple OCR library written in Swift
Apache License 2.0
4.61k stars 481 forks source link

Can't recognise simple images #93

Open yatendray opened 7 years ago

yatendray commented 7 years ago

I am trying both Tesseract and SwiftOCR paraller. I have implemented your just 6 lines of code. Tesseract recognise all images except your image (YourImage) And SwiftOCR recognise only this image not others.

images.zip

Please help.

MlabTechnologies commented 6 years ago

I am experiencing the same issue. I believe you have to retrain the neural net powering SwiftOCR to handle different fonts.

MlabTechnologies commented 6 years ago

P.S. to do the retraining, view the instructions towards the bottom of the main readme file.

kevinmlong commented 6 years ago

I was getting garbage when I did a small test. The documentation for this framework is somewhat lacking and a lot of the issues have no response from the developer. I did the training, but how do you make use of the OCR-Network file that is created? I was really hoping this framework was going to do well for a few reasons:

NMAC427 commented 6 years ago

SwiftOCR can't recognise multi line text. Only if you want to recognise short, single line alphanumeric strings (e.g. AB54ND84) you should consider using SwiftOCR.

@kevinmlong I developed SwiftOCR for a free time project (now I use a highly customised version of SwiftOCR) I have and never intended changing the OCR-Network File during runtime. You can change it, but it is a ugly solution with global variables (maybe I should rewrite SwiftOCR using better coding style 😉).

import SwiftOCR

recognizableCharacters = "abc...ABC...123" // Characters you trained SwiftOCR on (in the same order!)

let ocrNetworkURL = Bundle.main.url(forResource: "OCR-Network", withExtension: nil)! // URL of the OCR-Network file
globalNetwork = FFNN.fromFile(ocrNetworkURL)!

After setting the globalNetwork and the recognizableCharacters, you can use your custom OCR Network file.