Loading repository data…
Loading repository data…
jubins / repository
Food image prediction using TensorFlow and calorie estimation using K-Nearest-Neighbors algoritm
A transparent discovery signal based on current public GitHub metadata.
This score does not audit code, security, maintainers, documentation quality, or suitability. Verify the repository and its current documentation before adoption.
Python 3.6
TensorFlow 1.13
OpnCV 3.4
Numpy 1.12
Pandas 0.22
Docker (latest should work)
Requests 2.1
Install Docker
docker run hello-world
docker run -it gcr.io/tensorflow/tensorflow:latest-devel
Check Tensorflow:
python import tensorflow
Retrieve Images: $ ctrl-D if you're still in Docker and then: $ cd $HOME $ mkdir tf_files $ cd tf_files $ curl -O https://goo.gl/NohU7G $ gzip -d food_datasets.tar.gz $ tar xzf DataSets.tar $ cd $HOME/tf_files/DataSets/food_photos
Link image dataset virtually to tensorflow: $docker run -it -v /DataSets/food_photos:/tf_files/ImageDataSets/food_photos gcr.io/tensorflow/tensorflow:latest-devel $ ls /tf_files/DataSets food_photos
Retrieving the Training code: $ cd /tensorflow $ git pull
Training the Inception model:
$ python tensorflow/examples/image_retraining/retrain.py
-- bottleneck_dir=/tf_files/ImageDataSets/bottlenecks
-- how_many_training_steps 500
-- model_dir=/tf_files/ImageDataSets/inception
-- output_graph=/tf_files/ImageDataSets/retrained_graph.pb
-- output_labels=/tf_files/ImageDataSets/retrained_labels.txt
-- image_dir /tf_files/DataSets/food_photos
The retraining script will write out a version of the Inception v3 network with a final layer retrained to your categories to /tmp/output_graph.pb and a text file containing the labels to /tmp/output_labels.txt.
Using trained model to predict new images: $ ctrl-D to exit Docker and then: $ curl -L goo.gl/NyNBG5 > $HOME/tf_files/ImageDataSets/label_image.py $ docker run -it -v /DataSets/test_photos:/tf_files/ImageDataSets/test_photos gcr.io/tensorflow/tensorflow:latest-devel
Predicting new images: $ python /tf_files/ImageDataSets/label_image.py /ImageDataSets/test_photos/Pizza/pizza1.jpg $ python /tf_files/label_image.py /ImageDataSets/test_photos/VegBurger/notburger_cake1.jpg
Please contact anyone of us if you face any difficulty in executing the code.