Open lih627 opened 5 years ago
@lih627 Because l, t, r, b are always positive.
@lih627 Because l, t, r, b are always positive.
if self.norm_reg_targets: bbox_pred = F.relu(bbox_pred) if self.training: bbox_reg.append(bbox_pred) else: bbox_reg.append(bbox_pred * self.fpn_strides[l]) else: bbox_reg.append(torch.exp(bbox_pred))
https://github.com/tianzhi0549/FCOS/blob/master/fcos_core/modeling/rpn/fcos/fcos.py#L112
If l, t, r, b are always positive, why do you use relu?
What's more, since self.norm_reg_targets is True in your yaml, the code doesn't use exp() but only use scale factor?
I'm also interested if there is any reason to prefer exp over any other function that maps (-∞, ∞) to (0, ∞). I tried relu without scale factor and it worked well, especially with high learning rates, whereas exp would cause inf values to appear. Softplus also worked.
@marius-sm In an earlier version, we did not normalize the regression targets and they have a large range, for example, from 0 to 1334. Also, we do not want the network's outputs are too large. Thus, we need a function that can map a small value (the network's outputs) to a large value (our regression targets). An exponential function is a good choice.
@tianzhi0549 ok, thanks for your answer.
Hi, @tianzhi0549 . I was wondering how the norm_reg_targets work? When I use mmdetection to train FCOS. I got 38.5 mAP without norm_reg_targets. However, when I impelemetn the norm_reg_targets by myself, I only achieve 38.3 mAP. Did I miss something? I only add the code as follow: First, I use the code in fcos.py: if self.norm_reg_targets: bbox_pred = F.relu(bbox_pred) if self.training: bbox_reg.append(bbox_pred) else: bbox_reg.append(bbox_pred * self.fpn_strides[l]) Second, the code in loss.py if self.norm_reg_targets: reg_targets_per_level = reg_targets_per_level / self.fpn_strides[level]
@marius-sm In an earlier version, we did not normalize the regression targets and they have a large range, for example, from 0 to 1334. Also, we do not want the network's outputs are too large. Thus, we need a function that can map a small value (the network's outputs) to a large value (our regression targets). An exponential function is a good choice.
I only see a Scale operation with learnable parameters, the norm in norm_reg_targets is not really normalization, right?
In the paper, it said
I wonder to know why to use exp function in regression branch. Use exp() at the last layer output as the regression results? (as the paper notes
l,t,r,b
)