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

Empty result for custom model #1325

Open
Spidrre opened this issue Oct 18, 2024 · 2 comments
Open

Empty result for custom model #1325

Spidrre opened this issue Oct 18, 2024 · 2 comments

Comments

@Spidrre
Copy link

Spidrre commented Oct 18, 2024

I have a dataset of small (64x64) images with both cyrillic and english alphabets. Model has successfully trained with 100% accuracy. But when I use my model on the same images it has been trained on, it returns empty list for some unknown reason. Has anyone came across this typf of issue? If so, please share how you managed to solve it

Code that I use to run cusom model which returns empty result:

image_path = "my_image.jpg"
image = cv2.imread(image_path, cv2.IMREAD_GRAYSCALE)

reader = easyocr.Reader(['ru'],
                        model_storage_directory='EasyOCR/model',
                        user_network_directory='EasyOCR/user_network',
                        recog_network='custom_example')
result = reader.readtext(image, detail=0)
print(result)

Log:

[30000/30000] Train loss: 0.00000, Valid loss: 0.00002, Elapsed_time: 1995.82752
Current_accuracy : 100.000, Current_norm_ED : 1.0000
Best_accuracy : 100.000, Best_norm_ED : 1.0000

Ground Truth | Prediction | Confidence Score & T/F

ТС | ТС | 0.9798 True
НОР | НОР | 0.9901 True

Config for training:

number: '0123456789'
symbol: "!"#$%&'()*+,-./:;<=>?@[\]№_`{|}~ €₽"
lang_char: 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyzАБВГДЕЁЖЗИЙКЛМНОПРСТУФХЦЧШЩЪЫЬЭЮЯабвгдеёжзийклмнопрстуфхцчшщъыьэюя'
experiment_name: 'APB_train_02'
train_data: 'all_data'
valid_data: 'all_data/val'
manualSeed: 1111
workers: 6
batch_size: 64 #32
num_iter: 30000
valInterval: 200
saved_model: 'F:\PycharmProjects\pythonProject\APB\OCR\EasyOCR\trainer\cyrillic_g2.pth'
FT: True
optim: False # значение по умолчанию - Adadelta
lr: 1.
beta1: 0.9
rho: 0.95
eps: 0.00000001
grad_clip: 5
#Data processing
select_data: 'train_filtered' # это папка dataset в train_data
batch_ratio: '1'
total_data_usage_ratio: 1.0
batch_max_length: 68
imgH: 64
imgW: 64
rgb: False
contrast_adjust: False
sensitive: True
PAD: True
contrast_adjust: 0.0
data_filtering_off: False

Архитектура модели

Transformation: 'None'
FeatureExtraction: 'VGG'
SequenceModeling: 'BiLSTM'
Prediction: 'CTC'
num_fiducial: 20
input_channel: 1
output_channel: 256
hidden_size: 256
decode: 'greedy'
new_prediction: False
freeze_FeatureFxtraction: False
freeze_SequenceModeling: False

custom-example.yaml (i have tried switiching to 'en', it didnt work):

network_params:
input_channel: 1
output_channel: 256
hidden_size: 256
imgH: 64
lang_list:
- 'ru'
-
character_list: 0123456789!"#$%&'()*+,-./:;<=>?@[\]№_`{|}~ €₽ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyzАБВГДЕЁЖЗИЙКЛМНОПРСТУФХЦЧШЩЪЫЬЭЮЯабвгдеёжзийклмнопрстуфхцчшщъыьэюяЂђЃѓІіЇїЈјЉљЊњЋћЌќЎўЏџҐґҒғҚқҮүҲҳҶҷӀӏӢӣӨөӮӯ

@romanvelichkin
Copy link

EasyOCR contains two models: a detector and a recognizer. You have trained the recognizer.

I think the images you used for training are too small for the detector. Try placing the training images on some larger image and test on that image.

@Spidrre
Copy link
Author

Spidrre commented Oct 21, 2024

That maybe so, however I do get something in my result list when I use reader.recognize() method (which still returns incorrect predictions, however that may be a problem of my training dataset).

Thanks for the idea though

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

2 participants