tensorflow 目标检测训练及评估
2018-03-01 10:24
429 查看
0.硬件,一块1080Ti及以上显卡的机器,不建议用CPU训练。
1.安装gpu版tensorflow,并搭建训练环境
sudo pip install tensorflow-gpu
sudo pip install pillow
sudo pip install lxml
sudo pip install jupyter
sudo pip install matplotlib
git clone https://github.com/tensorflow/models 将目录切换至tensorflow/models/research/
protoc object_detection/protos/*.proto --python_out=.
export PYTHONPATH=$PYTHONPATH:`pwd`:`pwd`/slim
测试安装是否成功
python object_detection/builders/model_builder_test.py
确保返回OK
2.准备训练数据
切换目录至tensorflow/models/research/
wget http://www.robots.ox.ac.uk/~vgg/data/pets/data/images.tar.gz wget http://www.robots.ox.ac.uk/~vgg/data/pets/data/annotations.tar.gz tar -xvf annotations.tar.gz
tar -xvf images.tar.gz
python object_detection/dataset_tools/create_pet_tf_record.py \
--label_map_path=object_detection/data/pet_label_map.pbtxt \
--data_dir=`pwd` \
--output_dir=`pwd`
3.将数据转换为tfrecords
python object_detection/dataset_tools/create_pet_tf_record.py \
--label_map_path=object_detection/data/pet_label_map.pbtxt \
--data_dir=`pwd` \
--output_dir=`pwd`
4.训练模型,参考链接https://github.com/tensorflow/models/blob/master/research/object_detection/g3doc/running_locally.md
cp object_detection/samples/configs/ssd_mobilenet_v1_pets.config ssd_mobilenet_v1_pets.config
修改ssd_mobilenet_v1_pets.config中PATH_TO_BE_CONFIGURED的值为本机的路径
下载预训练的模型,参考链接https://github.com/tensorflow/models/blob/master/research/object_detection/g3doc/detection_model_zoo.md
wget http://download.tensorflow.org/models/object_detection/ssd_mobilenet_v1_coco_2017_11_17.tar.gz 解压到当前目录:tar -zvxf ssd_mobilenet_v1_coco_2017_11_17.tar.gz
python object_detection/train.py \
--logtostderr \
--pipeline_config_path=ssd_mobilenet_v1_pets.config \
--train_dir=voc/train_logs \
2>&1 | tee voc/train_logs.txt
5.评估模型
python object_detection/eval.py \
--logtostderr \
--pipeline_config_path=ssd_mobilenet_v1_pets.config \
--checkpoint_dir=voc/train_logs \
--eval_dir=voc/eval_logs
1.安装gpu版tensorflow,并搭建训练环境
sudo pip install tensorflow-gpu
sudo pip install pillow
sudo pip install lxml
sudo pip install jupyter
sudo pip install matplotlib
git clone https://github.com/tensorflow/models 将目录切换至tensorflow/models/research/
protoc object_detection/protos/*.proto --python_out=.
export PYTHONPATH=$PYTHONPATH:`pwd`:`pwd`/slim
测试安装是否成功
python object_detection/builders/model_builder_test.py
确保返回OK
2.准备训练数据
切换目录至tensorflow/models/research/
wget http://www.robots.ox.ac.uk/~vgg/data/pets/data/images.tar.gz wget http://www.robots.ox.ac.uk/~vgg/data/pets/data/annotations.tar.gz tar -xvf annotations.tar.gz
tar -xvf images.tar.gz
python object_detection/dataset_tools/create_pet_tf_record.py \
--label_map_path=object_detection/data/pet_label_map.pbtxt \
--data_dir=`pwd` \
--output_dir=`pwd`
3.将数据转换为tfrecords
python object_detection/dataset_tools/create_pet_tf_record.py \
--label_map_path=object_detection/data/pet_label_map.pbtxt \
--data_dir=`pwd` \
--output_dir=`pwd`
4.训练模型,参考链接https://github.com/tensorflow/models/blob/master/research/object_detection/g3doc/running_locally.md
cp object_detection/samples/configs/ssd_mobilenet_v1_pets.config ssd_mobilenet_v1_pets.config
修改ssd_mobilenet_v1_pets.config中PATH_TO_BE_CONFIGURED的值为本机的路径
下载预训练的模型,参考链接https://github.com/tensorflow/models/blob/master/research/object_detection/g3doc/detection_model_zoo.md
wget http://download.tensorflow.org/models/object_detection/ssd_mobilenet_v1_coco_2017_11_17.tar.gz 解压到当前目录:tar -zvxf ssd_mobilenet_v1_coco_2017_11_17.tar.gz
python object_detection/train.py \
--logtostderr \
--pipeline_config_path=ssd_mobilenet_v1_pets.config \
--train_dir=voc/train_logs \
2>&1 | tee voc/train_logs.txt
5.评估模型
python object_detection/eval.py \
--logtostderr \
--pipeline_config_path=ssd_mobilenet_v1_pets.config \
--checkpoint_dir=voc/train_logs \
--eval_dir=voc/eval_logs
相关文章推荐
- Tensorflow训练自己的Object Detection模型并进行目标检测
- 百度AI攻城狮,用TensorFlow API训练目标检测模型(浣熊超可爱)
- 什么是MAP? 理解目标检测模型中的性能评估
- 基于Tensorflow学习神经网络-目标检测
- [置顶] Object Detection with Discriminatively Trained Part Based Models(使用判别训练的部件模型进行目标检测 )
- 使用opnalpr训练目标检测级联分类器
- 目标检测(从样本处理到训练检测)训练级联分类器
- SSD目标检测算法改进:DSOD(不需要预训练的目标检测算法)
- 使用判别训练的部件模型进行目标检测
- 目标检测之训练opencv自带的分类器(opencv_haartraining 或 opencv_traincascade)
- TensorFlow 上基于 Faster RCNN 的目标检测
- 人工智能 tensorflow框架-->Softmax回归模型的训练与评估 09
- Opencv目标检测之级联分类器训练与测试
- 如何用OpenCV自带的adaboost程序训练并检测目标
- 目标检测程序开发(三)——级联分类器训练
- tensorflow 目标检测API学习之protobuf
- (二) Ubuntu安装新版tensorflow以及目标检测API
- 目标检测算法SSD在window环境下GPU配置训练自己的数据集
- TensorFlow学习笔记(六) tensorflow 中的保存训练的参数以及载入参数检测test集
- 使用caffe训练的深度学习做目标检测(车辆检测)