rykov8 / ssd_keras

Port of Single Shot MultiBox Detector to Keras
MIT License
1.1k stars 553 forks source link

Generator generate function and preprocess_input function #122

Open stavBodik opened 6 years ago

stavBodik commented 6 years ago

Hello , I am using the Generator class for generating input for the SSD machine . I have couple of question please ,

My input images are gray scale but loaded with 3 channels with gray same level, the generator doing the next steps for an input image :

  1. Input image : figure_5

  2. self.random_sized_crop(np.array(img), y) figure_6

  3. imresize(img, self.image_size).astype('float32') figure_7

  4. preprocess_input(tmp_inp) figure_8

Questions : A. The random_sized_crop is cutting the the original image which causes lose of information , Why this step is needed ? is this due to the need for converting the image to float32 ? and what about the lose of image information ? I should not label things in this place which is catted ?

B. preprocess_input is made for RGB images ,and doing next thing :

a. convert to BGR (because of VGG16(open cv)) b. Zero-center by mean pixel , can any one explain me this step ? c. should I use preprocess_input in my case ?

D. Where can I read about all this preprocess and why its done ? E. Is inputting image like in step 4 can decrease the detection results ?

Thanks !