frankkramer-lab / MIScnn

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

Errors during the predicting #153

Closed ShaniaShan closed 2 years ago

ShaniaShan commented 2 years ago

Hi Thank you for your amazing library!

I am trying it on my dataset (.png grayscale images and binary classification), the training is good but something is wrong during the prediction. The errors are below:

Make prediction for test set

model.predict(sample_list[0:2])


TypeError Traceback (most recent call last) in () 1 # Make prediction for test set ----> 2 model.predict(sample_list[0:2])

1 frames /usr/local/lib/python3.7/dist-packages/miscnn/neural_network/model.py in predict(self, sample_list, return_output, activation_output) 176 sampleObj = self.preprocessor.cache.pop(sample) 177 pred_seg = self.preprocessor.postprocessing(sampleObj, pred_seg, activation_output) --> 178 # Backup predicted segmentation 179 if return_output : results.append(pred_seg) 180 else :

/usr/local/lib/python3.7/dist-packages/miscnn/processing/preprocessor.py in postprocessing(self, sample, prediction, activation_output) 218 # Run Subfunction postprocessing on the prediction 219 for sf in reversed(self.subfunctions): --> 220 prediction = sf.postprocessing(sample, prediction, activation_output) 221 # Return postprocessed prediction 222 return prediction

TypeError: postprocessing() takes 3 positional arguments but 4 were given

ShaniaShan commented 2 years ago

I found out why the error happened. I ran "RetinalSeg.student.ipynb" on my dataset. In class ChangeValues(Abstract_Subfunction), def postprocessing(self, sample, prediction) should should be modified to def postprocessing(self, sample, prediction, activation_output). Hope this will help someone.

Thanks to Dominik for the wonderful repository.