xingmimfl/pytorch_RFCN

can not run test.py

lxtGH opened this issue · 3 comments

lxtGH commented

how to evaluate your model?

I fixed this problem by modify a few lines here

bug version(original):

# skip j = 0, because it's the background class
for j in xrange(1, imdb.num_classes):
    inds = np.where(scores[:, j] > thresh)[0]
    cls_scores = scores[inds, j]
    cls_boxes = boxes[inds, j * 4:(j + 1) * 4]
    cls_dets = np.hstack((cls_boxes, cls_scores[:, np.newaxis])) \
    .astype(np.float32, copy=False)
    keep = nms(cls_dets, cfg.TEST.NMS)
    cls_dets = cls_dets[keep, :]
    if vis:
        im2show = vis_detections(im2show, imdb.classes[j], cls_dets)
        all_boxes[j][i] = cls_dets

after fixed:

for j in xrange(1, imdb.num_classes):
    inds = np.where(scores[:, j] > thresh)[0]
    cls_scores = scores[inds, j]
    fg = int(j > 0) # class should be agnostic
    cls_boxes = boxes[inds, fg * 4:(fg + 1) * 4]
    cls_dets = np.hstack((cls_boxes, cls_scores[:, np.newaxis])) \
    .astype(np.float32, copy=False)
    keep = nms(cls_dets, cfg.TEST.NMS)
    cls_dets = cls_dets[keep, :]
    if vis:
        im2show = vis_detections(im2show, imdb.classes[j], cls_dets)
        all_boxes[j][i] = cls_dets

hope this helpful

lxtGH commented

Hi! thanks for reply, what is your result of the your model @princewang1994

I got about 0.36 mAP by running train.py directly, it seems that R-FCN's structure in these repo is not the same as that in original paper such as the size of feature map in resnet stage-5. After enlarge the size of stage-5, mAP reached about 49.5, which is also poor ==.