duyhominhnguyen / LVM-Med

[NeurIPS 2023] Release LMV-Med pre-trained models
189 stars 24 forks source link

Performing 2d model on 3d input #11

Closed denemeGit11 closed 10 months ago

denemeGit11 commented 11 months ago

Hi,

I want to try the ResNet50 backbone for fine-tuned performance on Lung CT images; but I get error for GPU memory error. I set the batch size 1 while performing gradient accumulation for 8 steps to mimic the behaviour of batch size 8. However, still I get the GPU memory error. Can you help me for how I should change the code if I want to use 2d model for 3d input. Becasue in your paper, you say you get the slices of the 3d model and then you merge the result of the segmentation of 2d slices. Also how should I change the data yml file for this, because for the MMWHS_CT_endtoend_R50.yml file you only get the masks and images if there is substructure of 2 in cardiac then you fine-tune the model for 8 class. I am really confused in this. For my case, I want to perform a test how your model perform on 3d ct so I get all the slices if there is a mask then I convert them into binary masks. I really appreciate if you can help me.

Best regards,

ngctnnnn commented 11 months ago

Hi. Firstly, I would like to thank for your consideration toward our work.

Hope it might help, feel free to ask if there is any further concern.

denemeGit11 commented 11 months ago

Hi,

Thank you for your answer. I just want to test your work on the mediastinal lymph node segmentation on lung CT images. As I examine the codes for MMWHS_CT data, you get the slices with labels that include substructure 2; then these masks are converted into binary masks; but the class number is given as 8 (Since the focus is segmenting substruce of 2 by taking relative masks why the class number is set for 8; I don't understand.) For my case, I change this section by taking all slices with the labels that has at least one mask and then convert them into binary mask; then I give the classes 2. I think these changes is sufficient to try the fine-tuning code.

Best regards,

nghiemkythu commented 11 months ago

Hi, I would like to thank for your consideration toward our work.

Hope it might help, feel free to ask if there is any further concern.

denemeGit11 commented 11 months ago

Hi,

Thank you for the clarification, I already changed the parameters as you mentioned. Now, I can test your study in the mediastinal lymph node segmentation by making binary segmentation. But the IoU 3d score comes out very low. Actually I perform binary segmentation because I want to test the ResNet50 model performance on segmentation of the lymph nodes without specifying classes/anatomical stations. Thank you for your answers.

Best regards,

denemeGit11 commented 11 months ago

However, I am still confused for the MMWHS_ct data. There are a total of 8 classes in the data, including 7 substructures and 1 other, but in code,only the 2nd substructure is focused to be segmentated. Because if I understand correctly, only the masks that contain substructure 2 were taken and converted into binary masks. However, there are also other 6 substructure masks. I am really confused in this part. Thank you for patience and answers.

Best regards,

duyhominhnguyen commented 11 months ago

Hi @denemeGit11, for MMWHS_ct data, we trained to segment all classes but only evaluate the 2nd structure as you mentioned. This aims to compare results with previous baselines on left atrial blood cavity regions when they only report results on this one. In other words, you can use our codes to evaluate other structures you want by changing eval_class variable.

Regarding the low performance on the mediastinal lymph node, have you solved it? You should try around with some tricks like normalizing gradient or adjust the learning rate (lr=0.001, lr=0.01, etc) of Adam for your case. Also make sure to normalize your input data into a proper range as well. Please let us know if it still does not work.

denemeGit11 commented 11 months ago

Hi,

Thanks for your answers. I can inform you when the fine-tuning code is completed. I changed some parameters and add more data, and now the 2d iou score is actually okay like around 0.85 but 3d iou score comes out pretty low around 0.13.

duyhominhnguyen commented 11 months ago

@denemeGit11, then you should check on the 3D evaluation function to make sure you pass the right label number to measure accuracy.