sanghoon / pva-faster-rcnn

Demo code for PVANet
https://arxiv.org/abs/1611.08588
Other
651 stars 241 forks source link

Visualization training #20

Open dereyly opened 7 years ago

dereyly commented 7 years ago

Hello I have strange results when trying to visualize training process: fast_rcnn/train.py

rois = net.blobs['rois'].data
bbox_targets = net.blobs['bbox_targets'].data
boxes = rois[:, 1:5]

tr_boxes = bbox_transform_inv(boxes, bbox_targets)
tr_boxes = clip_boxes(tr_boxes, im.shape)
labels=labels.astype(dtype=int)
dets_tr=[]
    for k,cls_ind in enumerate(labels):
        if cls_ind!=0:
            cls_boxes = tr_boxes[k, 4 * cls_ind:4 * (cls_ind + 1)]
            #cls_boxes = boxes[k]
            dets_tr.append([cls_boxes[0], cls_boxes[1], cls_boxes[2], cls_boxes[3], cls_ind])

dets_tr=np.array(dets_tr,dtype=int)

I try to visualize targets of Fast-RCNN Red it is target (bbox_targets). I hope target boxes restore GT box from ROI boxes. Blue is answer (bbox_pred) of pvanet/comp/test.model

Second image is train from imagenet (finetune)

tmp2 tmp

sanghoon commented 7 years ago

The current codes set bounding box regression targets to be x10 of the real targets. The hyper parameter (=x10) comes from the original py-faster-rcnn. I guess it enhances the trained results but I haven't checked it.

dereyly commented 7 years ago

Thank you. Visualization with tr_boxes = bbox_transform_inv(boxes, 0.1*bbox_targets) is correct. I miss this point. But not understand why they not change loss_weight at 'bbox loss'.

sanghoon commented 7 years ago

The effects of modifying loss weight and of bounding box targets are different since the loss function is not linear.