machine environment
Install dependencies
- pip install tensorflow==1.7.0
- pip install tensorflow-hub
Github address
Prepare picture material
- Note: Each category must have at least 100 pictures, otherwise an error will be reported
- Put the pictures into categories and put them in the photos folder
Train the model (default is to use Inception V3)
- Clear the output folder first
- 20 steps of training here
python .\retrain.py --image_dir .\photos\ --saved_model_dir .\mod
el\ --bottleneck_dir .\bottleneck\ --how_many_training_steps 20 --output_labels .\output\output_labels.txt --output_grap
h .\output\retrain.pb
Test the model (test a single image)
python .\label_image.py --graph .\output\retrain.pb --labels .\o
utput\output_labels.txt --input_layer=Placeholder --output_layer=final_result --image .\test.jpg
Remark