Judge Yosakoi Naruko by image classification of Tensorflow.

Note

I tried to classify by tensorflow, so I will leave a note. When classifying images in the environment of a fairly old PC (Ubuntu is installed on a PC about 10 years ago) It seems that it will not work according to the CPU specifications unless the tensor flow version is set to 1.5.

Rough explanation of file processing contents

  1. Create a learning model by classifying with a file called retrain.py. This time, I learned the image of Naruko and the image of a cat. (The images of cats and Naruko are put in folders)

  2. Judge the test image by referring to the training model in a file called label_image.py. This time, I prepared Naruko for the test image and judged it.

In addition, the location such as hierarchy is passed as a parameter to each file.

2020-09-04_15-55-37.png

pip install tensorflow==1.5
pip install tensorflow_hub==0.2.0
python retrain.py \
  --bottleneck_dir=bottlenecks \
  --how_many_training_steps=1000 \
  --model_dir=inception \
  --summaries_dir=training_summaries/basic \
  --output_graph=retrained_graph.pb \
  --output_labels=retrained_labels.txt \
  --image_dir=img
python label_image.py  \
  --graph=retrained_graph.pb  \
  --labels=retrained_labels.txt  \
  --output_layer=final_result  \
  --image=test_images/x.jpg  \
  --input_layer=Mul

Download the source from below https://github.com/tensorflow/tensorflow/tree/r1.5/tensorflow

wget https://raw.githubusercontent.com/tensorflow/tensorflow/r1.5/tensorflow/examples/label_image/label_image.py
wget https://raw.githubusercontent.com/tensorflow/tensorflow/r1.5/tensorflow/examples/image_retraining/retrain.py

Recommended Posts

Judge Yosakoi Naruko by image classification of Tensorflow.
Super (concise) summary of image classification by ArcFace
[PyTorch] Image classification of CIFAR-10
Easy image classification with TensorFlow
Challenge image classification by TensorFlow2 + Keras 1-Move for the time being-
Deep learning learned by implementation 2 (image classification)
Challenge image classification by TensorFlow2 + Keras 5 ~ Observe images that fail to classify ~
Grayscale by matrix-Reinventor of Python image processing-
Analysis of X-ray microtomography image by Python
[Image classification] Facial expression analysis of dogs
"Trash classification by image!" App creation diary day6 ~ Correction of directory structure ~
Classification of guitar images by machine learning Part 1
Extract dominant color of image by k-means clustering
Classification of guitar images by machine learning Part 2
Challenge image classification with TensorFlow2 + Keras 6-Try preprocessing and classifying images prepared by yourself-
Image of closure
Image processing by matrix Basics & Table of Contents-Reinventor of Python image processing-
Get the image of "Suzu Hirose" by Google image search.
MNIST image generation program creation by DCGAN (tensorflow tutorial)
Challenge image classification with TensorFlow2 + Keras 3 ~ Visualize MNIST data ~
Challenge image classification by TensorFlow2 + Keras 2 ~ Let's take a closer look at the input data ~