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]
1
  • check this question. Commented Sep 13, 2022 at 16:35

1 Answer 1

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)
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.