MedicineToken / MedSegDiff

Medical Image Segmentation with Diffusion Model
MIT License
1.05k stars 165 forks source link

Problems of traing #5

Closed jaceqin closed 1 year ago

jaceqin commented 1 year ago

I encountered the following problems when training with BRATS dataset!Can you help me?Thanks!

File "D:\jace\pythonProject\MedSegDiff-master\MedSegDiff-master\guided_diffusion\train_util.py", line 83, in init self._load_and_sync_parameters() File "D:\jace\pythonProject\MedSegDiff-master\MedSegDiff-master\guided_diffusion\train_util.py", line 139, in _load_and_sync_parameters dist_util.sync_params(self.model.parameters()) File "D:\jace\pythonProject\MedSegDiff-master\MedSegDiff-master\guided_diffusion\dist_util.py", line 76, in sync_params dist.broadcast(p, 0) RuntimeError: a leaf Variable that requires grad is being used in an in-place operation.

WuJunde commented 1 year ago

have you modified anything in the code?

litlepeng commented 1 year ago

I directly trained on the BraTS20 dataset and reported the following error. Please help me answer it. Thank you.

image
WuJunde commented 1 year ago

It processes each slice individually, you should input a slice with the shape [8,5,256,256].

litlepeng commented 1 year ago

I directly used the BraTS20 dataset for training, now how do I need to modify it specifically, thank you

WuJunde commented 1 year ago

you need to extract each slice from a volume for training. you can also download brats20 dataset with slice format from kaggle

litlepeng commented 1 year ago

Would it be convenient for you to put a link? I also could not find the sliced brats20 dataset on kaggle. Thank you very much

WuJunde commented 1 year ago

i see it provides slices: https://www.kaggle.com/awsaf49/brats2020-training-data. but i think extract slices is simpler

litlepeng commented 1 year ago

Thank you. I'll try again.

litlepeng commented 1 year ago

The brats20 of this slice is in h5 format, and it is not consistent with the data sets t1, t1ce, t2, flair that you need. Now do you need to change the bratsloard.py file name yourself? Could you please provide your dataset directly? Thank you very much。

image image
WuJunde commented 1 year ago

hi, in fact, you can simply extract the slices from volume through two lines code like: for index in range(volume.size(2)): slice = volume[:,:,index,:,:] ps: MedSegDiff is not a good project for you to start in this field, a recomment route is unet->nnunet->transunet->medsegdiff.

litlepeng commented 1 year ago

Thank you for your advice