ecfc31e21d0c30b1f543aacb8619582b60a1bef7,gluoncv/model_zoo/mask_rcnn/rcnn_target.py,MaskTargetGenerator,hybrid_forward,#MaskTargetGenerator#Any#Any#Any#Any#Any#,30
Before Change
self._mask_size, 1.0, sample_ratio=2)
pooled_mask = pooled_mask.reshape((-3, 0, 0))
// duplicate to C * (N, MS, MS)
mask_target = []
mask_mask = []
for cid in range(1, self._num_classes + 1):
// boolean array (N,) -> (N, 1, 1)
same_cid = (cls_target == cid).reshape((-1, 1, 1))
// keep orig targets
mask_target.append(pooled_mask)
// but mask out the one not belong to this class [N, MS, MS]
mask_mask.append(F.broadcast_mul(F.ones_like(pooled_mask), same_cid))
// (C, N, MS, MS) -> (N, C, MS, MS)
mask_targets.append(F.stack(*mask_target, axis=0).transpose((1, 0, 2, 3)))
mask_masks.append(F.stack(*mask_mask, axis=0).transpose((1, 0, 2, 3)))
// B * (N, C, MS, MS) -> (B, N, C, MS, MS)
After Change
// (N,) -> (C, 1) -> (C, N, 1, 1)
cls_target = F.expand_dims(cls_target, 0)
same_cids = F.broadcast_equal(cls_target, cids)
same_cids = same_cids.reshape((-2, 1, 1))
// (N, MS, MS) -> (C, N, 1, 1) -> (C, N, MS, MS)
mask_mask = F.broadcast_like(same_cids, pooled_mask, lhs_axes=(2, 3), rhs_axes=(1, 2))
// (N, MS, MS) -> (C, N, MS, MS)
mask_target = F.expand_dims(pooled_mask, 0)
mask_target = F.broadcast_axis(mask_target, size=self._num_classes, axis=0)
In pattern: SUPERPATTERN
Frequency: 3
Non-data size: 7
Instances
Project Name: dmlc/gluon-cv
Commit Name: ecfc31e21d0c30b1f543aacb8619582b60a1bef7
Time: 2019-08-29
Author: spanev@nvidia.com
File Name: gluoncv/model_zoo/mask_rcnn/rcnn_target.py
Class Name: MaskTargetGenerator
Method Name: hybrid_forward
Project Name: dmlc/gluon-cv
Commit Name: ec5bcece006120b6cbb2a7b420e00ae218083b44
Time: 2019-10-15
Author: jerryzh.cn@gmail.com
File Name: gluoncv/nn/coder.py
Class Name: MultiPerClassDecoder
Method Name: hybrid_forward
Project Name: chainer/chainercv
Commit Name: 827e12f3b9506e0f78cc79445441cd9d1f25c055
Time: 2018-04-24
Author: Hakuyume@users.noreply.github.com
File Name: chainercv/links/model/yolo/yolov3.py
Class Name: YOLOv3
Method Name: __call__