sct-pipeline / fmri-segmentation

Repository for the project on automatic spinal cord segmentation based on fMRI EPI data
MIT License
4 stars 1 forks source link

Issues in the inference script #42

Closed rohanbanerjee closed 5 months ago

rohanbanerjee commented 6 months ago

Documenting the issues mentioned by @MerveKaptan in our email correspondence

What kind of input is necessary? 
I would like to segment one specific mean image - is that possible? I do not think it is and I believe this may be the issue?

command:
python run_inference.py --path-dataset_bids /home/mkaptan/Documents/data/BIDS/derivatives/data_processed/sub-308/ses-02spinalcord/func/EM/sub-308_ses-02spinalcord_task-EM_bold_mc2_mean.nii.gz  --path-out /home/mkaptan/Documents/data/BIDS/derivatives/data_processed/sub-308/ses-02spinalcord/func/EM/path/  --path-model /home/mkaptan/Documents/EPIsegmentation/fmri-segmentation/inference/model_20240410-20240421T213048Z-001/model_20240410/  --use-best-checkpoint --path-qc /home/mkaptan/Documents/data/BIDS/derivatives/data_processed/sub-308/ses-02spinalcord/func/EM/path/

After I run this, I see the following on my terminal: 

Found a dataset folder. Running inference on the whole dataset...
Creating temporary folder with proper filenames...
Starting inference...
perform_everything_on_gpu=True is only supported for cuda devices! Setting this to False
Running inference on device: cpu
Model loaded successfully. Fetching test data...
There are 0 cases in the source folder
I am process 0 out of 1 (max process ID is 0, we start counting with 0!)
There are 0 cases that I would like to predict
overwrite was set to False, so I am only working on cases that haven't been predicted yet. That's 0 cases.
Inference done.
Deleting the temporary folder...
----------------------------------------------------
Results can be found in: /home/mkaptan/Documents/data/BIDS/derivatives/data_processed/sub-308/ses-02spinalcord/func/EM/path/

tl;dr The inference script does not currently have the compatibility for running inference on a single image. It currently works for running inference on a whole dataset.

rohanbanerjee commented 6 months ago

commit a48347e0a1dd8737db70c25ca7de2923d7edd66f solves the above mentioned issues.

@MerveKaptan can you please follow the following steps and then update if the errors still persists?

1. cd fmri-segmentation
2. git pull
3. python run_inference.py --path-images <PATH_TO_IMAGE> --path-out <PATH_TO_OUTPUT> --path-model <PATH_TO_MODEL> --use-best-checkpoint -path-qc <PATH_TO_QC>
jcohenadad commented 6 months ago

tl;dr The inference script does not currently have the compatibility for running inference on a single image. It currently works for running inference on a whole dataset.

SCT now has an nnUnetv2 wrapper, why not using it?

rohanbanerjee commented 6 months ago

Oh right, that is the plan. This is a temporary script for inference. I'm in the process of making a new release with the round 2 trained model and integrate it into SCT.

rohanbanerjee commented 6 months ago

This PR Adding the EPI spinal cord segmentation model to SCT adds the EPI segmentation model to SCT