MSRF-Net_PyTorch icon indicating copy to clipboard operation
MSRF-Net_PyTorch copied to clipboard

About cv2.canny

Open Liqq1 opened this issue 2 years ago • 4 comments

Hello! I have some questions about cv2.canny module. What is the function of "cv2. Canny"module in the figure? This step is not in the MSRF-Net, and I don't see a place in the Shape Stream Block where I can input it. I am looking forward hearing from you! 34F52168-B5F9-4226-A924-2865A8061916

Liqq1 avatar Feb 12 '22 14:02 Liqq1

Hi!

cv2.Canny reefers to the canny function in opencv. It is only neccesary for the "Shape Stream" which is feeded by x13, x23, x33, x44 and also with the original image with Canny applied. The objective of the shape Stream is to reproduce the canny image using the original canny image combined with the multiscale features. I think the shape stream block is an additional regulatization method. You can read more about this here.

In the code you can see Canny in the following lines:

  • Dataset line 85 -87 and 91
  • Model line 374 and 400
  • Loss in class CombinedLoss (line 132)

You can also see that in the train, validation and test code.

amlarraz avatar Feb 15 '22 18:02 amlarraz

Thank you for your reply~ After I looked at the code, I relearned it. I wonder if it can be understood as follows: MSRF-Net does not have a Canny operation in Figure 1, but it does in Figure 2. As a result, the network in Figure 2 will have an additional concat operation in Shape Stream.

image image

Liqq1 avatar Feb 16 '22 12:02 Liqq1

Mmmmm I think the figure 1 doesn't have Canny operation because this operation isn't part of the model but part of the data to feed the model (and also to compute loss). Yep, maybe I shouldn't have added canny in the model architecture draw...

amlarraz avatar Feb 16 '22 13:02 amlarraz

I mean that I think we can just use x13, X23, X33, x44 to get what we want without concatenating the edges of the original image;Maybe I was wrong about that:-(

Liqq1 avatar Feb 16 '22 13:02 Liqq1