visualize model that not in the model zoo
See original GitHub issueHI! as you said:
If you want to port this code to use it on your model that does not have such separation, you just need to do some editing on parts where it calls model.features and model.classifier.
I try to modify the model.features or .classifier part , but i get confused how to do it. Below is part of my script , hope that you can give some details about how to visualize own trained model.
model =torch.load(model_save_path)
for index,(layer,_) in enumerate(model.items()):
# model.items() return the weight of this layer, eg, model.items()[0]=model.0.1.weight
x = layer(x)
......
but i get the TypeError that the object is not callable. i wonder how to read the layer from the trained model that didn’t have features attribute. thanks~
Issue Analytics
- State:
- Created 6 years ago
- Comments:6 (3 by maintainers)
Top Results From Across the Web
Model Zoo - Deep learning code and pretrained models for ...
ModelZoo curates and provides a platform for deep learning researchers to easily find code and pre-trained models for a variety of platforms and...
Read more >FiftyOne Model Zoo - Voxel51
FiftyOne provides a Model Zoo that contains a collection of pre-trained models that you can download and run inference on your FiftyOne Datasets...
Read more >python - How to use Tensorflows object detection model zoo ...
Unfortunately, almost all of the tutorials use label files (.pbtxt) that I do not have. On the appropriate download page of Tensorflow ...
Read more >Why model in tensor flow model zoo have low mAP?
As far as I know, none of the current SOTA detection models have been able to achieve 0.70 mAP on coco. See:.
Read more >Keras Applications
Model Size (MB) Top‑1 Accuracy Top‑5 Accuracy Parameters Depth Time (ms) per infer...
Xception 88 79.0% 94.5% 22.9M 81 109.4
VGG16 528 71.3% 90.1% 138.4M...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Hey, it doesn’t have to contain features, what is important is for the model to contain nn.Sequential so that you can iterate.
Let me elaborate.
You can have an __ init __() function like this:
or this
If you have a model that wraps up layers with nn.Sequential then iterating through layers one by one is super easy.
If there is no nn.Sequential wrapping it up, you can’t use this form (becase there is no pre-defined iterative process) but you can use .modules() or .named_children().
Have a look at these: https://discuss.pytorch.org/t/module-children-vs-module-modules/4551 https://discuss.pytorch.org/t/how-to-loop-over-all-the-variable-in-a-nn-module/912
Hope it helps.
I had one done for one of my projects but did not put it in this repository.
Adapting the code to resnet, or for any other architecture that has nested blocks, is not hard. You only need to change two or three lines of code where it hooks the layers. Because resnet has residual blocks, what you want is to hook the layers inside these blocks and not the blocks themselves.