tensorflow python framework erros invalidArgmentError

在使用TensorFlow Python框架时遇到了InvalidArgumentError,原因是批次中的图像形状不一致。问题出在图像格式,解决方案是将所有图像转换为RGB格式。参考某博客,通过cv2库进行转换,但可能会导致图像背景颜色变化。目前该问题尚未找到完美解决方案。
摘要由CSDN通过智能技术生成

问题描述

tensorflow python framework erros invalidArgmentError:connot batch tensors with different shapes in componet 0. First element had shape [227,227,3] and element 19 had shape [227,227,4]
解决办法:数据集图像格式不对;convert(‘RGB’)

解决代码:

import numpy as np
from PIL import Image
import os
import cv2

directory_name='./flower_data/flower_photos/321'


for filename in os.listdir(director
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值