0

I have trying to import resnet34 and resent50 into a Kaggle Kernal with no success. When I run:

from keras.applications.resnet50 import ResNet50 as resnet50
resnet = ResNet50(weights='imagenet')
learn = ConvLearner.pretrained(resnet, data, precompute=True) 

It starts downloading : 'Downloading: "https://download.pytorch.org/models/resnet34-333f7ec4.pth" to /tmp/.torch/models/resnet34-333f7ec4.pth'

but says "URL fetch failure on https://github.com/fchollet/deep-learning-models/releases/download/v0.2/resnet50_weights_tf_dim_ordering_tf_kernels.h5: None -- [Errno -2] Name or service not known"

and with resnet34:

 arch=resnet34
 learn = ConvLearner.pretrained(arch, data, precompute=True) 

I get: URLError: <urlopen error [Errno -2] Name or service not known>

Others seem to be importing using these same line.

Rahul Deora
  • 157
  • 1
  • 8

1 Answers1

1

You're getting this error because Kaggle kernels don't (currently) have internet access, so you're not able to fetch things via URL.

You can add these models to your kernel by adding the relevent datasets (linked below) and then reading them in as you would any other file from the file path "../input/[name_of_dataset]/[name_of_file]". (You should replace [name_of_dataset] and [name_of_file] with the actual names of your dataset and desired file, of course. :)

Hope that helps!

Rachael Tatman
  • 841
  • 7
  • 6
  • So you're saying I should download the dataset, then upload it to the competition kernel where I want to use it and then read it? Also as you can see the renet34 CovLeaner is with the fast.ai library and that is not executing as well. – Rahul Deora May 22 '18 at 08:32