xuuuuuuchen / Active-Contour-Loss

Implementation of active contour loss function
MIT License
200 stars 34 forks source link

Question about the implementation of coutour extraction #13

Open liuquande opened 4 years ago

liuquande commented 4 years ago

Hi @xuuuuuuchen ,

I get some trouble to understand the implementation to compute the coutour length.

    x = y_pred[:,:,1:,:] - y_pred[:,:,:-1,:] # horizontal and vertical directions 
    y = y_pred[:,:,:,1:] - y_pred[:,:,:,:-1]

    delta_x = x[:,:,1:,:-2]**2
    delta_y = y[:,:,:-2,1:]**2
    delta_u = K.abs(delta_x + delta_y) 

According to implementation above, I draw an illustration to visualize the y_pred, delta_x and delta_y: image

As you can see, the delta_x and delta_y are not well aligned in the coordinate. In that case, the extracted coutour might be be incorrect.

Could you help me figure out what's wrong with my understanding?

Many thanks!

xsola commented 4 years ago

Do you understand it now? I also can't figure it out at this moment.

liuquande commented 4 years ago

Do you understanding it now? I also can't figure it out at this moment.

Hi, I also cannot figure it out, and am waiting for the reply.

Hi @xuuuuuuchen, could you clarify this point?

Luoxd1996 commented 4 years ago

Hi, Quande In my understanding, the AC loss calculate the length term by a finite-difference in different axis, this term just was used as a regularization term to preserve the edge is closed and remove some noise prediction pixels (maybe, I am not sure). As for coordinate alignment, I think it not very important for the AC loss, but if you want to use an aligned length term, you can find an example from our lab github, maybe two or three days later. Best Wish, Xiangde Luo.

Luoxd1996 commented 4 years ago

Do you understanding it now? I also can't figure it out at this moment.

Hi, I also cannot figure it out and am waiting for the reply.

Hi @xuuuuuuchen, could you clarify this point?

Hi,Dr. Liu, the aligned length term can be found at https://github.com/HiLab-git/ACELoss. Best wish, Xiangde Luo.