【问题标题】:InvalidArgumentError: Graph execution error: --using TensorFlowInvalidArgumentError:图形执行错误:--使用 TensorFlow
【发布时间】:2022-09-24 19:30:09
【问题描述】:

我正在尝试训练我的模型ssd_mobilenet_v2_fpnlite_320x320_coco17_tpu-8.tar.gz,不幸的是,这就是我得到的。
有人对此有解决方案吗?

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]
  • 检查this 问题。

标签: tensorflow argument-error


【解决方案1】:

该问题很可能与非 RGB 图像有关。在加载任何图像之前,请确保将它们转换为 RGB(3 通道)。

请使用以下代码查看哪个图像不是RGB模式并删除它。

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)

【讨论】:

    猜你喜欢
    • 2022-07-12
    • 2022-06-18
    • 1970-01-01
    • 2022-06-13
    • 2017-12-02
    • 2022-07-20
    • 2023-01-24
    • 1970-01-01
    • 2017-05-02
    相关资源
    最近更新 更多