roytseng-tw / Detectron.pytorch

A pytorch implementation of Detectron. Both training from scratch and inferring directly from pretrained Detectron weights are available.
MIT License
2.82k stars 565 forks source link

why boxes coordinates were not scaled in blobs? #176

Open Redaimao opened 5 years ago

Redaimao commented 5 years ago

Hi, I have a question that confuses me. I use resnet50-fpn backbone

The image will be scaled before sending to network, but I found the bounding box coordinates were not scaled? why? and how about segmentation coordinates?

in loader.py RoiDataLoader--get_minibatch---add_rpn_blobs Basically in codes are: def get_minibatch(roidb): """Given a roidb, construct a minibatch sampled from it."""

We collect blobs from each image onto a list and then concat them into a

# single tensor, hence we initialize each blob to an empty list
blobs = {k: [] for k in get_minibatch_blob_names()}

# Get the input image blob
im_blob, im_scales = _get_image_blob(roidb)
blobs['data'] = im_blob

print('in get minibatch..blobs_data', blobs['data'])

if cfg.RPN.RPN_ON:
    # RPN-only or end-to-end Faster/Mask R-CNN

I found bbox coordinates were not changed after scaled

don't know why bbox coordinates were not scaled

Actual results

im_info contains width ,height ,im_scale but boxes coordinate is beyond image

'im_info': array([[ 1.33300000e+03, 1.00000000e+03, 4.16666657e-01]], dtype=float32), 'roidb': [{'has_visible_keypoints': False, 'boxes': array([[ 1276., 1212., 1911., 1387.], [ 1292., 776., 1933., 994.], [ 1290., 996., 1939., 1195.]], dtype=float32), 'segms': [[[1277, 1213, 1912, 1213, 1912, 1388, 1277, 1388]], [[1293, 823, 1934, 777, 1932, 956, 1297, 995]], [[1291, 1025, 1940, 997, 1936, 1172, 1293, 1196]]], 'seg_areas': array([ 111125. , 112011.5, 111732. ], dtype=float32),`

System information