JDSobek / MedYOLO

A 3D bounding box detection model for medical data.
GNU Affero General Public License v3.0
35 stars 8 forks source link

The bounding boxes generated by nifti_utils.py were much larger. #20

Open NGYLK opened 2 weeks ago

NGYLK commented 2 weeks ago

Hello, thank you for your contribution. I encountered two issues during the model training process.

Firstly, in my initial training, I aimed to detect cancerous lesions in the prostate. The input images were prostate images, and the label files were the lesions. However, after 1000 iterations, the results were very poor, with all printed results being zero at the 999th iteration. I suspect that this model might be more suitable for detecting larger volumes.

Secondly, I shifted my focus to detecting the prostate organ itself. Before training, I ran the nifti_utils.py file to verify if the MedYOLO labels marked the correct positions. However, the generated labels were significantly different from the ones I generated with my own code. The bounding boxes generated by nifti_utils.py were much larger. When I converted the txt files to nii.gz files myself, the labels were accurate. As shown in the image, what could be the reason for this discrepancy?

I would greatly appreciate it if you could answer my questions. image

JDSobek commented 2 weeks ago

I suspect that this model might be more suitable for detecting larger volumes.

This matches my experience. My suspicion is that the architecture (which has a few downsampling steps) prevents small volumes from propagating to deeper layers in the network. MedYOLO did show some detection of prostate in one of the datasets I tested it on, but prostate was a rare occurrence in that dataset so I can't say anything definitive about how well it performs.

However, the generated labels were significantly different from the ones I generated with my own code. The bounding boxes generated by nifti_utils.py were much larger

nifti_utils.py isn't a super robust example script, but I think the edge cases should mostly be in multi-label problems. Can you share the code you used to create your labels and the code you used to convert them to bounding box masks? There may be a mistake in how you save the labels that your conversion code reverts, which the naive conversion nifti_utils.py does won't respond to.

My initial guess is that the voxel lengths you're using in the mask -> txt and txt -> mask are the wrong lengths. E.G. instead of dividing the length of the ROI by the length of the original nifti image you're dividing it by some other length.