DSOD实现行人检测续篇

这部分总结的是训练之后的测试部分。

迭代10000次的结果:

接下是测试过程。

Evaluate the model (DSOD):
python examples/dsod_train/score_DSOD300_pascal.py

这个文件中主要修改的地方和训练文件相似,其中路径一定要改对。主要修改的地方是

# The database file for training data. Created by data/VOC0712/create_data.sh
train_data = "/home/caffe-ssd/data/sample/dsod_train/lmdb/dsod_train_trainval_lmdb"
# The database file for testing data. Created by data/VOC0712/create_data.sh
test_data = "/home/caffe-ssd/data/sample/dsod_train/lmdb/dsod_train_test_lmdb"


# The job name should be same as the name used in examples/ssd/ssd_pascal.py.
job_name = "DSOD300_{}".format(resize)
# The name of the model. Modify it if you want.
model_name = "DSOD300_dsod_train_{}".format(job_name)

# Directory which stores the model .prototxt file.
save_dir = "models/DSOD300/dsod_train/{}_score".format(job_name)
# Directory which stores the snapshot of trained models.
snapshot_dir = "models/DSOD300/dsod_train/{}".format(job_name)
# Directory which stores the job script and log file.
job_dir = "jobs/DSOD300/dsod_train/{}_score".format(job_name)
# Directory which stores the detection results.
#output_result_dir = "home/caffe-ssd/data/sample/results/dsod_train/{}_score/Main".format(os.environ['HOME'], job_name)
output_result_dir = "home/caffe-ssd/data/sample/results/dsod_train/{}_score/Main".format(job_name)


# Stores the test image names and sizes. Created by data/VOC0712/create_list.sh
name_size_file = "/home/caffe-ssd/data/dsod_train/test_name_size.txt"
# The resume model.
pretrain_model = "{}_iter_{}.caffemodel".format(snapshot_prefix, max_iter)
# Stores LabelMapItem.
label_map_file = "/home/caffe-ssd/data/dsod_train/labelmap_voc.prototxt"


num_classes =3


gpus = "0"


num_test_image = 2171
test_batch_size = 4



其他地方例如学习率等等都可以修改。

solver_param = {
    # Train parameters
    'base_lr': 10*base_lr,
    'weight_decay': 0.0005,
    'lr_policy': "multistep",
    'stepvalue': [2000, 4000, 6000, 8000, 10000],
    'gamma': 0.1,
    'momentum': 0.9,
    'iter_size': iter_size,
    'max_iter': 0,
    'snapshot': 0,
    'display': 10,
    'average_loss': 10,
    'type': "SGD",
    'solver_mode': solver_mode,
    'device_id': device_id,
    'debug_info': False,
    'snapshot_after_train': False,
    # Test parameters
    'test_iter': [test_iter],
    'test_interval': 2000,
    'eval_type': "detection",
    'ap_version': "11point",
    'test_initialization': True,
    }

检测单张图,改好路径后,在xshell里面运行会出错:

:/usr/local/lib/python2.7/dist-packages/skimage/transform/_warps.py:84: UserWarning: The default mode, 'constant', will be changed to 'reflect' in skimage 0.15.

  warn("The default mode, 'constant', will be changed to 'reflect' in "

Traceback (most recent call last):

  File "DSOD300_detection_demo.py", line 109, in <module>

    currentAxis = plt.gca()

  File "/usr/local/lib/python2.7/dist-packages/matplotlib/pyplot.py", line 962, in gca

    return gcf().gca(**kwargs)

  File "/usr/local/lib/python2.7/dist-packages/matplotlib/pyplot.py", line 592, in gcf

    return figure()

  File "/usr/local/lib/python2.7/dist-packages/matplotlib/pyplot.py", line 539, in figure

    **kwargs)

  File "/usr/local/lib/python2.7/dist-packages/matplotlib/backend_bases.py", line 171, in new_figure_manager

    return cls.new_figure_manager_given_figure(num, fig)

  File "/usr/local/lib/python2.7/dist-packages/matplotlib/backends/backend_tkagg.py", line 1049, in new_figure_manager_given_figure

    window = Tk.Tk(className="matplotlib")

  File "/usr/lib/python2.7/lib-tk/Tkinter.py", line 1818, in __init__

    self.tk = _tkinter.create(screenName, baseName, className, interactive, wantobjects, useTk, sync, use)

_tkinter.TclError: no display name and no $DISPLAY environment variable

 

 查了一些解决方法,最后参考:https://blog.csdn.net/holmes_MX/article/details/82431418解决了这个问题。最后实现了保存单张图的检测结果,效果不是很好。原因分析是迭代次数太少。

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值