Training your custom classifier in Tensorflow Inception image recognition
Just some months ago, Google released code for classifying images using neural networks. Some time later, they also released code to train your custom models, either from scratch or improving a baseline model. The baseline model in that case usually is a model trained on the ImageNet dataset.
To my understanding, there are currently two different ways to train a custom model:
tensorflow/modelsrepository contains several examples training models from scratch or improving models. The retraining in this case seems to include retraining on the full network, which is quite slow on my machine.
tensorflow/tensorflowproject contains an example file on retraining just the final layer of a model, but keeping all the rest from the baseline.
Due to the long runtime of the first approach on my computer (I did not want to apply for the cuDNN program), I decided for the second approach. The commentary section of that file already shows almost anything you have to do. Basically, you just have to compile it and then run it.
The command line arguments are
also given within the file as
tf.app.flags.DEFINE_*. To pass them as
argument, just preceed them with a double dash
This will then create a graph in your
/tmp directory. Of course, you can
also adjust the output path using the command line arguments
To classify another image with the new network you may use the
label_image example. To compile it use:
You can then classify a new image with the following command:
Of course, replace
image.jpg with the real path to your image.