MobileNet训练分类网
1.环境准备
安装tensorflow:
pip install tensorflow验证安装成功:
python import tensorflow as tf tf.__version__把
tensorflow/examples/git clone下来
2.数据集文件结构
数据
../example/image_retraining/ : --dataset --class1 --image1.jpg --image2.jpg ... --class2 --image1.jpg ... ...标签
../label.txt : class1 class2 ...
3.训练脚本
../example/image_retraining/retrain.py 的主函数中有各项训练参数的设置,训练命令例如:
python retrain.py \ --image_dir /home/wz/TensorFlow/tensorflow/tensorflow/examples/image_retraining/dataset \ --intermediate_store_frequency 1000 \ --how_many_training_steps 50000 \ --learning_rate 0.001 \ --train_batch_size 8 \ --testing_percentage 0 \ --eval_step_interval 20 \ --architecture mobilenet_1.0_224 \ --output_graph /home/wz/TensorFlow/tensorflow/tensorflow/examples/image_retraining/tmp/output_graph.pb \ -

本文介绍了如何利用TensorFlow训练MobileNet模型进行图像分类。首先,你需要安装TensorFlow并验证安装。接着,理解数据集的文件结构。然后,使用`retrain.py`脚本设置训练参数并开始训练,可以选择不同版本的MobileNet和调整网络复杂度。最后,使用`label_image.py`或`detect.py`进行图像检测,确保脚本参数与训练时的Mobilenet版本一致,并进行图像像素值的归一化处理。
最低0.47元/天 解锁文章

被折叠的 条评论
为什么被折叠?



