ellisdg / 3DUnetCNN

Pytorch 3D U-Net Convolution Neural Network (CNN) designed for medical image segmentation
MIT License
1.91k stars 653 forks source link

How to train on my own data #249

Closed Iamyourbaba closed 3 years ago

Iamyourbaba commented 4 years ago

How to train on my own data. My data in the form of Dicom, such as data in https://www.ircad.fr/research/3d-ircadb-01/

ellisdg commented 4 years ago

You can convert the DICOMS to nifti using dcm2niix.

stale[bot] commented 4 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. If you have questions, feel free to join the Slack group or email me at davidgellis2@gmail.com.

DanpengDing commented 5 months ago

How to train on my own data. My data in the form of Dicom, such as data in https://www.ircad.fr/research/3d-ircadb-01/

hello,i also use this dataset for training. But i hava some problem:During the training, my loss was always 1

ellisdg commented 5 months ago

If the loss is always one, that could indicate that the training data is incorrect. Did you convert the images to Nifti? Have you examined the training images to see that they make sense?

DanpengDing commented 5 months ago

If the loss is always one, that could indicate that the training data is incorrect. Did you convert the images to Nifti? Have you examined the training images to see that they make sense?

I converted CT data into nii image

and I checked that my data and label corresponded correctly one-to-one.

The data is converted to nii format and the label is 255 instead of 1. I did not convert 255 to 1. Write "labels" directly to config.json: [ 0, 255 ]. Could this be the cause of the problem this my config: { "model": { "name": "DynUNet", "in_channels": 1, "out_channels": 2, "spatial_dims": 3, "deep_supervision": false, "strides": [ [ 1, 1, 1 ], [ 2, 2, 2 ], [ 2, 2, 2 ], [ 2, 2, 2 ], [ 2, 2, 2 ], [ 2, 2, 2 ] ], "filters": [ 64, 96, 128, 192, 256, 384 ], "kernel_size": [ [ 3, 3, 3 ], [ 3, 3, 3 ], [ 3, 3, 3 ], [ 3, 3, 3 ], [ 3, 3, 3 ], [ 3, 3, 3 ] ], "upsample_kernel_size": [ [ 2, 2, 2 ], [ 2, 2, 2 ], [ 2, 2, 2 ], [ 2, 2, 2 ], [ 2, 2, 2 ] ] }, "optimizer": { "name": "Adam", "lr": 0.001 }, "loss": { "name": "DiceLoss", "include_background": false, "sigmoid": true }, "cross_validation": { "n_folds": 5, "random_seed": 25 }, "scheduler": { "name": "ReduceLROnPlateau", "patience": 10, "factor": 0.5, "min_lr": 1e-08 }, "dataset": { "name": "SegmentationDatasetPersistent", "desired_shape": [ 128, 128, 128 ], "labels": [ 0, 255 ], "setup_label_hierarchy": true, "normalization": "NormalizeIntensityD", "normalization_kwargs": { "channel_wise": true, "nonzero": false }, "resample": true, "crop_foreground": true }, "training": { "batch_size": 1, "validation_batch_size": 1, "amp": false, "early_stopping_patience": null, "n_epochs": 250, "save_every_n_epochs": null, "save_last_n_models": null, "save_best": true }, "training_filenames": [ { "image": [ "D:/Net/3DUnetCNN/examples/nii/data/PATIENT_DICOM1.nii" ], "label": "D:/Net/3DUnetCNN/examples/nii/label/venoussystem1.nii" }, { "image": [ "D:/Net/3DUnetCNN/examples/nii/data/PATIENT_DICOM4.nii" ], "label": "D:/Net/3DUnetCNN/examples/nii/label/venoussystem4.nii" }, { "image": [ "D:/Net/3DUnetCNN/examples/nii/data/PATIENT_DICOM5.nii" ], "label": "D:/Net/3DUnetCNN/examples/nii/label/venoussystem5.nii" }, { "image": [ "D:/Net/3DUnetCNN/examples/nii/data/PATIENT_DICOM6.nii" ], "label": "D:/Net/3DUnetCNN/examples/nii/label/venoussystem6.nii" }, { "image": [ "D:/Net/3DUnetCNN/examples/nii/data/PATIENT_DICOM7.nii" ], "label": "D:/Net/3DUnetCNN/examples/nii/label/venoussystem7.nii" }, { "image": [ "D:/Net/3DUnetCNN/examples/nii/data/PATIENT_DICOM8.nii" ], "label": "D:/Net/3DUnetCNN/examples/nii/label/venoussystem8.nii" }, { "image": [ "D:/Net/3DUnetCNN/examples/nii/data/PATIENT_DICOM9.nii" ], "label": "D:/Net/3DUnetCNN/examples/nii/label/venoussystem9.nii" }, { "image": [ "D:/Net/3DUnetCNN/examples/nii/data/PATIENT_DICOM10.nii" ], "label": "D:/Net/3DUnetCNN/examples/nii/label/venoussystem10.nii" }, { "image": [ "D:/Net/3DUnetCNN/examples/nii/data/PATIENT_DICOM11.nii" ], "label": "D:/Net/3DUnetCNN/examples/nii/label/venoussystem11.nii" }, { "image": [ "D:/Net/3DUnetCNN/examples/nii/data/PATIENT_DICOM16.nii" ], "label": "D:/Net/3DUnetCNN/examples/nii/label/venoussystem16.nii" }, { "image": [ "D:/Net/3DUnetCNN/examples/nii/data/PATIENT_DICOM17.nii" ], "label": "D:/Net/3DUnetCNN/examples/nii/label/venoussystem17.nii" }, { "image": [ "D:/Net/3DUnetCNN/examples/nii/data/PATIENT_DICOM19.nii" ], "label": "D:/Net/3DUnetCNN/examples/nii/label/venoussystem19.nii" } ] } loss very high image