Problem in storing output in image classification challenge

classification
image_classification
#1

I have trained my base model for Intel Scene Classification Challenge and it is showing 0.82 on the validation set. But when I am submitting the output to solution checker, it is only giving me 0.15-0.16. I am using ImageDataGenerator class in keras, and I doubt the problem is caused by it when using it for prediction of test set. Can anybody help me with it.
Here is the code I am using:

test = pd.read_csv(“sample_submission_CH2mq5Z.csv”)
test_datagen=ImageDataGenerator(rescale=1./255.)
test_generator=test_datagen.flow_from_dataframe(dataframe=test,
directory="./train/",
x_col=“image_name”,
y_col=None,
target_size=(IMG_SIZE, IMG_SIZE),
seed=42,
shuffle=False,
batch_size=1,
class_mode=None)
test_generator.reset()
predictions=model.predict_generator(test_generator,verbose=1)
filenames=test_generator.filenames
results=pd.DataFrame({“image_name”:filenames,
“label”:predictions})
results.to_csv(“results.csv”,index=False)

0 Likes

#2

Hey Im getting the exact same issue and cant find a solution online. When I evaluate on my validation set I’m getting 82% accuracy. when i evaluate on my test set I get 92%, which seems a bit high. anyway when i try to predict on the test set, the results are just about 50% accuracy, i presume the ordering of the predicted results are out of sync with the test set. Have you come up with a solution since you posted this? it would be great if you did

0 Likes