# -- coding utf-8 --Spyder EditorThis is a temporary script fileimport osimport matplotlibpyplot as pltimport numpy as npfrom kerasapplications import VGG16from keraspreprocessingimage import ImageDat
代码运行时出现了一些错误,主要是拼写错误和参数设置错误。
-
修改了导入VGG16模型时的拼写错误,将原来的
from keras.applications import VGG16修改为from keras.applications.vgg16 import VGG16。 -
将
Sigmoid修改为sigmoid,因为sigmoid是小写字母。 -
将
binary_crpssentropy修改为binary_crossentropy,因为损失函数名称拼写错误。 -
修改了提取特征函数中的
features和labels初始化的错误,将np.zeros()中的参数改为正确的形状。
修改后的代码如下:
原文地址: https://www.cveoy.top/t/topic/fhNr 著作权归作者所有。请勿转载和采集!