frankkramer-lab / MIScnn

A framework for Medical Image Segmentation with Convolutional Neural Networks and Deep Learning
GNU General Public License v3.0
400 stars 116 forks source link

Skip condition for only-background samples using patchwise_skip_blanks #81

Open LHJ97 opened 3 years ago

LHJ97 commented 3 years ago

Hi,

I tried to implement Miscnn on my own dataset and i set the patchwise_skip_blanks=True. However, I got the error below:

line 324, in analysis_patchwise_crop pointer = np.random.randint(0, len(patches_img))

File "mtrand.pyx", line 747, in numpy.random.mtrand.RandomState.randint

File "_bounded_integers.pyx", line 1254, in numpy.random._bounded_integers._rand_int64

ValueError: low >= high

Can you tell me how this error occurs? I suspect that the len(patches_img)=0 but I am not sure.

Thanks, LHJ97

muellerdo commented 3 years ago

Hey @LHJ97,

I apologize for the late response.

Mhm, you are right. Looks like the number of patches is zero.

It could be that somehow empty batches are generated due to illogical configuration or a bug in the implementation. Is it possible that you could provide some reproducible example for this error?

Cheers, Dominik

LHJ97 commented 3 years ago

Hi,

I verified. The problem is due to a sample in my training dataset does not contain any positive object, hence empty batches are generated for this sample. Can we add a verifying condition, like if the sample does not contain any positive object, we skip this sample and pass to the next one?

Cheers, LHJ