修改mobilenet_v2的导入指令,原指定导入的代码位于目录<module ‘nets.mobilenet.mobilenet_v2’ from ‘/home/lq/anaconda3/lib/python3.6/site-packages/slim-0.1-py3.6.egg/nets/mobilenet/mobilenet_v2.py’>下
1 2 3 4 'from_layer' : ['layer_15/expansion_output' ,'layer_19' , '' , '' , '' , '' ], 'layer_depth' : [-1 ,-1 , 512 , 256 , 256 , 128 ], layer_box_specs = [(0.1 , 1.0 ), (scale, 2.0 ), (scale, 0.5 )]
修改为
models/ssd_mobilenet_v2_feature_extractor.py中
1 2 3 'from_layer': ['layer_10/expansion_output','layer_15/expansion_output', 'layer_19'], 'layer_depth': [-1, -1, -1],
anchor_generators/multiple_grid_anchor_generator.py中
1 layer_box_specs = [(0.05, 1.0)]
训练相关代码 1.1.1 用原图训练
训练
1 python train.py --logtostderr --pipeline_config_path=./training/3 /ssd_mobilenet_v2_nib_3.config --train_dir=traininglog/3 /ssd_mobilenet_v2_3 --fine_tune_batch_norm=True
config文件中设置参数num_steps: ,控制训练次数限制
tensorboard可视化-查看训练log
1 tensorboard --logdir='traininglog/3/ssd_mobilenet_v2_3'
评估模型
1 python eval.py --logtostderr --pipeline_config_path=./training/3/ssd_mobilenet_v2_nib_3.config --checkpoint_dir=traininglog/3/ssd_mobilenet_v2_3 --eval_dir=eval_log/ssd_mobilenet_v2/3
tensorboard可视化-查看评估log
1 tensorboard --logdir='eval_log/ssd_mobilenet_v2/2'
导出模型(.pb文件,即frozen model)
1 python export_inference_graph.py --input_type image_tensor --pipeline_config_path training/3 /ssd_mobilenet_v2_nib_3.config --trained_checkpoint_prefix traininglog/3 /ssd_mobilenet_v2_3/model.ckpt-18329 --output_directory traininglog/3 /ssd_mobilenet_v2_3/output_inference_graph.pb