ardamavi/Dog-Cat-Classifier

Any JPG returns "It is a dog !"

Closed this issue · 14 comments

In passing test_dog.jpg or test_cat.jpg, both return "Its a dog!". Maybe a problem on my end? Im running train.py first and then predict.py

thanks

Can you share training outputs?

This is the output I'm getting.

(Sandbox) C:\WatsonWorkspace\Dog-Cat-Classifier-master>python train.py
Using TensorFlow backend.
WARNING:tensorflow:From C:\ProgramData\Anaconda3\envs\Sandbox\lib\site-packages\tensorflow\python\framework\op_def_library.py:263: colocate_with (from tensorflow.python.framework.ops) is deprecated and will be removed in a future version.
Instructions for updating:
Colocations handled automatically by placer.
WARNING:tensorflow:From C:\ProgramData\Anaconda3\envs\Sandbox\lib\site-packages\keras\backend\tensorflow_backend.py:3445: calling dropout (from tensorflow.python.ops.nn_ops) with keep_prob is deprecated and will be removed in a future version.
Instructions for updating:
Please use rate instead of keep_prob. Rate should be set to rate = 1 - keep_prob.
WARNING:tensorflow:From C:\ProgramData\Anaconda3\envs\Sandbox\lib\site-packages\tensorflow\python\ops\math_ops.py:3066: to_int32 (from tensorflow.python.ops.math_ops) is deprecated and will be removed in a future version.
Instructions for updating:
Use tf.cast instead.
2019-07-23 07:05:46.717814: I tensorflow/core/platform/cpu_feature_guard.cc:141] Your CPU supports instructions that this TensorFlow binary was not compiled to use: AVX AVX2
2019-07-23 07:05:46.726499: I tensorflow/core/common_runtime/process_util.cc:71] Creating new thread pool with default inter op setting: 8. Tune using inter_op_parallelism_threads for best performance.
Epoch 1/25
157/157 [==============================] - 5s 31ms/step - loss: 0.7005 - acc: 0.4936 - val_loss: 0.6928 - val_acc: 0.5143
Epoch 2/25
157/157 [==============================] - 4s 27ms/step - loss: 0.6993 - acc: 0.5082 - val_loss: 0.6931 - val_acc: 0.4571
Epoch 3/25
157/157 [==============================] - 4s 25ms/step - loss: 0.6910 - acc: 0.5478 - val_loss: 0.6816 - val_acc: 0.6143
Epoch 4/25
157/157 [==============================] - 4s 27ms/step - loss: 0.6846 - acc: 0.5690 - val_loss: 0.6977 - val_acc: 0.4929
Epoch 5/25
157/157 [==============================] - 4s 25ms/step - loss: 0.6568 - acc: 0.6277 - val_loss: 0.6237 - val_acc: 0.6071
Epoch 6/25
157/157 [==============================] - 4s 24ms/step - loss: 0.6655 - acc: 0.6064 - val_loss: 0.6444 - val_acc: 0.6000
Epoch 7/25
157/157 [==============================] - 4s 23ms/step - loss: 0.6530 - acc: 0.6473 - val_loss: 0.6379 - val_acc: 0.5714
Epoch 8/25
157/157 [==============================] - 3s 22ms/step - loss: 0.6123 - acc: 0.6608 - val_loss: 0.5783 - val_acc: 0.7071
Epoch 9/25
157/157 [==============================] - 3s 20ms/step - loss: 0.6155 - acc: 0.6646 - val_loss: 0.7093 - val_acc: 0.5286
Epoch 10/25
157/157 [==============================] - 3s 21ms/step - loss: 0.6033 - acc: 0.6738 - val_loss: 0.5198 - val_acc: 0.7429
Epoch 11/25
157/157 [==============================] - 3s 19ms/step - loss: 0.5811 - acc: 0.7017 - val_loss: 0.5091 - val_acc: 0.8000
Epoch 12/25
157/157 [==============================] - 4s 24ms/step - loss: 0.5637 - acc: 0.7033 - val_loss: 0.5144 - val_acc: 0.7500
Epoch 13/25
157/157 [==============================] - 3s 20ms/step - loss: 0.5667 - acc: 0.6921 - val_loss: 0.5312 - val_acc: 0.7143
Epoch 14/25
157/157 [==============================] - 3s 19ms/step - loss: 0.5703 - acc: 0.7025 - val_loss: 0.5330 - val_acc: 0.7357
Epoch 15/25
157/157 [==============================] - 4s 24ms/step - loss: 0.5250 - acc: 0.7418 - val_loss: 0.4624 - val_acc: 0.7643
Epoch 16/25
157/157 [==============================] - 3s 21ms/step - loss: 0.5406 - acc: 0.7322 - val_loss: 0.4992 - val_acc: 0.7643
Epoch 17/25
157/157 [==============================] - 3s 20ms/step - loss: 0.5238 - acc: 0.7264 - val_loss: 0.5255 - val_acc: 0.7643
Epoch 18/25
157/157 [==============================] - 3s 19ms/step - loss: 0.5182 - acc: 0.7338 - val_loss: 0.4222 - val_acc: 0.7857
Epoch 19/25
157/157 [==============================] - 3s 20ms/step - loss: 0.5308 - acc: 0.7290 - val_loss: 0.4632 - val_acc: 0.7857
Epoch 20/25
157/157 [==============================] - 3s 18ms/step - loss: 0.4965 - acc: 0.7460 - val_loss: 0.4493 - val_acc: 0.7929
Epoch 21/25
157/157 [==============================] - 3s 19ms/step - loss: 0.5071 - acc: 0.7479 - val_loss: 0.4314 - val_acc: 0.8214
Epoch 22/25
157/157 [==============================] - 4s 23ms/step - loss: 0.4826 - acc: 0.7763 - val_loss: 0.4818 - val_acc: 0.8000
Epoch 23/25
157/157 [==============================] - 3s 21ms/step - loss: 0.4858 - acc: 0.7556 - val_loss: 0.4664 - val_acc: 0.7929
Epoch 24/25
157/157 [==============================] - 3s 17ms/step - loss: 0.4902 - acc: 0.7548 - val_loss: 0.4056 - val_acc: 0.8214
Epoch 25/25
157/157 [==============================] - 3s 19ms/step - loss: 0.4848 - acc: 0.7641 - val_loss: 0.4354 - val_acc: 0.8357
Model and weights saved

(Sandbox) C:\WatsonWorkspace\Dog-Cat-Classifier-master>python predict.py test_cat.jpg
Using TensorFlow backend.
image= test_cat.jpg
WARNING:tensorflow:From C:\ProgramData\Anaconda3\envs\Sandbox\lib\site-packages\tensorflow\python\framework\op_def_library.py:263: colocate_with (from tensorflow.python.framework.ops) is deprecated and will be removed in a future version.
Instructions for updating:
Colocations handled automatically by placer.
WARNING:tensorflow:From C:\ProgramData\Anaconda3\envs\Sandbox\lib\site-packages\keras\backend\tensorflow_backend.py:3445: calling dropout (from tensorflow.python.ops.nn_ops) with keep_prob is deprecated and will be removed in a future version.
Instructions for updating:
Please use rate instead of keep_prob. Rate should be set to rate = 1 - keep_prob.
2019-07-23 07:13:41.817051: I tensorflow/core/platform/cpu_feature_guard.cc:141] Your CPU supports instructions that this TensorFlow binary was not compiled to use: AVX AVX2
2019-07-23 07:13:41.827181: I tensorflow/core/common_runtime/process_util.cc:71] Creating new thread pool with default inter op setting: 8. Tune using inter_op_parallelism_threads for best performance.
It is a dog !

(Sandbox) C:\WatsonWorkspace\Dog-Cat-Classifier-master>python predict.py test_dog.jpg
Using TensorFlow backend.
image= test_dog.jpg
WARNING:tensorflow:From C:\ProgramData\Anaconda3\envs\Sandbox\lib\site-packages\tensorflow\python\framework\op_def_library.py:263: colocate_with (from tensorflow.python.framework.ops) is deprecated and will be removed in a future version.
Instructions for updating:
Colocations handled automatically by placer.
WARNING:tensorflow:From C:\ProgramData\Anaconda3\envs\Sandbox\lib\site-packages\keras\backend\tensorflow_backend.py:3445: calling dropout (from tensorflow.python.ops.nn_ops) with keep_prob is deprecated and will be removed in a future version.
Instructions for updating:
Please use rate instead of keep_prob. Rate should be set to rate = 1 - keep_prob.
2019-07-23 07:13:54.682680: I tensorflow/core/platform/cpu_feature_guard.cc:141] Your CPU supports instructions that this TensorFlow binary was not compiled to use: AVX AVX2
2019-07-23 07:13:54.692240: I tensorflow/core/common_runtime/process_util.cc:71] Creating new thread pool with default inter op setting: 8. Tune using inter_op_parallelism_threads for best performance.
It is a dog !

(Sandbox) C:\WatsonWorkspace\Dog-Cat-Classifier-master>

You have got 83% val acc in last epoch. That is not bad.
You can try again with other cat photos from Google Images.
I will be so happy, If you share your next experiences with us.

Maybe I'm misunderstanding. So the model is 83% accurate, it just so happens the pictures I'm supplying are predicting dogs?

I supplied these cats at http://expertofdreams.com/data_images/cat/
they predict dogs. Does your system correctly predict them?

Thanks in advance,

Can you share more information? I don't know what is the problem now but we can fix it together.

After training the model, any picture of a cat (python predict.py cat.jpg) returns "It is a dog !". I have tried numerous pictures without success. I'm not sure if the predictions are wrong by coincidence or if I have some other problem.

Thanks in advance.

What is the output possibilities of classes?

I am also having this problem

@michaelyan-coupa Can you give me detailed information about the problem so that I can find a solution?

Basically the loss and val loss are both very low (so very good) however when test.py is run, it only returns cat.

@kggraham just gets "Dog" results.
@michaelyan-coupa Can you help me for debugging your problem ?

Sure. I am unsure where the root of the problem is. When I try to train on a different set, it works a little better.

Would you like to share your experiences with us? @michaelyan-coupa

@michaelyan-coupa I have the same problem,
Every outputs show "It is a dog" after running train.py
Would you find the method to solve it?