Closed ReIDkj closed 1 year ago
Hello @ReIDkj :wave:
Yes there is! Here is the explanation:
[0]
by a dot .0
(bare in mind that -1 won't work thenSo you can either use the module itself (recommended):
cam_extractor = CAM(model, model.backbone.shared_module_bh.model_sh_fr.layer4[-1])
or use the string argument (below I supposed that the last item was at index 3):
cam_extractor = CAM(model, 'model.backbone.shared_module_bh.model_sh_fr.layer4.3')
Hope this helps, let me know if some aspects are unclear :) Cheers :v:
Thank you!
code: cam_extractor = CAM(model, target_layer=model.backbone.shared_module_bh.model_sh_fr.layer4[-1].conv3, fc_layer=model.classifier)
can work. The network structure should not add ' ' .
Happy to help! I'll close the issue then, feel free to reopen if some details are unclear :)
Bug description
My network structure is a little complex,when run:
the error occurred:
but
print(model.backbone.shared_module_bh.model_sh_fr.layer4[-1])
is executable and correct Is there any solution? thanksCode snippet to reproduce the bug
Error traceback
Environment