CenterNet icon indicating copy to clipboard operation
CenterNet copied to clipboard

a coding mistake

Open fenglv12345 opened this issue 5 years ago • 4 comments

mistake as below https://github.com/Duankaiwen/CenterNet/blob/master/sample/utils.py

def gaussian_radius(det_size, min_overlap):

height, width = det_size



a1  = 1

b1  = (height + width)

c1  = width * height * (1 - min_overlap) / (1 + min_overlap)

sq1 = np.sqrt(b1 ** 2 - 4 * a1 * c1)

r1  = (b1 + sq1) / 2



a2  = 4

b2  = 2 * (height + width)

c2  = (1 - min_overlap) * width * height

sq2 = np.sqrt(b2 ** 2 - 4 * a2 * c2)

r2  = (b2 + sq2) / 2



a3  = 4 * min_overlap

b3  = -2 * min_overlap * (height + width)

c3  = (min_overlap - 1) * width * height

sq3 = np.sqrt(b3 ** 2 - 4 * a3 * c3)

r3  = (b3 + sq3) / 2

return min(r1, r2, r3)

And the correct one please reference to the https://github.com/princeton-vl/CornerNet/blob/master/sample/utils.py like this

def gaussian_radius(det_size, min_overlap):

height, width = det_size



a1  = 1

b1  = (height + width)

c1  = width * height * (1 - min_overlap) / (1 + min_overlap)

sq1 = np.sqrt(b1 ** 2 - 4 * a1 * c1)

r1  = (b1 - sq1) / (2 * a1)



a2  = 4

b2  = 2 * (height + width)

c2  = (1 - min_overlap) * width * height

sq2 = np.sqrt(b2 ** 2 - 4 * a2 * c2)

r2  = (b2 - sq2) / (2 * a2)



a3  = 4 * min_overlap

b3  = -2 * min_overlap * (height + width)

c3  = (min_overlap - 1) * width * height

sq3 = np.sqrt(b3 ** 2 - 4 * a3 * c3)

r3  = (b3 + sq3) / (2 * a3)

return min(r1, r2, r3)

so i hope you can give you Mathematical formula derivation in the readme.md because which is not same with mine

fenglv12345 avatar Jun 01 '19 01:06 fenglv12345

Hi @fenglv12345 https://github.com/princeton-vl/CornerNet/issues/37

Duankaiwen avatar Jun 03 '19 02:06 Duankaiwen

@Duankaiwen i have seen that,i mean that your r1 and r2 are different from the cornernet. Check it carefully. by the way,maybe cornernet's mathmatical formulas are not correct. I have given my mathmatical formulas. as below https://github.com/princeton-vl/CornerNet/issues/110

fenglv12345 avatar Jun 03 '19 07:06 fenglv12345

Thanks for your mathmatical formulas, i have seen that. The author of CornerNet modified the codes, and i didn't notice this. %UHV}1%KP JWJ1HS4V)N4O4

Duankaiwen avatar Jun 03 '19 08:06 Duankaiwen

I have already updated the formulas. https://github.com/princeton-vl/CornerNet/issues/110

fenglv12345 avatar Jun 03 '19 10:06 fenglv12345