yhenon / pytorch-retinanet

Pytorch implementation of RetinaNet object detection.
Apache License 2.0
2.15k stars 665 forks source link

Few things to understand #80

Open jaideep11061982 opened 5 years ago

jaideep11061982 commented 5 years ago

hi yhenon Thanks for providing in the implementation. I have below things to understand from you...

1) in Losses .py file why are we subtracting from width & height anchor[:,0] & anchor [:,1] respectively i think we initi anchors 0,1 columns to zero anchor = anchors[0, :, :]

    anchor_widths  = anchor[:, 2] - anchor[:, 0]
    anchor_heights = anchor[:, 3] - anchor[:, 1]

2) what does anchor ctr_X denoes ,why we use 0.5 here anchor_ctr_x = anchor[:, 0] + 0.5 anchor_widths anchor_ctr_y = anchor[:, 1] + 0.5 anchor_heights

3) what is the purpose of shifted anchors in model.py. shifted_anchors = shift(image_shapes[idx], self.strides[idx], anchors) all_anchors = np.append(all_anchors, shifted_anchors, axis=0)

4) In general does x and y cordinates in bbox vector [pc,x,y,h,w...] deonotes top left corner cordinates ?

MikkelAntonsen commented 5 years ago
  1. In general does x and y cordinates in bbox vector [pc,x,y,h,w...] deonotes top left corner cordinates ?

This is just convention. When x/y are top denote top left corner, it's easy to find the extent of the bounding box using height and width.

  1. what does anchor ctr_X denoes ,why we use 0.5 here

It denotes center_x (ctr_x). If you take the x-coordinate of the top left corner and add half the width (then do the same for y), you get the center of the anchor box.

  1. why are we subtracting from width & height anchor[:,0] & anchor [:,1] respectively i think we initi anchors 0,1 columns to zero

I haven't actually checked, but I'm fairly sure anchor[:, 2] is x2, anchor[:, 0] is x1. So x2-x1 is the width of the anchor box.

DecentMakeover commented 4 years ago

@jaideep11061982 please close this issue if @MikkelAntonsen answer clears your doubts.