py-faster-rcnn流程(6)——训练Fastrcnn网络二阶段

来源:互联网 发布:owncloud php下载 编辑:程序博客网 时间:2024/05/16 07:15
cfg.TRAIN.SNAPSHOT_INFIX = 'stage2'mp_kwargs = dict(        queue=mp_queue,        imdb_name=args.imdb_name,        init_model=str(rpn_stage2_out['model_path']),        solver=solvers[3],        max_iters=max_iters[3],        cfg=cfg,        rpn_file=rpn_stage2_out['proposal_path'])p = mp.Process(target=train_fast_rcnn, kwargs=mp_kwargs)p.start()fast_rcnn_stage2_out = mp_queue.get()p.join()
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13

这一步基于模型M3和P2训练fast rcnn得到最终模型M4,这一步,conv层和rpn都是参数固定,只是训练了rcnn层(也就是全连接层),与stage1不同,stage1只是固定了rpn层,其他层还是有训练。模型结构与stage1相同。

输出最后模型

final_path = os.path.join(        os.path.dirname(fast_rcnn_stage2_out['model_path']),        args.net_name + '_faster_rcnn_final.caffemodel')print 'cp {} -> {}'.format(        fast_rcnn_stage2_out['model_path'], final_path)shutil.copy(fast_rcnn_stage2_out['model_path'], final_path)print 'Final model: {}'.format(final_path)
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7

只是对上一步模型输出的一个拷贝。 
至此,整个faster-rcnn的训练过程就结束了。

阅读全文
0 0
原创粉丝点击