Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Original code of gaussian_radius has been fixed #3

Closed
kikirizki opened this issue Mar 19, 2020 · 5 comments
Closed

Original code of gaussian_radius has been fixed #3

kikirizki opened this issue Mar 19, 2020 · 5 comments

Comments

@kikirizki
Copy link

kikirizki commented Mar 19, 2020

the code for gaussian radius from CenterNet repo was brought from Cornernet and the gaussian_radius() function is wrong, it has been fixed by the author here is the code

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)

Please refer to this for formula derivation
princeton-vl/CornerNet#110

@kikirizki kikirizki changed the title Original code of gaussian_radius was fixes Original code of gaussian_radius has been fixed Mar 19, 2020
@lucasjinreal
Copy link
Owner

thanks for this useful info!

what's the side effect due to wrong gaussian radius anyway?

@kikirizki
Copy link
Author

@fenglv12345 show significant improvement in average recall princeton-vl/CornerNet#110 (comment)

@lucasjinreal
Copy link
Owner

got it, will try it

@kikirizki
Copy link
Author

thanks for this useful info!

what's the side effect due to wrong gaussian radius anyway?

Lower average recall

@Devoe-97
Copy link

the code for gaussian radius from CenterNet repo was brought from Cornernet and the gaussian_radius() function is wrong, it has been fixed by the author here is the code
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)

Please refer to this for formula derivation
princeton-vl/CornerNet#110

for r1 and r2, why is b-sq not b+sq? they all are positive.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants