keras-team / keras-applications

Reference implementations of popular deep learning models.
Other
2k stars 910 forks source link

resnet50 is hanging on returning model in keras 2.2.0 and TF1.10 #98

Open rmanicav opened 5 years ago

rmanicav commented 5 years ago

Hi,

keras version 2.2.2, python 3.5.6, TensorFlow 1.10.0

I am trying to create a ResNet50 model. It just hangs there on below line

model = applications.resnet50.ResNet50(weights='imagenet', include_top='False',pooling='avg')

Please see below the imports

from keras import applications from keras.applications.resnet50 import preprocess_input from keras.preprocessing import image import numpy as np import pandas

Please see below for method

            img = image.load_img(img_path, target_size=(224, 224))
             x = image.img_to_array(img)
              x = np.expand_dims(x, axis=0)
              x = preprocess_input(x)
          **model = applications.resnet50.ResNet50(weights='imagenet', 
                        include_top='False',pooling='avg')`
              features = model.predict(x)[0]
               features_arr = np.char.mod('%f', features)

Any guidance is really appreciated.

Thanks

laihaotao commented 5 years ago

if you don't have the pretrain model, it will need to download which will take some time.