JoHof / lungmask

Automated lung segmentation in CT
Apache License 2.0
646 stars 149 forks source link

model returns zeros as segmentation #63

Closed epb378 closed 2 years ago

epb378 commented 2 years ago

Hi, I have been trying to implement your model (I really like how the repo has been presented and packaged btw!). I follow the steps in the readme and when I input a dicom slice or 3D array I get an empty array (2D or 3D respectively) as the output. Has this been seen before? Any idea why this might be happening?

JoHof commented 2 years ago

Hi Ned,

I don't think this is a common problem. When the input data is a CT scan that shows the lung it should work. The most important things to check:

otherwise... if you send me an example I can have a look

Valeyards commented 2 years ago

Hi Ned,

I don't think this is a common problem. When the input data is a CT scan that shows the lung it should work. The most important things to check:

  • is it actually a CT scan (some people try to put X-rays in which of course doesn't work)
  • are the intensities in correct HU (air should be around -1000)

otherwise... if you send me an example I can have a look

Hi, I came across the same problem and I found out the intensities of scans range from 0 to 1000+, so I deduct 1024 to map the values to be like -1024 to 600, and it fits well on one of the dataset, however the others failed. I also tried to simply replace the normalization part in mask.py and utils.py with (x-min(x))/max(x)-min(x), but it didn't work. I would like to know if there is a way to preprocess on such datasets to adapt to the distribution. Thanks in advance.

epb378 commented 2 years ago

Thanks a lot @JoHof and @Valeyards! I suspected it might be to do with the data range and the preprocessing. I'll play around with that!

epb378 commented 2 years ago

@JoHof Thanks again, thought I'd update to say that this worked when I rescaled the data so that air is -1000!

epb378 commented 2 years ago

@JoHof I

epb378 commented 2 years ago

Wanted to say how great this repo is! Thanks for sharing so well!

JoHof commented 2 years ago

Thanks for the feedback! Highly appreciated 🙂