Reputation: 673
I am training a Convolutional Neural Network to recognize MRZ(Machine Readable Zone) characters, on a smartphone. I want to know if in order to improve accuracy I should train it with multiple fonts, even if MRZ only uses OCR-B. Also, the model does not perform on device with the same level of accuracy as in the python code I use to train/test it. Any ideas?
This is the architecture I'm using:
model = Sequential()
model.add(Convolution2D(filters=32, kernel_size=(3, 3), strides=(2, 2), activation='relu', input_shape=input_shape))
model.add(MaxPooling2D(pool_size=(2, 2)))
model.add(Dropout(0.5))
model.add(Convolution2D(filters=64, kernel_size=(1, 1), strides=(1, 1), activation='relu'))
model.add(MaxPooling2D(pool_size=(2, 2)))
model.add(Dropout(0.2))
model.add(Flatten())
model.add(Dense(128, activation='relu'))
model.add(Dense(num_classes, activation='softmax'))
model.compile(loss='categorical_crossentropy', optimizer='adam', metrics=['accuracy'])
Upvotes: 1
Views: 499
Reputation: 475
If MRZ use only one font, then you should use only this font to train your CNN.
In order to improve results, you should preprocess the image before passing it to the CNN, for example, at first identify text zones in an image and then pass them through CNN.
The accuracy of the model can change from a device to another because of processing unit architecture, for example, CPU and GPU will get different results due to numerical stability.
Upvotes: 1