Comments (13)
The commented line #saver.restore(sess, ckpt.model_checkpoint_path) is responsible for loading the saved model . Without it , the script does not load anything and tests a model that was not trained, so the result is 0% accuracy.
from fruit-images-dataset.
Okay, i have commented out saver.restore(sess, ckpt.model_checkpoint_path)
from the fruit_test_net.py
test script. I am getting following error, may i know how to resolve this.
File "network/fruit_test_net.py", line 82, in <module>
saver.restore(sess, ckpt.model_checkpoint_path)
AttributeError: 'NoneType' object has no attribute 'model_checkpoint_path'
from fruit-images-dataset.
It seems that the ckpt object is not properly initialized by the
ckpt = tf.train.get_checkpoint_state(checkpoint_dir) line
Did you ensure that the files resulted from the fruit_train_net.py script are all in the folder pointed by the "checkpoint_dir" variable?
from fruit-images-dataset.
Yes i can see in the fruit_models folder which is created during training. The following 5 files available
/fruit_models/checkpoint (381 bytes)
/fruit_models/graph.pbtxt (284.3 kb)
/fruit_models/model.ckpt.data-00000-of-00001 (83.7 MB)
/fruit_models/model.ckpt.index (1.5 kb)
/fruit_models/model.ckpt.meta (145.2 kb)
Even i tried by doing fresh training:
time: 21.5204 step: 1 loss: 4.0560 accuracy: 0.0600
time: 117.3164 step: 500 loss: 0.1250 accuracy: 0.9700
time: 118.0530 step: 1000 loss: 0.0824 accuracy: 0.9700
time: 118.3158 step: 1500 loss: 0.0165 accuracy: 1.0000
time: 119.6045 step: 2000 loss: 0.0233 accuracy: 0.9900
time: 119.7569 step: 2500 loss: 0.0021 accuracy: 1.0000
time: 116.7455 step: 3000 loss: 0.0091 accuracy: 1.0000
time: 111.8938 step: 3500 loss: 0.0205 accuracy: 1.0000
time: 110.3421 step: 4000 loss: 0.0279 accuracy: 0.9800
time: 108.9707 step: 4500 loss: 0.0203 accuracy: 0.9900
time: 109.2560 step: 5000 loss: 0.0210 accuracy: 0.9800
time: 106.7813 step: 5500 loss: 0.0011 accuracy: 1.0000
time: 105.4543 step: 6000 loss: 0.0025 accuracy: 1.0000
time: 108.1577 step: 6500 loss: 0.0763 accuracy: 0.9600
time: 109.1269 step: 7000 loss: 0.0107 accuracy: 0.9900
time: 108.0914 step: 7500 loss: 0.0218 accuracy: 0.9800
time: 114.1078 step: 8000 loss: 0.0116 accuracy: 1.0000
time: 119.6590 step: 8500 loss: 0.0094 accuracy: 1.0000
time: 119.5516 step: 9000 loss: 0.0110 accuracy: 1.0000
time: 117.5011 step: 9500 loss: 0.0110 accuracy: 0.9900
time: 113.2210 step: 10000 loss: 0.0008 accuracy: 1.0000
time: 106.1483 step: 10500 loss: 0.0062 accuracy: 1.0000
time: 106.7721 step: 11000 loss: 0.0160 accuracy: 0.9800
time: 107.3277 step: 11500 loss: 0.0050 accuracy: 1.0000
time: 107.9952 step: 12000 loss: 0.0005 accuracy: 1.0000
time: 117.4758 step: 12500 loss: 0.0023 accuracy: 1.0000
But still same problem during testing
from fruit-images-dataset.
What is the value of the "checkpoint_dir" variable when it executes
ckpt = tf.train.get_checkpoint_state(checkpoint_dir) ?
Is it the same as the path to the folder with those 5 files?
from fruit-images-dataset.
Yes its has same.
from fruit-images-dataset.
I have resolved that issues but accuracy is coming always 0
Predicted 86 out of 100; partial accuracy 0.0000
Predicted 181 out of 200; partial accuracy 0.0000
Predicted 277 out of 300; partial accuracy 0.0000
Predicted 367 out of 400; partial accuracy 0.0000
Predicted 465 out of 500; partial accuracy 0.0000
Predicted 560 out of 600; partial accuracy 0.0000
Predicted 648 out of 700; partial accuracy 0.0000
from fruit-images-dataset.
From the prints it looks like it counts the number of correctly classified images as well as the total number of images.
I think the issue is caused by python rounding down the result. Please try changing in the print the "correct / (total_test_images - images_left_to_process)" into
"float(correct / (total_test_images - images_left_to_process))"
from fruit-images-dataset.
I guess you are right but still showing same accuracy 0.0000. No luck
Predicted 11437 out of 12300; partial accuracy 0.0000
Predicted 11531 out of 12400; partial accuracy 0.0000
Predicted 11618 out of 12500; partial accuracy 0.0000
0
from fruit-images-dataset.
I think I was mistaken. Please try
float(correct) / float(total_test_images - images_left_to_process)
to let python know that you want a division between 2 floats, and the result is expected to be a float.
What version of python are you using, because I cannot replicate this issue with my version?
I use Python 3.6.6.
from fruit-images-dataset.
Great now its working absolutely fine. just one more doubt while detecting fruits from detect_fruits.py
i am getting error as per below:
FailedPreconditionError (see above for traceback): .../Fruit-Images-Dataset/test-multiple_fruits; Is a directory
[[Node: ReaderReadV2_1 = ReaderReadV2[_device="/job:localhost/replica:0/task:0/device:CPU:0"](WholeFileReaderV2, input_producer_1)]]
[[Node: DecodeJpeg_1/_93 = _Recv[client_terminated=false, recv_device="/job:localhost/replica:0/task:0/device:GPU:0", send_device="/job:localhost/replica:0/task:0/device:CPU:0", send_device_incarnation=1, tensor_name="edge_5_DecodeJpeg_1", tensor_type=DT_UINT8, _device="/job:localhost/replica:0/task:0/device:GPU:0"]()]]
I am running as per:
.../Fruit-Images-Dataset/src/image_classification$python fruit_detection/detect_fruits.py --image_path=/home/sanjay.saini/Deeplearning/DeepTensorFlow/My_TensorFlow_tutorials/Fruits_Classification/Fruit-Images-Dataset/test-multiple_fruits
Any idea whats wrong?
from fruit-images-dataset.
For this script you need to provide the path to a jpg file, not the folder.
Something like
.../Fruit-Images-Dataset/src/image_classification$python fruit_detection/detect_fruits.py --image_path=/home/sanjay.saini/Deeplearning/DeepTensorFlow/My_TensorFlow_tutorials/Fruits_Classification/Fruit-Images-Dataset/test-multiple_fruits/apple.jpg
from fruit-images-dataset.
Thanks a lot.
from fruit-images-dataset.
Related Issues (20)
- Bouding box on predicted fruit HOT 1
- training file
- same problem in run HOT 10
- problem in test HOT 2
- (unicode error) 'unicodeescape' codec can't decode bytes in position 2-3: truncated \UXXXXXXXX escape HOT 1
- Problems to run freeze_graph HOT 16
- Checkpoint error when freezing HOT 1
- Infrared images HOT 1
- Bad image HOT 1
- MacOS clone and run, this error occurs: OSError: Unable to open file (unable to open file: name = 'output_files/fruit-360 model/model.h5', HOT 2
- how to feed network with custom image? HOT 2
- [QUESTION] How to use the trained model in tensorflow? HOT 7
- how we can test or predict any image? HOT 3
- how to get the label HOT 1
- Training issue HOT 6
- extract_images documentation HOT 7
- Is it bug ???? HOT 9
- How to use folder test-multiple_fruits for code ? HOT 11
- Filename typo HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from fruit-images-dataset.