I'm new to Deep Learning, and I have some conceptual problems. I followed a simple tutorial here, and trained a model in Keras to do image classification on 10 classes of logos. I prepared 10 classes with each class having almost 100 images. My trained
Resnet50 model performs exceptionally great when the image is one of those 10 logos, with 1.00 probability. But the problem is if I pass a non-logo item, a random image totally unrelated visually, still it marks it as one of those logos with close to 1.00 probability!
I'm confused. Am I missing anything? Why is this happening? How to find a solution? I need to find logos in video frames. But right now, with a high possbility each frame is marked as a logo!
Here is my simple training code:
def build_finetune_model(base_model, dropout, fc_layers, num_classes): for layer in base_model.layers: layer.trainable = False x = base_model.output x = Flatten()(x) for fc in fc_layers: # New FC layer, random init x = Dense(fc, activation='relu')(x) x = Dropout(dropout)(x) # New softmax layer predictions = Dense(num_classes, activation='softmax')(x) finetune_model = Model(inputs=base_model.input, outputs=predictions) return finetune_model finetune_model = build_finetune_model(base_model, dropout=dropout, fc_layers=FC_LAYERS, num_classes=len(class_list)) adam = Adam(lr=0.00001) finetune_model.compile(adam, loss='categorical_crossentropy', metrics=['accuracy']) filepath="./checkpoints/" + "ResNet50" + "_model_weights.h5" checkpoint = ModelCheckpoint(filepath, monitor=["acc"], verbose=1, mode='max') callbacks_list = [checkpoint] history = finetune_model.fit_generator(train_generator, epochs=NUM_EPOCHS, workers=8, steps_per_epoch=steps_per_epoch, shuffle=True, callbacks=callbacks_list) plot_training(history)