使用keras模型作为图像分类器时找出未分类图像

时间:2019-04-21 09:03:02

标签: python keras deep-learning

我在数据集中建立了一个用于图像分类的keras模型,但是当对图像进行模型分类时,我发现大约200张图像未分类,那么任何人都可以帮助我如何找出那些未分类的图像。这是我的模特

    img_width= img_rows
    img_height = img_cols
    classes_num = 5
    epochs = 10

    model =Sequential()

    model.add(Conv2D(32,(3,3), input_shape=(img_width, img_height, 3)))
    model.add(Activation('relu'))
    model.add(MaxPooling2D(pool_size=(2,2)))

    model.add(Conv2D(32,(3,3), input_shape=(img_width, img_height, 3)))
    model.add(Activation('relu'))
    model.add(MaxPooling2D(pool_size=(2,2)))

    model.add(Conv2D(64,(3,3), input_shape=(img_width, img_height, 3)))
    model.add(Activation('relu'))
    model.add(MaxPooling2D(pool_size=(2,2)))

    model.add(Flatten())
    model.add(Dense(256))
    model.add(Activation('relu'))
    model.add(Dropout(0.1))
    model.add(Dense(classes_num ))
    model.add(Activation('sigmoid'))

    model.compile(optimizer='adam', loss='binary_crossentropy',
                            metrics=['accuracy',mean_pred,recall,precision, fmeasure,
                                     matthews_correlation,kullback_leibler_divergence,
                                     binary_crossentropy])
    model.save('model.h5')
    model.summary()
    print('model complied!!')

    print('starting training....')
    history = model.fit(X_train, Y_train, epochs=epochs, batch_size=64,validation_data=(X_test, Y_test))

'''

0 个答案:

没有答案