Amshaker / unetr_plus_plus

[IEEE TMI-2024] UNETR++: Delving into Efficient and Accurate 3D Medical Image Segmentation
Apache License 2.0
368 stars 36 forks source link

How can i train model in unetr++ with my own dataset? #10

Closed Overflowu7 closed 1 year ago

Overflowu7 commented 1 year ago

Hi! Your Idea is owesome ! And I'm interesting in how can i do in order to adjust with my own dataset. I have generated corresponding json file ,but I still don't know what I should do next.Should I create a new trainer file? or do something else?

Amshaker commented 1 year ago

Hi @Overflowu7 ,

Thank you for your interest in our work.

To train UNETR++ for a new dataset, you have to do the appropriate data pre-processing first. It depends on each dataset. You can follow setting-up dataset section here for pre-processing: https://github.com/282857341/nnFormer#2-setting-up-the-datasets. After that, you can use, for example, the model architecture of ACDC and create new trainings files In _unetr_plus_plus/tree/main/unetr_pp/training/networktraining. It is similar to Trainer_acdc.py, network_trainer_acdc.py, and unetr_pp_trainer_acdc.py. Please note that the folder structure of the data should follow the same structure as in run_training_acdc.sh

I hope my answer helps you to do that.

Best regards, Abdelrahman.

Overflowu7 commented 1 year ago

Thank you for your prompt reply! Based on your answer, I have another two questions.
1.I found that unetr_pp_trainer_synapse.py import UNETR_PP from unetr_pp.network_architecture.synapse.unetr_pp_synapse, should I make a new file in network_architecture which is similar to synapse and acdc? 2.I found that the batch size and crop size should be adjust in the file default_configuration.py , and I also want to know if there are other files that need to be adjusted?

Amshaker commented 1 year ago

1) Yes, you have to create similar file for your dataset. Please take care that you may need to change the architecture slightly according to the size of your input data. For example, Synapse the down-sampling layers are designed for input 63x128x128. For ACDC, the down-sampling has different kernels because the input size is different.

2) If this is a new dataset, you just have to change in there. If you need to change it for the current datasets, you have to change the .pkl file for that.

975827738 commented 6 months ago

Hi! Your Idea is owesome ! And I'm interesting in how can i do in order to adjust with my own dataset. I have generated corresponding json file ,but I still don't know what I should do next.Should I create a new trainer file? or do something else?

Hello, may I ask how to obtain the pkl file

Overflowu7 commented 6 months ago

Just change the corresponding path to the one you need.

------------------ 原始邮件 ------------------ 发件人: "Amshaker/unetr_plus_plus" @.>; 发送时间: 2024年4月17日(星期三) 下午4:14 @.>; 抄送: "- @.**@.>; 主题: Re: [Amshaker/unetr_plus_plus] How can i train model in unetr++ with my own dataset? (Issue #10)

Hi! Your Idea is owesome ! And I'm interesting in how can i do in order to adjust with my own dataset. I have generated corresponding json file ,but I still don't know what I should do next.Should I create a new trainer file? or do something else?

Hello, may I ask how to obtain the pkl file

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you were mentioned.Message ID: @.***>

975827738 commented 6 months ago

Just change the corresponding path to the one you need. ------------------ 原始邮件 ------------------ 发件人: "Amshaker/unetr_plus_plus" @.>; 发送时间: 2024年4月17日(星期三) 下午4:14 @.>; 抄送: "- @.**@.>; 主题: Re: [Amshaker/unetr_plus_plus] How can i train model in unetr++ with my own dataset? (Issue #10) Hi! Your Idea is owesome ! And I'm interesting in how can i do in order to adjust with my own dataset. I have generated corresponding json file ,but I still don't know what I should do next.Should I create a new trainer file? or do something else? Hello, may I ask how to obtain the pkl file — Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you were mentioned.Message ID: @.***>

Thank you, could you be more specific? 1. Is this .pkl file automatically generated? 2. In which file should I change thecorresponding path

Overflowu7 commented 6 months ago

Yes, .pkl files were automatically generated in nnunetv1, but were removed in nnunetv2, now json files are used instead of pkl files! If you still use nnunetv1 ,after each dataset has been processed, you can find the corresponding path of pkl in nnUNet_processed folder like "/nnUNet/nnUNet_processed/Task11_CTPelvic1K/nnUNetPlans_plans_3D.pkl'".

------------------ 原始邮件 ------------------ 发件人: "Amshaker/unetr_plus_plus" @.>; 发送时间: 2024年4月18日(星期四) 下午2:09 @.>; 抄送: "- @.**@.>; 主题: Re: [Amshaker/unetr_plus_plus] How can i train model in unetr++ with my own dataset? (Issue #10)

Just change the corresponding path to the one you need. … ------------------ 原始邮件 ------------------ 发件人: "Amshaker/unetr_plus_plus" @.>; 发送时间: 2024年4月17日(星期三) 下午4:14 @.>; 抄送: "- @.@.>; 主题: Re: [Amshaker/unetr_plus_plus] How can i train model in unetr++ with my own dataset? (Issue #10) Hi! Your Idea is owesome ! And I'm interesting in how can i do in order to adjust with my own dataset. I have generated corresponding json file ,but I still don't know what I should do next.Should I create a new trainer file? or do something else? Hello, may I ask how to obtain the pkl file — Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you were mentioned.Message ID: @.***>

Thank you, could you be more specific? 1. Is this .pkl file automatically generated? 2. In which file should I change thecorresponding path

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you were mentioned.Message ID: @.***>

975827738 commented 6 months ago

Yes, .pkl files were automatically generated in nnunetv1, but were removed in nnunetv2, now json files are used instead of pkl files! If you still use nnunetv1 ,after each dataset has been processed, you can find the corresponding path of pkl in nnUNet_processed folder like "/nnUNet/nnUNet_processed/Task11_CTPelvic1K/nnUNetPlans_plans_3D.pkl'". ------------------ 原始邮件 ------------------ 发件人: "Amshaker/unetr_plus_plus" @.>; 发送时间: 2024年4月18日(星期四) 下午2:09 @.>; 抄送: "- @.**@.>; 主题: Re: [Amshaker/unetr_plus_plus] How can i train model in unetr++ with my own dataset? (Issue #10) Just change the corresponding path to the one you need. … ------------------ 原始邮件 ------------------ 发件人: "Amshaker/unetr_plus_plus" @.>; 发送时间: 2024年4月17日(星期三) 下午4:14 @.>; 抄送: "- @.@.>; 主题: Re: [Amshaker/unetr_plus_plus] How can i train model in unetr++ with my own dataset? (Issue #10) Hi! Your Idea is owesome ! And I'm interesting in how can i do in order to adjust with my own dataset. I have generated corresponding json file ,but I still don't know what I should do next.Should I create a new trainer file? or do something else? Hello, may I ask how to obtain the pkl file — Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you were mentioned.Message ID: @.> Thank you, could you be more specific? 1. Is this .pkl file automatically generated? 2. In which file should I change thecorresponding path — Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you were mentioned.Message ID: @.>

Thank you, I understand. Does it mean using Json files instead of pkl files? In this paper, I have generated the Json file for my own dataset, but it shows that there is no pkl file. I found that the pkl file was called in the code. How did you handle it?

Overflowu7 commented 6 months ago

I haven't run unter++ code since the nnunetv2 update, so I can't provide any more information. I remember that the v1 version will automatically generate the pkl file, and unter++ is based on the v1 version, so I don't know why there is no when your data is generated. I suggest you try to apply the network part of unter++ to nnunetv2 with slight changes.

------------------ 原始邮件 ------------------ 发件人: "Amshaker/unetr_plus_plus" @.>; 发送时间: 2024年4月18日(星期四) 下午4:59 @.>; 抄送: "- @.**@.>; 主题: Re: [Amshaker/unetr_plus_plus] How can i train model in unetr++ with my own dataset? (Issue #10)

Yes, .pkl files were automatically generated in nnunetv1, but were removed in nnunetv2, now json files are used instead of pkl files! If you still use nnunetv1 ,after each dataset has been processed, you can find the corresponding path of pkl in nnUNet_processed folder like "/nnUNet/nnUNet_processed/Task11_CTPelvic1K/nnUNetPlans_plans_3D.pkl'". … ------------------ 原始邮件 ------------------ 发件人: "Amshaker/unetr_plus_plus" @.>; 发送时间: 2024年4月18日(星期四) 下午2:09 @.>; 抄送: "- @.@.>; 主题: Re: [Amshaker/unetr_plus_plus] How can i train model in unetr++ with my own dataset? (Issue #10) Just change the corresponding path to the one you need. … ------------------ 原始邮件 ------------------ 发件人: "Amshaker/unetr_plus_plus" @.>; 发送时间: 2024年4月17日(星期三) 下午4:14 @.>; 抄送: "- @.@.>; 主题: Re: [Amshaker/unetr_plus_plus] How can i train model in unetr++ with my own dataset? (Issue #10) Hi! Your Idea is owesome ! And I'm interesting in how can i do in order to adjust with my own dataset. I have generated corresponding json file ,but I still don't know what I should do next.Should I create a new trainer file? or do something else? Hello, may I ask how to obtain the pkl file — Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you were mentioned.Message ID: @.> Thank you, could you be more specific? 1. Is this .pkl file automatically generated? 2. In which file should I change thecorresponding path — Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you were mentioned.Message ID: @.>

Thank you, I understand. Does it mean using Json files instead of pkl files? In this paper, I have generated the Json file for my own dataset, but it shows that there is no pkl file. I found that the pkl file was called in the code. How did you handle it?

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you were mentioned.Message ID: @.***>

975827738 commented 6 months ago

I haven't run unter++ code since the nnunetv2 update, so I can't provide any more information. I remember that the v1 version will automatically generate the pkl file, and unter++ is based on the v1 version, so I don't know why there is no when your data is generated. I suggest you try to apply the network part of unter++ to nnunetv2 with slight changes. ------------------ 原始邮件 ------------------ 发件人: "Amshaker/unetr_plus_plus" @.>; 发送时间: 2024年4月18日(星期四) 下午4:59 @.>; 抄送: "- @.**@.>; 主题: Re: [Amshaker/unetr_plus_plus] How can i train model in unetr++ with my own dataset? (Issue #10) Yes, .pkl files were automatically generated in nnunetv1, but were removed in nnunetv2, now json files are used instead of pkl files! If you still use nnunetv1 ,after each dataset has been processed, you can find the corresponding path of pkl in nnUNet_processed folder like "/nnUNet/nnUNet_processed/Task11_CTPelvic1K/nnUNetPlans_plans_3D.pkl'". … ------------------ 原始邮件 ------------------ 发件人: "Amshaker/unetr_plus_plus" @.>; 发送时间: 2024年4月18日(星期四) 下午2:09 @.>; 抄送: "- @.@.>; 主题: Re: [Amshaker/unetr_plus_plus] How can i train model in unetr++ with my own dataset? (Issue #10) Just change the corresponding path to the one you need. … ------------------ 原始邮件 ------------------ 发件人: "Amshaker/unetr_plus_plus" @.>; 发送时间: 2024年4月17日(星期三) 下午4:14 @.>; 抄送: "- @.@.>; 主题: Re: [Amshaker/unetr_plus_plus] How can i train model in unetr++ with my own dataset? (Issue #10) Hi! Your Idea is owesome ! And I'm interesting in how can i do in order to adjust with my own dataset. I have generated corresponding json file ,but I still don't know what I should do next.Should I create a new trainer file? or do something else? Hello, may I ask how to obtain the pkl file — Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you were mentioned.Message ID: @.> Thank you, could you be more specific? 1. Is this .pkl file automatically generated? 2. In which file should I change thecorresponding path — Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you were mentioned.Message ID: @.> Thank you, I understand. Does it mean using Json files instead of pkl files? In this paper, I have generated the Json file for my own dataset, but it shows that there is no pkl file. I found that the pkl file was called in the code. How did you handle it? — Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you were mentioned.Message ID: @.***>

Ok, thanks for your reply