pytorch的mask-rcnn的模型参数解释

输入图像1920x1080,batch_size=8为例.

训练阶段

loss_dict = model(images,targets)

  • 入参
    • images: List(Tensor(3,1920,1080))[8]
    • targets: List(dict()[3])[8] dict详情见下表:
keytypedtypesizeremark
boxesTensorfloat32(n,4)1the ground-truth boxes in [x1, y1, x2, y2] format, with 0 <= x1 < x2 <= W and 0 <= y1 < y2 <= H.
labelsTenosrint64(n,)the class label for each ground-truth box
maskesTensoruint8(n,1920,1080)[N,H,W]the segmentation binary masks for each instance,实际就是0和1,有对象的区域就是1,否则就是0,这个照片有多少个对象就有多少个mask
area*Tensorfloat32(n,)对象面积
iscrowd*Tensorint64(n,)是否为一群对象(coco数据集会标注)
image_id*int图像编号

*为非必要参数,有一些数据集合处理的时候会标注上去*

  • 返回 loss_dict dict()[5] dict详情见下表:
keytypedtypesize损失函数remark
loss_classiferTensorfloat32()CrossEntropyLoss对象分类损失(Classification Loss):
loss_box_regTensorfloat32()Smooth L1 Loss/MSE边界框回归损失(Bounding Box Regression Loss):
loss_maskTensorfloat32()Binary Cross-Entropy Loss掩膜损失(Mask Loss):
loss_objectnessTensorfloat32()CrossEntropyLossRPN分类损失(RPN Classification Loss):前景/背景二分类损失
loss_rpn_box_regTensorfloat32()Smooth L1/MSERPN边界框回归损失(RPN Bounding Box Regression Loss)

推理阶段

predict = model(images)

  • 入参 images: List(Tensor(3,1920,1080))[8] 不变
  • 返回 predict:List(dict()[4])[8] dict详情见下表:
keytypedtypesizeremark
boxesTensorfloat32(m,4)2the predicted boxes in [x1, y1, x2, y2] format,预测的所有的边界框
labelsTensorint64(m,)the predicted labels for each instance
boxesTensorfloat32(m,)the scores or each instance
boxesTensorfloat32(m,1,1920,1080)[M, 1, H, W]the predicted masks for each instance, in 0-1 range. In order to obtain the final segmentation masks, the soft masks can be thresholded, generally with a value of 0.5 (mask >= 0.5).实际存储的是一个软掩膜,0.5以下的也有,存在比较平滑的过度

参考官方文档
maskrcnn_resnet50_fpn


  1. n为此图像上的实例个数 ↩︎

  2. m为此图像 ↩︎

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

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值