kaggle_ndsb2017 icon indicating copy to clipboard operation
kaggle_ndsb2017 copied to clipboard

One question about helpers.py

Open hanxiaozhen2017 opened this issue 6 years ago • 2 comments

Hi Julian,

Your work is amazing and thanks so much for sharing.

For learning purpose, I am reading your code line by line. Can I ask you one quick and simple question? In helper.py, why you use number 127 and 255? Please see the code for reference below. Thanks so much!!!!

def compute_dice(label_img, pred_img, p_threshold=0.5): p = pred_img.astype(numpy.float) l = label_img.astype(numpy.float) if p.max() > 127: p /= 255. if l.max() > 127: l /= 255.

hanxiaozhen2017 avatar Dec 11 '18 21:12 hanxiaozhen2017

Hello Thanks, Just my laziness. Usually images have a value range from 0-255 and I sometimes just use 0-255 as train target. But for Dice you need range 0-1. It's just input sanitization.

juliandewit avatar Dec 22 '18 20:12 juliandewit

Many thanks Julian! Happy new year!

hanxiaozhen2017 avatar Jan 03 '19 19:01 hanxiaozhen2017