Nik
Nik

Reputation: 185

Tensorflow models/slim eval_image_classifier.py Number of images evaluated wrong

I followed the tutorial to finetune the inception model for the Flowers dataset.

The flowers dataset has 350 validation images specified in the flowers.py file.

But when I ran eval_image_classifier.py and modified it to print the number of TP,FP,TN,FN

The results:

I tensorflow/core/kernels/logging_ops.cc:79] eval/TrueNegatives[64]
I tensorflow/core/kernels/logging_ops.cc:79] eval/TruePositives[286]
I tensorflow/core/kernels/logging_ops.cc:79] eval/FalsePositives[2]
I tensorflow/core/kernels/logging_ops.cc:79] eval/FalseNegatives[48]

If you add the them up, its a total of 400. But the number of validation images is 350.

I did fine tuning for my custom dataset, where the validation images were 150 with only two classes.

The results were:

I tensorflow/core/kernels/logging_ops.cc:79] eval/TruePositives[11]
I tensorflow/core/kernels/logging_ops.cc:79] eval/TrueNegatives[155]
I tensorflow/core/kernels/logging_ops.cc:79] eval/FalsePositives[4]
I tensorflow/core/kernels/logging_ops.cc:79] eval/FalseNegatives[30]
I tensorflow/core/kernels/logging_ops.cc:79] eval/Accuracy[0.83]
I tensorflow/core/kernels/logging_ops.cc:79] eval/AreaUnderCurve[0.62156773]

If you add them up its comes out to be 200.

Why is this happening? Where are the additional 50 images coming from?

Is there a way to modify eval_image_classifier.py to print the name of the validation images with its predictions and labels?

I have also asked this question as an issue on the models/slim github but I have not received any response.

Upvotes: 0

Views: 284

Answers (1)

Ishant Mrinal
Ishant Mrinal

Reputation: 4918

The reason of the number of image mismatches is the input queue the program is using. It feeds values with batches. You need to set the batch_size and num_batches as per your dataset size to solve this problem. num_batches.

default value is upper rounded deafult num_batches

Upvotes: 1

Related Questions