orobix / retina-unet

Retina blood vessel segmentation with a convolutional neural network

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Equation used in `is_patch_inside_FOV` function

jain-anshul opened this issue · comments

Can you please explain how did you reach to the following equation

y_ = y - int(img_h/2)  # origin (0,0) shifted to image center
R_inside = 270 - int(patch_h*1.42) #radius is 270 (from DRIVE db docs), minus the patch diagonal (assumed it is a square #this is the limit to contain the full patch in the FOV
radius = np.sqrt((x_*x_)+(y_*y_))

According to me it the equation should be R_inside = 270 - int(patch_h/1.42) #Half of diagonal

Considering patch_h as the height of a patch in pixels, for a patch to be fully inside the FOV we consider the worst case scenario where a patch intersects the circle of the FOV (of radius 270) along the diagonal.

But you're right, we're being too conservative: we should be using half the diagonal since we're limiting the position of the center of the patch with respect to the center of the image. The correct equation should be R_inside = 270 - int(patch_h / np.sqrt(2) * 2).

/cc @dcorti

@lantiga R_inside = 270 - int(patch_h / np.sqrt(2) * 2) is the same equation as used in the code. The correct equation, according to me, should be R_inside = 270 - int(patch_h * np.sqrt(2) / 2)

Hi,

You're right, only half diagonal should be considered and not the full one. Your equation is correct, I updated the code. Thank you for spotting the mistake!

Hey, so: I messed up. @amitmanchanda1995, of course you're right. I apologize for the noise.