GeorgeSeif / Semantic-Segmentation-Suite

Semantic Segmentation Suite in TensorFlow. Implement, train, and test new Semantic Segmentation models easily!
2.5k stars 880 forks source link

Input image pre-processing #167

Open ryohachiuma opened 5 years ago

ryohachiuma commented 5 years ago

Information

Hi, thank you for implementing the awesome project! I would like to use this project to the competition. I have two questions about the preprocessing of input images during training and validation.

Describe the problem

  1. At line 183 in train.py, an input image is divided by 255.0.

    input_image = np.float32(input_image) / 255.0

    However, for Resnet, the input image is pre-processed with the per-pixel mean subtracted. (https://arxiv.org/pdf/1512.03385.pdf). Is there any reason to divide the pixel by 255?

  2. At line 238 in train.py, an input image is cropped with crop_height and crop_width.

    input_image = np.expand_dims(np.float32(utils.load_image(val_input_names[ind])[:args.crop_height, :args.crop_width]),axis=0)/255.0

    Is it "common" way to crop images at the test (validation) step? I thought at the test step, the image should be inputted into the network directly. (https://github.com/rishizek/tensorflow-deeplab-v3-plus/blob/master/inference.py)