What is the name of the ipynb file that Jerome is walking through in Lesson-7 - That has RESNET?
He said that he isnt going to make that notebook live because it’s got very small incremental changes compared to what’s already there in lesson3 dogs vs cats notebook. So you would have to recreate by yourself.
Any specific issues while recreating it?
Hi @karthik_k314 I am having some difficulties recreating the model from ResNet50, if you could give me some hint, that will be great! Thanks!
%matplotlib inline
import utils; reload(utils)
from utils import *
from __future__ import division, print_function
#from resnet50 import *
from keras.applications.resnet50 import ResNet50
from keras.models import Model
from keras.layers import Flatten, Dense, Dropout
from keras.layers.normalization import BatchNormalization
resnet_model=ResNet50()
layers = resnet_model.layers
last_conv_idx = [index for index, layer in enumerate(layers)
if type(layer) is Convolution2D][-1]
last_conv_idx #the output is 177
conv_layers=layers[:last_conv_idx+1]
conv_model = Sequential(conv_layers) #Stuck here...
Error:
TypeError Traceback (most recent call last)
<ipython-input-9-34b747f79c6f> in <module>()
21 conv_layers=layers[:last_conv_idx+1]
22
---> 23 conv_model = Sequential(conv_layers)
/home/shi/anaconda2/lib/python2.7/site-packages/keras/models.pyc in __init__(self, layers, name)
271 if layers:
272 for layer in layers:
--> 273 self.add(layer)
274
275 def add(self, layer):
/home/shi/anaconda2/lib/python2.7/site-packages/keras/models.pyc in add(self, layer)
330 output_shapes=[self.outputs[0]._keras_shape])
331 else:
--> 332 output_tensor = layer(self.outputs[0])
333 if isinstance(output_tensor, list):
334 raise TypeError('All layers in a Sequential model '
/home/shi/anaconda2/lib/python2.7/site-packages/keras/engine/topology.pyc in __call__(self, inputs, mask)
1430 if not isinstance(inputs, list):
1431 raise TypeError('Merge can only be called on a list of tensors, '
-> 1432 'not a single tensor. Received: ' + str(inputs))
1433 if self.built:
1434 raise RuntimeError('A Merge layer cannot be used more than once, '
TypeError: Merge can only be called on a list of tensors, not a single tensor. Received: if{}.0
BTW I am using the ResNet50 from keras.applications
, not the one provided by Jerome…
I highly appreciate it!