Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #model creation
- base_model = applications.inception_v3.InceptionV3(include_top=False,
- weights='imagenet',
- pooling='avg',
- input_shape=(img_rows, img_cols, img_channel))
- #Adding custom Layers
- add_model = Sequential()
- add_model.add(Dense(128, activation='relu',input_shape=base_model.output_shape[1:],
- kernel_regularizer=regularizers.l2(0.001)))
- add_model.add(Dropout(0.60))
- add_model.add(Dense(2, activation='sigmoid'))
- # creating the final model
- model = Model(inputs=base_model.input, outputs=add_model(base_model.output))
- model = load_model(os.path.join(ROOT_DIR,'model_1','model_cervigrams_all.h5'))
- #remove the last two layers
- #remove dense_2
- model.layers[-1].pop()
- #remove dropout_1
- model.layers[-1].pop()
- model.summary() # last alyer output shape is : (None, 128), so the removal worked
- #predict
- model.predict(np.reshape(image,[1,image.shape[0],image.shape[1],3])) #output only two values
Add Comment
Please, Sign In to add comment