microsoft / Recursive-Cascaded-Networks

[ICCV 2019] Recursive Cascaded Networks for Unsupervised Medical Image Registration
https://arxiv.org/abs/1907.12353
MIT License
361 stars 87 forks source link

Questions about loss function #35

Closed CGC1031 closed 3 years ago

CGC1031 commented 4 years ago

Hi, I have been studying dice index and loss function recently.I have some questions for a long time. I want to add dice_loss to the loss. It is defined as follows. def dice_loss(self, seg1, wraped_seg2): function refers to your code def mask_metrics(seg1, seg2):

  1. Firstly, I passed in seg1 and Warped_seg2. ### line 474 We find that the dice_loss does not converge. dice_loss=1 means that dice_score=0 . QQ图片20200711134742 In order to verify whether I wrote the loss function code has problems.

  2. Secondly, I passed in img1 and Warped_img2. ### line 475 It's ok. dice_loss converges. This means my code has no problems. QQ图片20200711135959

Through comparative experiments, it is found that the input data is different. test1: seg1self.reconstruction([seg2, stem_result['agg_flow']] ---------------failure test2: img1stem_result['warped']---------------------------------------------succeed

I think seg1 is fine. self.reconstruction([seg2, stem_result['agg_flow']] occures wrong. In fact, self.reconstruction([seg2, stem_result['agg_flow']] equals to warped_seg_moving.Is it not in the back propagation at all ? All the input refers to the warped_moving, the loss function converges. All of the warped_seg_moving involved do not converge. The above is my experiment. Could you give me some Suggestions? Is there something wrong with warped_seg_moving ?

Looking forward to your reply. Thank you!

zsyzzsoft commented 4 years ago

What does your segmentation map look like? Is the range in [0, 1] or [0, 255]? Are there multiple anatomical structures in the segmentation map such that each structure corresponds to a different value?

CGC1031 commented 4 years ago

1.I'm using your data sets. For example,the following is the label for the dataset LSPIG . It should be a binary image, not a grayscale image? QQ图片20200712130831 2.The segmentation diagram shows that there is only one anatomical structure. 3.So, I want to pass seg_fixed and warped_seg_moving_0/1/2/... in dice_loss. I can't figure out the reason for dice_loss=0.

zsyzzsoft commented 4 years ago

It seems that the segmentations are in range [0, 255], but the images are in [0, 1]. Maybe you can check it again.

CGC1031 commented 4 years ago

Thank you for your reply sincerely. 1.I re-read it and found it was grayscale in range [0,255].There is no problem with the images, they match the code. 2.I tested the code for the Dice_loss section separately, and it was no problem. So I guess it was the warped_seg_moving_0/1/2/... I passed in that had a problem. Can you find where I went wrong? Or how can i pass in the warped moving lable?

zsyzzsoft commented 4 years ago

What training datasets are you using? Is there segmentation information in the training datasets?

CGC1031 commented 4 years ago

I'm using your data sets. When training, is there no input of segmented information?

zsyzzsoft commented 4 years ago

In our training datasets, there is no segmentation information.

CGC1031 commented 4 years ago

OK,thank you very much.