1

I want to find the probabilities for my model in order to find AUC and ROC later but got this error:

ValueError: Error when checking input: expected input_1 to have 4 dimensions, but got array with shape (83, 1)

My code:

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)
Tomerikoo
  • 18,379
  • 16
  • 47
  • 61
  • At which line are you getting the error? – thushv89 Aug 04 '19 at 21:39
  • Full error log would be helpful – oo00oo00oo00 Aug 04 '19 at 22:15
  • Possible duplicate of [Error when checking model input: expected convolution2d\_input\_1 to have 4 dimensions, but got array with shape (32, 32, 3)](https://stackoverflow.com/questions/41563720/error-when-checking-model-input-expected-convolution2d-input-1-to-have-4-dimens) – R4444 Aug 04 '19 at 23:08

0 Answers0