使用TF-Hub进行迁移学习(图像分类)
机器环境
安装依赖
pip install tensorflow
pip install tensorflow-hubGithub地址
准备分类图片素材
训练模型(默认用Inception V3)
使用模型
备注
Last updated
pip install tensorflow
pip install tensorflow-hubLast updated
python .\retrain.py --image_dir .\photos\ --saved_model_dir .\model\ --bottleneck_dir .\bottleneck\ --how_many_training_steps 20 --output_labels .\output\output_labels.txt --output_graph .\output\retrain.pb python .\label_image.py --graph .\output\retrain.pb --labels .\output\output_labels.txt --input_layer=Placeholder --output_layer=final_result --image .\test.jpg# 在训练模型时加上:
–tfhub_module https://tfhub.dev/google/imagenet/mobilenet_v2_100_224/feature_vector/1