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 when nr_type=0 in run_tile.sh with hovernet_fast_pannuke_type_tf2pytorch.tar #101

Closed
bswhite opened this issue Feb 3, 2021 · 2 comments

Comments

@bswhite
Copy link

bswhite commented Feb 3, 2021

Hi,

I get the (truncated) error message below when using the run_tile.sh script currently in github (and attached). It runs the pannuke_type model ... but with nr_type = 0.

I suspect the nr_type = 0 is a typo: When I set nr_type = 6, the script runs to successful completion.

Is nr_type = 6 correct for this model? (I copied it from run_wsi.sh, which uses the same model). In general, would we set this parameter by going back to the description of the corresponding data set to see the number of cell types annotated within it? I understand nr_type must be 0 for segmentation only.

Thank you for making your code available!

Best,
Brian

|2021-02-03|17:33:41.748| [INFO] .... Detect #GPUS: 1
Traceback (most recent call last):
File "run_infer.py", line 181, in
infer = InferManager(**method_args)
File "/pod/2/chuang-lab/USERS/whitebr/hover_net/infer/base.py", line 27, in init
self.__load_model()
File "/pod/2/chuang-lab/USERS/whitebr/hover_net/infer/base.py", line 68, in __load_model
net.load_state_dict(saved_state_dict, strict=True)
File "/home/whitebr/anaconda3/envs/hovernet-gpu/lib/python3.6/site-packages/torch/nn/modules/module.py", line 1045, in load_state_dict
self.class.name, "\n\t".join(error_msgs)))
RuntimeError: Error(s) in loading state_dict for HoVerNet:
Unexpected key(s) in state_dict: "decoder.tp.u3.dense.units.7.preact_bna/bn.weight", "decoder.tp.u3.dense.units.7.conv2.weight",
...
run_tile.sh.txt

@vqdang
Copy link
Owner

vqdang commented Feb 3, 2021

Yes, another artifact from my latest debug commit.

vqdang added a commit that referenced this issue Feb 3, 2021
@vqdang
Copy link
Owner

vqdang commented Feb 3, 2021

Is nr_type = 6 correct for this model? (I copied it from run_wsi.sh, which uses the same model). In general, would we set this parameter by going back to the description of the corresponding data set to see the number of cell types annotated within it? I understand nr_type must be 0 for segmentation only.

nr_type is propagated down to netdesc to create typing branch. Segmentation only usually doesnt concern with typing, but the current mechanism when loading model weight enforces that all names in model weight must exist in netdesc, hence the above error. Strictly speaking you can change this behavior manually if you know what you are doing here

net.load_state_dict(saved_state_dict, strict=True)
.

@vqdang vqdang closed this as completed Feb 3, 2021
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