Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SwiftOCRTraining doesn't generate any trainData and testData #142

Open
songhailiang opened this issue Jul 16, 2018 · 0 comments
Open

SwiftOCRTraining doesn't generate any trainData and testData #142

songhailiang opened this issue Jul 16, 2018 · 0 comments

Comments

@songhailiang
Copy link

Hi,
I'm trying to training the app using SwiftOCRTraining,

SwiftOCRTraining().trainWithCharSet()

but i find after the generate method finished, the trainData does not have any items

let trainData = generateRealisticCharSet(numberOfTrainImages/4)
// trainData is empty

this is caused by the blobs is not equal to 6,

            if blobs.count == 6 {
                for blobIndex in 0..<blobs.count {
                    let blob = blobs[blobIndex]
                    let imageData = ocrInstance.convertImageToFloatArray(blob.0)
                    var imageAnswer = [Float](repeating: 0, count: recognizableCharacters.characters.count)
                    if let index = Array(recognizableCharacters.characters).index(of: Array(code.characters)[blobIndex]) {
                        imageAnswer[index] = 1
                    }   
                    trainingSet.append((imageData,imageAnswer))
                }
            }

I don't know why this happened, can anybody help me?
Many thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant