Closed saurabh502 closed 5 years ago
Hi @saurabh502,
This repo looks great! I have added some examples here, hope it helps!
Thank you @PPPW, When I tried implementing pnasnet5large example as per your suggestion, I am getting below error:
RuntimeError: Given input size: (4320x10x10). Calculated output size: (4320x0x0). Output size is too small at /opt/conda/conda-bld/pytorch_1556653099582/work/aten/src/THCUNN/generic/SpatialAveragePooling.cu:47
Below is my code:
def pnasnet5large(pretrained=False): return ptcv_get_model("pnasnet5large", pretrained=False).features
m = ptcv_get_model("pnasnet5large", pretrained=False) output_size = m.output[1].out_features
learn = cnn_learner(data, pnasnet5large, pretrained=False, cut=noop, split_on=lambda m: (m[0][3], m[1]), custom_head=nn.Linear(output_size, data.c), model_dir=MODEL_PATH,metrics=accuracy)
learn.fit_one_cycle(4,max_lr=slice(1e-3,1e-1))
Hmm, thanks for checking, I used the wrong number for the custom head feature size. Just fixed it
Thanks for looking into this, what has changed ? I don't see any difference here: https://github.com/PPPW/deep-learning-random-explore/blob/63a434a7a513ab3d63a4d6e8571a456ad3b21609/CNN_archs/cnn_archs_more.ipynb
Hi PPPW, thank you for looking into this, unfortunately I am getting the same error, below is the updated code and error message
`m = ptcv_get_model("pnasnet5large", pretrained=False) output_size = m.output[1].in_features
def pnasnet5large(pretrained=False): return ptcv_get_model("pnasnet5large", pretrained=False).features
learn = cnn_learner(data, pnasnet5large, pretrained=False, cut=noop, split_on=lambda m: (m[0][3], m[1]), custom_head=nn.Sequential(Flatten(), nn.Linear(output_size, data.c)), model_dir=MODEL_PATH,metrics=accuracy)
learn.fit_one_cycle(4,max_lr=slice(1e-3,1e-1))`
error:
`--------------------------------------------------------------------------- RuntimeError Traceback (most recent call last)
Can you run the following without error?
sz = # your image size
with torch.no_grad():
learn.model.eval()
print(learn.model(torch.randn(1,3,sz,sz))
Hi, no when I am using size 300 , it is giving me below error:
`-------------------------------------------------------------------------- RuntimeError Traceback (most recent call last)
Maybe you need to resize your image to 331 (the size they use in their model)
Thanks resizing image to 331 worked for me. Though I am not getting good results :)
Hi ,
I found this wonderful github repo containing many models: https://github.com/osmr/imgclsmob/blob/master/pytorch/README.md
Can we include all here, so that we can integrate them with Fastai ?
Thanks in advance for your help!