Search code examples
tensorflowconv-neural-networktraining-data

Grayscale input image for SSD detector in Tensorflow Detection API


I'm creating a dataset of images to train a detector using Tensoflow Detection API (SSD/MobileNet).

Images are grayscale but it seems the input should be RGB image.

Do I need to convert grayscale images to a three channel RGB by just copying first channel to two other channels? (If yes, is there any software for doing this?) or Two other channel should be empty? (Is there any software for doing this?)

Best regards.


Solution

  • Yes, you have to convert your grayscale images to RGB images.

    A possible solution is to use OpenCV:

    import cv2
    
    # suppose that gray_img is your grayscale image
    input = cv2.cvtColor(gray_img, cv2.COLOR_GRAY2RGB)
    

    Now you can use input as a valid input image for your model