PicoDet代码学习记录

  • 推理步骤

[picodet_s_320_coco.yml]

  1. Infer.py   main()->run()
  2. Trainer.py __init__()      self.model = create(cfg.architecture)
    1. Picodet.py     from_config()->__init__()
      1. head = create(cfg['head'], **kwargs)时候调用:
        1. Layers.py       MultiClassNMS __init__()
      2. Pico_head.py PicoHead __init__()
  3. Trainer.py predict()
    1. 逐个data,outs = self.model(dat
    2. Picodet.py     get_pred()->_forward()
      1. Inputs     [1,3,320,320]

                Backbone output

                Neck output

                Head output        Pico_head.py forward()       

post_process output

调用gfl_head.py   post_process()

->decode():patch中逐图像处理,图像中逐个feature map处理

        ->get_bboxes_single()

                ->get_single_level_center_point:

        bbox_pred的[1,x,y,32]:reg_max==8

               x = F.softmax(x.reshape([-1, self.reg_max + 1]), axis=1)

               x = F.linear(x, self.project).reshape([-1, 4])

       再乘以stride

       根据当前feature map的stride调整点坐标

       找到cls_score的前nms_pre的值,

->bbox_utils.py    distance2bbox      根据points的[x,y]和distance的(left, top, right, bottom),结合图像尺寸[320,320],获取bounding box的左上和右下坐标[x1,y1,x2,y2]

Mlvl_bboxes坐标根据原图resize的scale映射回原图

->nums():

->layers.py    MultiClassNMS     __call__()

->ops.py             multiclass_nums()

  1. 筛选score大于阈值score_threshold的bbox
  2. 选择前nms_top_k的bbox
  3. 基于nms_threshold和nms_eta的自适应阈值NMS过滤IOU高的框
  4. 保留前keep_top_k的bbox

  1. Coco_utils.py get_infer_results
    1. json_results.py      get_det_res   转变数据类型,保存bbox和score
    2. visualizer.py   visualize_results    在原图上根据bbox绘制框
      1. visualizer.py   draw_bbox    小于阈值不绘制
    3. visualizer.py save_result      结果保存txt

二、模型分析

  1. backbone
  1. 基于ShuffleNetV2,根据PP-LCNet进行优化,称为ESNet(Enhanced ShuffleNet)

  1. 改变1:给每个块增加SE,SE的两层激活分别是ReLU和H-Sigmoid
  2. 改变2:stride为2时,添加depthwise卷积和pointwise卷积整合通道信息
  3. 改变3:stride为1时,添加Ghost模块

  1. 改变4:channel-wise search for detection backbone,full model[128,256,512], ratio[[0.5, 0.675, 0.75, 0.875, 1]

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

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值