Open SofieGeens opened 1 year ago
Same issue here
我也遇到该问题, model = model_pkg.Model(num_class=num_class, **network_params)
the "init(self, opt):" need opt object as a parameter whereas the "model = model_pkg.Model(num_class=num_class, **network_params)" passes network_params object as a parameter.
I trained a custom model with deep-text-recognition-benchmark. I moved the pth file and the model.py file from this repository to the correct locations on my machine and changed the file names to all be the same. I think there is still some problem in the model.py. I get the following error if I try to run:
Traceback (most recent call last): File "C:\Users\sofie\OneDrive\Documenten\unif\2022-2023\masterproef\stageOSG\testOCR.py", line 34, in
reader = easyocr.Reader(['en'], recog_network='numbers_model')
File "C:\Users\sofie\AppData\Local\Programs\Python\Python310\lib\site-packages\easyocr\easyocr.py", line 227, in init
self.recognizer, self.converter = get_recognizer(recog_network, network_params,\
File "C:\Users\sofie\AppData\Local\Programs\Python\Python310\lib\site-packages\easyocr\recognition.py", line 166, in get_recognizer
model = model_pkg.Model(num_class=num_class, **network_params)
TypeError: Model.init() got an unexpected keyword argument 'num_class'
There is a problem with the .py file I'm pretty sure, but I don't know how to fix it. The model.py file looks like this:
import torch.nn as nn from modules.transformation import TPS_SpatialTransformerNetwork from modules.feature_extraction import VGG_FeatureExtractor, RCNN_FeatureExtractor, ResNet_FeatureExtractor from modules.sequence_modeling import BidirectionalLSTM from modules.prediction import Attention
class Model(nn.Module):