2020
10-08
10-08
keras K.function获取某层的输出操作
如下所示:fromkerasimportbackendasKfromkeras.modelsimportload_modelmodels=load_model('models.hdf5')image=r'image.png'images=cv2.imread(r'image.png')image_arr=process_image(image,(224,224,3))image_arr=np.expand_dims(image_arr,axis=0)layer_1=K.function([base_model.get_input_at(0)],[base_model.get_layer('layer_name').output])f1=layer_1([image_arr])[0]加载训练好并保存的网络模型...
继续阅读 >