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

Couldn't understand how to test on one instance #4

Closed
billel-a opened this issue Apr 6, 2022 · 8 comments
Closed

Couldn't understand how to test on one instance #4

billel-a opened this issue Apr 6, 2022 · 8 comments

Comments

@billel-a
Copy link

billel-a commented Apr 6, 2022

Hello i was trying to implement this model on a small application im having two problems:
1- is there a function that i d give the model and the niftii of one patient or the multiple niftii of one patient and it returns a segmented nifti something like test( OneData,Model) : segmentation or isn't there anything like that in this git.
2- Can this run on cpu only or do i need a gpu

Thanks in advance
Great work

@himashi92
Copy link
Owner

You can use test.py https://github.com/himashi92/vizviva_brats_2021/blob/main/test.py to make predictions for the given patient data. In this repo, I primarily focus on brain tumor segmentation and patient data comprises multiple modalities.

Yes, you can use a CPU, but I recommend using GPU for both training and inference time.

@billel-a
Copy link
Author

billel-a commented Apr 6, 2022

Since there is the pretrained model I was thinking if im not doing a retraining but a simple one data segmentation it ll be fast even on gpu the problem i had working with your test.py is :
line 85 - 86 you have this :
if ngpus == 0:
raise RuntimeWarning("This will not be able to run on CPU only")

and to use test.py do I have to put data in the folder dataset ? cause I was looking to just load them by path each time

@himashi92
Copy link
Owner

Remove that code fragment. Try using device = torch.device("cpu"), and load model to cpu instead of gpu like this model.to(device).

You have to give your folder dataset path for input_dir parameter https://github.com/himashi92/vizviva_brats_2021/blob/main/config.py#L6

@billel-a
Copy link
Author

billel-a commented Apr 7, 2022

yeah but this is used to do a bunch of predictions like all the test data or train data or ...
Sorry to bother you but what im looking for is just one data prediction im working on a niftii visualizer where he ll chose from the GUI the file he wants and i want based on the file he chose i do the prediction and segmentation just for that.
Can you tell me what i have to do ?
And thanks so much for your help

@himashi92
Copy link
Owner

What is the dataset you gonna use? Is it this brats dataset?
So basically, this model works for multi-modal nifty images. Therefore, when you choose a nifty file you have to choose the folder which has four modalities in it, not a single nifty file. For example, if you choose the patient_01's folder (that is BraTS2021_00000), the file structure looks like this.

BraTS2021_00000
|--------------BraTS2021_00000_flair.nii.gz
|--------------BraTS2021_00000_t1.nii.gz
|--------------BraTS2021_00000_t1ce.nii.gz
|--------------BraTS2021_00000_t2.nii.gz
|--------------BraTS2021_00000_seg.nii.gz

So the chosen input dir from GUI should be BraTS2021_00000 folder path.

@billel-a
Copy link
Author

billel-a commented Apr 7, 2022

It shouldnt use the file : BraTS2021_00000_seg.nii.gz isn't this the result file what the model should give as output ?
and for the rest yes i ll be giving it :
|--------------BraTS2021_00000_flair.nii.gz
|--------------BraTS2021_00000_t1.nii.gz
|--------------BraTS2021_00000_t1ce.nii.gz
|--------------BraTS2021_00000_t2.nii.gz

@himashi92
Copy link
Owner

yes, you are right. But this will be handled by code.

@billel-a
Copy link
Author

billel-a commented Apr 8, 2022

Thanks so much

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

2 participants