frcnn-from-scratch-with-keras icon indicating copy to clipboard operation
frcnn-from-scratch-with-keras copied to clipboard

Mistake in positive anchor box calculation (calc_rpn in data_generator.py)

Open RohanUBagewadi opened this issue 4 years ago • 1 comments

In calc_rpn function of data_generator.py. The width(anchor_x ) and height (anchor_y) for the anchor boxes are calculated based on (self.anchor_box_scales, self.anchor_box_ratios) in config.py file and these values corresponds to the original input image not the resized image. But these anchor boxes are being drawn on the resized image in calc_rpn function. The script should resize the anchor boxes to the same size.

original: anchor_x = anchor_sizes[anchor_size_idx] * anchor_ratios[anchor_ratio_idx][0] anchor_y = anchor_sizes[anchor_size_idx] * anchor_ratios[anchor_ratio_idx][1]

suggested: anchor_x = anchor_sizes[anchor_size_idx] * anchor_ratios[anchor_ratio_idx][0] * (resized_width / float(width)) anchor_y = anchor_sizes[anchor_size_idx] * anchor_ratios[anchor_ratio_idx][1] * (resized_height / float(height))

Am I correct? Is this an implementation error?

RohanUBagewadi avatar Jul 21 '20 11:07 RohanUBagewadi

I think the anchor should be drawn to the resized image because we are working with resized image for the whole training/testing process (which is the way it is implemented). In the original paper the author also resize all the image used for training and testing as a preprocess. Please correct me if i'm wrong

TiasM avatar Aug 14 '20 15:08 TiasM