我想找到模型的概率,以便稍后找到AUC和ROC,但出现此错误:
ValueError:检查输入时出错:预期input_1具有4 尺寸,但数组的形状为(83,1)
我的代码:
def create_resnet(img_dim,CHANNEL,n_class):
input_tensor=Input(shape=(img_dim, img_dim,CHANNEL))
base_model = ResNet50(weights=None, include_top=False, input_tensor=input_tensor)
base_model.load_weights('D:/Diabetic retinopathy data set/ResNet50/resnet50_weights_tf_dim_ordering_tf_kernels_notop.h5')
x=GlobalAveragePooling2D()(base_model.output)
x=Dropout(0.3)(x)
x=Dense(1024, activation=relu)(x)
x=Dropout(0.2)(x)
x=Dense(512, activation=relu)(x)
x=Dropout(0.2)(x)
x=BatchNormalization()(x)
output_layer=Dense(n_class,activation='softmax', name="Output_Layer")(x)
model_resnet =Model(input_tensor, output_layer)
return model_resnet
model_resnet=create_resnet(IMG_DIM,CHANNEL_SIZE, NUM_CLASSES)