Keras allows 'easy and fast' use of models: example.
Inception-v3 is a trained image recognition model for tensorflow with 93.9% Top-5 Accuracy.
It was trained on 1.2 million images from ImageNet to detect 1000 classes (or labels for the images).
It took 8 NVIDIA Tesla K40s, 2 weeks to train.
This example was built and tested on c9.io or cs50.io as they provide a free Ubuntu VM (docker container) with 512MB RAM and 2GB Disk.
sudo pip install -U pip
sudo pip install tensorflow
sudo pip install h5py pillow
sudo pip install -U pip
update pip with tensorflow
... h5py
to load weights
... pillow
to load image
as from tensorflow.python.keras ... import
is used, as keras
is not installed separately
keras
path correct as of tensorflow 1.4.1
python predict.py
Line 7: Loads image 'image.jpg'
then runs inference on InceptionV3
.
Line 14: Outputs top 5 predictions and probabilities.
To disable "cpu_feature_guard"
:
export TF_CPP_MIN_LOG_LEVEL=2
Improve Performance:
TensorFlow binary compiled to use: SSE4.1 SSE4.2 AVX