0

I am trying to train my model, ssd_mobilenet_v2_fpnlite_320x320_coco17_tpu-8.tar.gz, unfortunately, this is what I got.
Does anyone have a solution for this?

InvalidArgumentError: Graph execution error:

image_size must contain 3 elements[4]
         [[{{node RandomCropImage/sample_distorted_bounding_box/SampleDistortedBoundingBoxV2}}]]
         [[MultiDeviceIteratorGetNextFromShard]]
         [[RemoteCall]]
         [[while/body/_1/IteratorGetNext]] [Op:__inference__dist_train_step_51958]
Kaveh
  • 4,618
  • 2
  • 20
  • 33
  • check [this](https://stackoverflow.com/questions/71153492/invalid-argument-error-graph-execution-error) question. – Sadra TMH Sep 13 '22 at 16:35

1 Answers1

1

The issue is most likely related to images that are not RGB. Before loading any images, make sure to convert them to RGB (3 channels).

Please use the following code to see which image is not in RGB mode and delete it.

from PIL import Image     
import os       
path = 'PATH TO THE IMAGES' 
for file in os.listdir(path):      
     extension = file.split('.')[-1]
     # image extension could be png, jpg, etc 
     if extension == 'jpg':   
           filepath = path+file
           img = Image.open(filepath)
           if img.mode != 'RGB':
                 print(file+', '+img.mode)