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

Error in loading your pretrained model #5

Open
Harish202 opened this issue Oct 23, 2020 · 11 comments
Open

Error in loading your pretrained model #5

Harish202 opened this issue Oct 23, 2020 · 11 comments

Comments

@Harish202
Copy link

Hi, I am trying to evaluate your trained model. However during loading the pre trained weights I am getting dimension related error in row_graph_gravnet_0 layer. Below is the error:

ValueError: Layer #421 (named "row_graph_gravnet_0") expects 12 weight(s), but the saved weights have 6 element(s).

I am not sure if I am missing something. In config only field related to row_graph_gravnet is GRAPH_NEIGHBORS = 20. Is there any other value need to be added. Appreciate your earliest response. Thanks

@sachinraja13
Copy link
Owner

Can you please try to pull the latest code and try again. Issue should have been resolved.

@whalefa1I
Copy link

something similar happend when loading the model

model = modellib.MaskRCNN(mode="inference", config=config, model_dir='/TabStructNet/trained_model/tab/logs/') model.load_weights('/mask_rcnn_tab_0120.h5',by_name=False) result = model.detect([image],verbose=1)
ValueError: Layer #257 (named "graph_edge_conv_layer_4_row_dense_1" in the current model) was found to correspond to layer mrcnn_mask_bn1 in the save file. However the new layer graph_edge_conv_layer_4_row_dense_1 expects 2 weights, but the saved weights have 4 elements.

@sachinraja13
Copy link
Owner

The trained model provided in the Google Drive has also been updated. Did you try after downloading the latest versions of both the code as well as the trained model?

@whalefa1I
Copy link

The trained model provided in the Google Drive has also been updated. Did you try after downloading the latest versions of both the code as well as the trained model?

I have updated the code(28/1/2021) and the model(14/1/2021) and the same problem still exists

@sachinraja13
Copy link
Owner

I cloned the repository at my end, downloaded the models and annotation files from the drive link and model was loaded without any problem.

Just to confirm, can you please try using python version 3.6.11 and requirements.txt file as attached here?

Let me know if the issue still persists.

requirements.txt

@whalefa1I
Copy link

I cloned the repository at my end, downloaded the models and annotation files from the drive link and model was loaded without any problem.

Just to confirm, can you please try using python version 3.6.11 and requirements.txt file as attached here?

Let me know if the issue still persists.

requirements.txt

I can run the evaluation part without any error, but it happended when I try to predict a new picture using:
`from mrcnn import model as modellib

config = InferenceConfig()
config.display()

model = modellib.MaskRCNN(mode='inference',
config=config,
model_dir=log_dir)
model.load_weights('./TabStructNet/trained_model/tab/logs/tab20200821T0923/mask_rcnn_tab_0120.h5')`
so how to predict my own table image with your model ?thx!!

@sachinraja13
Copy link
Owner

Just to confirm, after you have pulled the latest code, did you execute "python setup.py install" from the root directory to install the new binaries?

@whalefa1I
Copy link

Just to confirm, after you have pulled the latest code, did you execute "python setup.py install" from the root directory to install the new binaries?

yesInstalled d:\anaconda\envs\tabstrucnet\lib\site-packages\mask_rcnn-2.1-py3.6.egg Processing dependencies for mask-rcnn==2.1 Finished processing dependencies for mask-rcnn==2.1

@sureshreddy-puthireddy
Copy link

Hi sir,
I cloned the repository latest one, I have downloaded the latest models and annotation files from the drive links.
I created a new virtual environment with python version 3.6, installed python setup.py install, and also installed requirements here attaching the requiremnets.txt file.
requirements.txt

the issue I'm getting while loading the model
model = modellib.MaskRCNN(mode="inference", config=config, model_dir='/TabStructNet/trained_model/tab/logs/') model.load_weights('/mask_rcnn_tab_0120.h5',by_name=True) (or) model.load_weights('/mask_rcnn_tab_0120.h5',by_name=False) result = model.detect([image],verbose=1)

Layer #385 (named "mrcnn_class_logits"), weight <tf.Variable 'mrcnn_class_logits/kernel:0' shape=(1024, 1) dtype=float32_ref> has shape (1024, 1), but the saved weight has shape (1024, 2)

Can you please suggest the right approach.....

@sureshreddy-puthireddy
Copy link

@sachinraja13 Can you suggest the right way to loading the pre-trained models

@nikhilcms
Copy link

Hi @sachinraja13 , Can you please suggest how to evaluate model on input images , I am getting below error:
ValueError: Layer #257 (named "graph_edge_conv_layer_4_row_dense_1" in the current model) was found to correspond to layer mrcnn_mask_bn1 in the save file. However the new layer graph_edge_conv_layer_4_row_dense_1 expects 2 weights, but the saved weights have 4 elements.

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

5 participants