chainer / chainercv

ChainerCV: a Library for Deep Learning in Computer Vision
MIT License
1.48k stars 304 forks source link

loc_normalize_std in ProposalTargetCreator #916

Closed yzl96 closed 5 years ago

yzl96 commented 5 years ago

Hi, I don't understand why you use the parameter loc_normalize_std in ProposalTargetCreator, and how you get the parameter? why you do normalization for propose_gt, for better train or others?

knorth55 commented 5 years ago

loc_normalize_std and loc_normalize_mean are used to generate gt_loc. please read these lines. https://github.com/chainer/chainercv/blob/master/chainercv/links/model/faster_rcnn/utils/proposal_target_creator.py#L135-L137

In order to get gt_loc, we need to change roi (bbox) to loc (loc) in ProposalTargetCreator. The difference of bbox and loc is written here. https://chainercv.readthedocs.io/en/stable/reference/links/faster_rcnn.html#bbox2loc

yzl96 commented 5 years ago

@knorth55 , I think the code gt_roi_loc = bbox2loc(sample_roi, bbox[gt_assignment[keep_index]]) is enough to compute offsets and scales to match sampled RoIs to the GTs, and I don't konw the code gt_roi_loc = ((gt_roi_loc - np.array(loc_normalize_mean, np.float32) ) / np.array(loc_normalize_std, np.float32)) does what, loc_normalize_std and loc_normalize_std is fixed, and I wonder how you get them?

knorth55 commented 5 years ago

loc_normalize_std and loc_normalize_mean are hyper parameter, so it is given by human.

loc is converted to bbox with loc_normalize_std and loc_normalize_mean in inference. https://github.com/chainer/chainercv/blob/master/chainercv/links/model/faster_rcnn/faster_rcnn.py#L297-L305 that is the reason why we need to do gt_roi_loc = ((gt_roi_loc - np.array(loc_normalize_mean, np.float32) ) / np.array(loc_normalize_std, np.float32)) after bbox2loc.

yzl96 commented 5 years ago

ok, thanks for you, the paper don't mention that, it's your idea or just follow official faster-rcnn implementation?

knorth55 commented 5 years ago

we follow official faster-rcnn implementation, and you can find it in original implementation, too. https://github.com/rbgirshick/py-faster-rcnn/blob/master/lib/rpn/proposal_target_layer.py#L139-L145 https://github.com/rbgirshick/py-faster-rcnn/blob/master/lib/fast_rcnn/train.py#L71-L76