0
$\begingroup$
def Model_Resnet(train_data,  sol):

    IMG_SIZE = [224, 224, 3]

    train_data = np.array(train_data)

    Feat1 = np.zeros((train_data.shape[0], IMG_SIZE[0], IMG_SIZE[1] * IMG_SIZE[2]))

    for i in range(train_data.shape[0]):
        Feat1[i, :] = cv.resize(train_data[i], (IMG_SIZE[1] * IMG_SIZE[2],IMG_SIZE[0]))

    train_data = Feat1.reshape(Feat1.shape[0], IMG_SIZE[0], IMG_SIZE[1], IMG_SIZE[2])

    base_model = Sequential()
    base_model.add(ResNet50(include_top=False, weights='imagenet', pooling='max'))
    base_model.add(Dense(units=int(sol[0]), activation='sigmoid'))
    base_model.compile(loss='binary_crossentropy',epoches = sol[1],  metrics=['acc'])
    try:
        base_model.fit(train_data)
        pred = np.round(base_model.predict(train_data)).astype('int')
    except:
         pred = np.round(base_model.predict(train_data)).astype('int')
    return pred.astype('int')
$\endgroup$
1
  • $\begingroup$ Hello @gvijayakiran, welcome to the site. Please, provide information about what line the problem happens, and the full backtrace, so that the community can understand the cause of the problem. $\endgroup$
    – noe
    Oct 23, 2023 at 8:33

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.