Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

how to train on my own dataset? #5

Open
manvirvirk opened this issue Mar 19, 2020 · 4 comments
Open

how to train on my own dataset? #5

manvirvirk opened this issue Mar 19, 2020 · 4 comments

Comments

@manvirvirk
Copy link

No description provided.

@Mehrdad-Noori
Copy link
Owner

Mehrdad-Noori commented Jun 29, 2020

You can easily modify the prepare_data.py to make it fit to your own problem.
If you have any problems please let me know.

@qiuyuan666
Copy link

Hello! Mehrdad-Noori. Thanks for your code!
I want to train my own data, how do I put my own dataset into the folder 'data'? What are the data format requirements?
I'm looking forward to your reply.

@Mehrdad-Noori
Copy link
Owner

I used BraTS dataset that is in nii.gz format. It also contains 4 image types/channels (flair, t1, t1_ce, t2) + label. Something like:

MICCAI_BraTS_2019_Data_Training
├── HGG
│   ├── BraTS19_2013_10_1
│   │   ├── BraTS19_2013_10_1_flair.nii.gz
│   │   ├── BraTS19_2013_10_1_seg.nii.gz
│   │   ├── BraTS19_2013_10_1_t1ce.nii.gz
│   │   ├── BraTS19_2013_10_1_t1.nii.gz
│   │   └── BraTS19_2013_10_1_t2.nii.gz
│   ├── BraTS19_2013_11_1
│   │   ├── BraTS19_2013_11_1_flair.nii.gz
│   │   ├── BraTS19_2013_11_1_seg.nii.gz
│   │   ├── BraTS19_2013_11_1_t1ce.nii.gz
│   │   ├── BraTS19_2013_11_1_t1.nii.gz
│   │   └── BraTS19_2013_11_1_t2.nii.gz
:   :   
:   :
│   │
└── LGG
    ├── BraTS19_2013_0_1
    │   ├── BraTS19_2013_0_1_flair.nii.gz
    │   ├── BraTS19_2013_0_1_seg.nii.gz
    │   ├── BraTS19_2013_0_1_t1ce.nii.gz
    │   ├── BraTS19_2013_0_1_t1.nii.gz
    │   └── BraTS19_2013_0_1_t2.nii.gz
    ├── BraTS19_2013_1_1
    │   ├── BraTS19_2013_1_1_flair.nii.gz
    │   ├── BraTS19_2013_1_1_seg.nii.gz
    │   ├── BraTS19_2013_1_1_t1ce.nii.gz
    │   ├── BraTS19_2013_1_1_t1.nii.gz
    │   └── BraTS19_2013_1_1_t2.nii.gz
    :
    :

You can modify the prepare_data.py with respect to your data structure. I have also done some cropping on images with x0, x1, y0, y1, z0, z1 parameters. You can comment them out or find the cropping values of your dataset.

@Xiuxiu21
Copy link

Xiuxiu21 commented Jun 6, 2022

我按您的格式进行放置他报错了
C:\ProgramData\Anaconda3\envs\tensorflow\python.exe E:/Brats/prepare_data.py
0%| | 0/1 [00:00<?, ?it/s]
Traceback (most recent call last):
File "E:/Brats/prepare_data.py", line 168, in
cfg['crop_coord'], cfg['data_channels'], cfg['k_fold'])
File "E:/Brats/prepare_data.py", line 123, in create_table
all_modalities, brain_affine, brain_name = read_brain(brain_dir, mode='train', **crop_coordinates)
File "E:/Brats/prepare_data.py", line 50, in read_brain
modalities_dir = [flair[0], t1[0], t1ce[0], t2[0], gt[0]]
IndexError: list index out of range
Closing remaining open files:E:\data/data.hdf5...done

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants