ValueError: setting an array element with a sequence

深度学习tensorflow框架在训练的时候,sess.run(feed_dict={image: x_tr, label: y_tr, lr: learning_rate})遇到的报错。

我所使用到的解决方案是:

1、图像size大小不匹配(我花了2个小时找,终于解决)

2、图像数量不匹配(我写了一个程序判断图像数量是否对应和包含)

# coding=utf-8
import os
# 将文件A和B中不同的文件找出来
path1=os.getcwd()
images_path='dataset/little_sample/val/labels_binary'
labels_path='dataset/little_sample/val/images'

Image_pathDir = os.listdir(images_path)
len_images=len(Image_pathDir)

labels_pathDir = os.listdir(labels_path)
len_labels=len(labels_pathDir)

image_P = []
label_P = []

num=0
for i in range(len(Image_pathDir)):
    image_name=Image_pathDir[i]
    if image_name not in labels_pathDir:
        num=num+1
        print(image_name)
print(num)
if(num==0):
    print('Labels is same to images ')
else:
    print("Image not match!")


num1=0
for i in range(len(labels_pathDir)):
    image_name=labels_pathDir[i]
    if image_name not in Image_pathDir:
        num1=num1+1
        print(image_name)
print(num1)
if num1==0:
    print('Images is same to labels')
else:
    print("Image not match!")

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值