stacyyang / gluoncv-torch Goto Github PK
View Code? Open in Web Editor NEWPyTorch API for GluonCV Models
License: MIT License
PyTorch API for GluonCV Models
License: MIT License
Do you have any pretrained model on cityscapes or mapillary?
When I load using model = gcv.models.resnet50(pretrained=True)
and test forwarding, error RuntimeError: size mismatch, m1: [1 x 991232], m2: [2048 x 1000]
raises. I think there should be something wrong with stride / downsampling.
# gluoncv-torch resolution
torch.Size([1, 64, 56, 56])
torch.Size([1, 2048, 28, 28])
torch.Size([1, 2048, 22, 22])
torch.Size([1, 991232])
# Pytorch vision resolution
torch.Size([1, 64, 56, 56])
torch.Size([1, 2048, 7, 7])
torch.Size([1, 2048, 1, 1])
torch.Size([1, 2048])
After a quick look into the code, I thought the cause might be the dilation. So I turned off the dilation using model = gcv.models.resnet50(pretrained=True, dilated=False)
. This time model forwards without error, however, does not reach comparable performance as GluonCV claims.
➜ tmp git:(master) ✗ CUDA_VISIBLE_DEVICES=0 python main.py /ssd/dataset/imagenet/ --arch resnet50 --pretrained -e
=> using pre-trained model 'resnet50'
Test: [0/196] Time 8.818 (8.818) Loss 0.5173 (0.5173) Acc@1 86.328 (86.328) Acc@5 97.656 (97.656)
Test: [10/196] Time 0.549 (1.302) Loss 0.9599 (0.6264) Acc@1 76.172 (83.416) Acc@5 92.188 (96.058)
Test: [20/196] Time 0.550 (0.944) Loss 0.7655 (0.6439) Acc@1 84.766 (83.147) Acc@5 92.188 (95.778)
Test: [30/196] Time 0.551 (0.867) Loss 0.7689 (0.6200) Acc@1 82.422 (84.085) Acc@5 95.312 (95.892)
Test: [40/196] Time 0.558 (0.823) Loss 0.6093 (0.6584) Acc@1 86.719 (82.793) Acc@5 96.875 (95.846)
Test: [50/196] Time 0.551 (0.776) Loss 0.4676 (0.6536) Acc@1 88.281 (82.598) Acc@5 96.875 (96.025)
Test: [60/196] Time 0.565 (0.748) Loss 0.9166 (0.6706) Acc@1 74.609 (82.185) Acc@5 94.141 (96.126)
Test: [70/196] Time 0.556 (0.724) Loss 0.6710 (0.6548) Acc@1 78.516 (82.543) Acc@5 97.266 (96.259)
Test: [80/196] Time 0.558 (0.709) Loss 1.2860 (0.6754) Acc@1 67.578 (82.205) Acc@5 90.625 (95.964)
Test: [90/196] Time 0.762 (0.698) Loss 1.8590 (0.7210) Acc@1 57.422 (81.186) Acc@5 86.719 (95.497)
Test: [100/196] Time 0.563 (0.685) Loss 1.0176 (0.7670) Acc@1 73.438 (80.171) Acc@5 92.969 (95.042)
Test: [110/196] Time 0.566 (0.685) Loss 0.7850 (0.7894) Acc@1 81.250 (79.761) Acc@5 94.531 (94.781)
Test: [120/196] Time 0.626 (0.686) Loss 1.1852 (0.8062) Acc@1 72.656 (79.513) Acc@5 90.234 (94.544)
Test: [130/196] Time 0.691 (0.679) Loss 0.6243 (0.8364) Acc@1 83.203 (78.739) Acc@5 96.875 (94.212)
Test: [140/196] Time 0.563 (0.676) Loss 0.9735 (0.8516) Acc@1 75.781 (78.405) Acc@5 92.969 (94.066)
Test: [150/196] Time 0.657 (0.671) Loss 1.0451 (0.8695) Acc@1 79.688 (78.042) Acc@5 89.844 (93.822)
Test: [160/196] Time 0.566 (0.665) Loss 0.6886 (0.8843) Acc@1 84.766 (77.717) Acc@5 94.141 (93.592)
Test: [170/196] Time 0.567 (0.663) Loss 0.5897 (0.9007) Acc@1 83.203 (77.273) Acc@5 96.875 (93.416)
Test: [180/196] Time 0.567 (0.658) Loss 1.1500 (0.9158) Acc@1 68.359 (76.895) Acc@5 94.531 (93.269)
Test: [190/196] Time 0.567 (0.655) Loss 1.1336 (0.9163) Acc@1 68.359 (76.820) Acc@5 94.922 (93.294)
* Acc@1 76.954 Acc@5 93.348
RuntimeError: Failed downloading url https://hangzh.s3.amazonaws.com/encoding/gluoncvth/psp_resnet101_ade-fe990f00.zip
When i run the following code
"
import gluoncvth as gcv
model = gcv.models.resnet50(pretrained=True)
"
I got -- AttributeError: module 'gluoncvth' has no attribute 'models'
And i am confused
from torch.nn.functional import interpolate
ImportError: cannot import name interpolate
Does anyone have this problem?Pytorch = 0.4.0 and python = 2.7.13
What causes it?
What is the image format for resent? RGB or BGR?
in setup.py
requirements = [
'numpy',
'torch',
'tqdm',
'request',
'Pillow',
]
request should be requests
Thanks for the sharing the model.
I ran into loading model error using PyTorch 0.3.1.
I found the problem is because PyTorch model is backward compatible but not forward compatible.
Thanks :)
KeyError: 'unexpected key "pretrained.conv1.1.num_batches_tracked" in state_dict'
please tell me which error for this? thank you
requirements = [
'numpy',
'torch',
'tqdm',
'request',
'Pillow',
]
should be requests
When I use model.load_state_dict(pretrained_model, strict=False)
to load your model,the error occurs.Then I find that the pretrained_model from pretrained_model=gcv.models.resnet101(pretrained=True)
is a class gluoncvth.models.resnet.ResNet
,not a dict.It also can't use pretrained_model.items()
or .state.dict()
to change the layers in pretrained_model.
How can I deal with these problems ?Please give me a hand.
Hi, thanks for the great work. I have encountered an error when loading the pretrained weight for resnet-101.
RuntimeError: Error(s) in loading state_dict for ResNet: size mismatch for bn1.running_mean: copying a param with shape torch.Size([64]) from checkpoint, the shape in current model is torch.Size([128]). size mismatch for bn1.bias: copying a param with shape torch.Size([64]) from checkpoint, the shape in current model is torch.Size([128]). size mismatch for bn1.weight: copying a param with shape torch.Size([64]) from checkpoint, the shape in current model is torch.Size([128]). size mismatch for bn1.running_var: copying a param with shape torch.Size([64]) from checkpoint, the shape in current model is torch.Size([128]). size mismatch for layer1.0.conv1.weight: copying a param with shape torch.Size([64, 64, 1, 1]) from checkpoint, the shape in current model is torch.Size([64, 128, 1, 1]). size mismatch for layer1.0.downsample.0.weight: copying a param with shape torch.Size([256, 64, 1, 1]) from checkpoint, the shape in current model is torch.Size([256, 128, 1, 1]).
The parameter deep_base=True
has been set. And there is no problem when deep_base=False
.Could you help with this? Thanks!
flake8 testing of https://github.com/zhanghang1989/gluoncv-torch on Python 3.7.0
$ flake8 . --count --select=E901,E999,F821,F822,F823 --show-source --statistics
./gluoncvth/models/resnet.py:225:45: F821 undefined name 'root'
get_model_file('resnet18', root=root)), strict=False)
^
./gluoncvth/models/resnet.py:238:45: F821 undefined name 'root'
get_model_file('resnet34', root=root)), strict=False)
^
2 F821 undefined name 'root'
2
Sorry to distrub, but do need a example for how to train a model....
Can you provide more models,such as modified ResNet that 7x7Conv convert to 3 3x3Conv.
Which models are voc detection model and segmentation model?
And what will be their output?
The pretrained model can't be loaded because access to the server is denied.
Are there Pretrained models, such as resnet, preresnet, resnext on CIFAR-10 or CIFAR-100 ?
There are some code to show how to convert gluoncv models to pytorch? Thank you~
Hi ! Thanks for sharing the trained model, I wonder how to reproduce this result.
For example, for ADE dataset, this training set is the same as Pytorch-Encoding repo??
What is the learning rate and crop size, batch size
When training ResNet on ImageNet, the GluonCV uses a batchsize of 128x8GPUs with cosine learning rate. Do you have any suggestion to scale learning rate when using a small batchsize? I tried directly scaling down learning rate by the ratio of batchsize but it did not work very well.
Thanks.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.