Open joeqincai opened 5 years ago
说明这个图片没有读进来,你换其它格式的图片试试看------------------ 原始邮件 ------------------ 发件人: "ShangLe0607"notifications@github.com 发送时间: 2019年10月15日(星期二) 下午5:53 收件人: "AstarLight/Lets_OCR"Lets_OCR@noreply.github.com; 抄送: "joeqincai"827173695@qq.com;"Author"author@noreply.github.com; 主题: Re: [AstarLight/Lets_OCR] CTC计算出来的loss非常大,大于60的loss, 不知道哪里出了问题 (#72)
你好,请教一下,我运行create_lmdb_dataset.py出现not a valid image
戴志 /opt/crnn/images/9998.png is not a valid image /opt/crnn/images/9999.png 窦君晶 /opt/crnn/images/9999.png is not a valid image Created dataset with 0 samples 请问这是什么原因呢
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or unsubscribe.
@joeqincai 谢谢您,但是我试了试jpg格式还是同样的结果---、not valid image
你使用绝对路径去读一张图片试一下,我采用的是lmdb保存图片路径的方式,而不是保存图片字符串来做的
@joeqincai 改成了这种保存全路径的方式,还是同样的结果
def getitem(self, index): assert index <= len(self), 'index range error' index += 1 with self.env.begin(write=False) as txn: img_key = 'image-%09d' % index imgbuf = txn.get(img_key.encode()) imgAbsPath = imgbuf.decode()
# buf.write(imgbuf)
# buf.seek(0)
try:
#img = Image.open(buf)
img = Image.open(imgAbsPath).convert('L')
except IOError:
print('Corrupted image for %d' % index)
return self[index + 1]
if self.transform is not None:
img = self.transform(img)
label_key = 'label-%09d' % index
label = txn.get(label_key.encode())
if self.target_transform is not None:
label = self.target_transform(label)
return (img, label)
` def getitem(self, index): assert index <= len(self), 'index range error' index += 1 with self.env.begin(write=False) as txn: img_key = 'image-%09d' % index imgbuf = txn.get(img_key.encode()) imgAbsPath = imgbuf.decode()
# buf.write(imgbuf)
# buf.seek(0)
try:
#img = Image.open(buf)
img = Image.open(imgAbsPath).convert('L')
except IOError:
print('Corrupted image for %d' % index)
return self[index + 1]
if self.transform is not None:
img = self.transform(img)
label_key = 'label-%09d' % index
label = txn.get(label_key.encode())
if self.target_transform is not None:
label = self.target_transform(label)
return (img, label)`
你需要先确定这个错误是在哪一句代码报错来的,然后再去尝试修复
我这个要得到test_lmdb和train_lmda的那个程序,结果是这样子,但确实能得到test_lmdb和train_lmda两个文件加,可是运行结果说是图片是无效,但整个程序并没有报错,
俞园翰 /opt/crnn/images/8996.jpg is not a valid image /opt/crnn/images/8997.jpg 邵娴 /opt/crnn/images/8997.jpg is not a valid image /opt/crnn/images/8998.jpg 苗茗 /opt/crnn/images/8998.jpg is not a valid image /opt/crnn/images/8999.jpg 云姣谦 /opt/crnn/images/8999.jpg is not a valid image Created dataset with 0 samples [root@localhost lib]#
1、你要用编译器单步调试跟进去去看,在哪一句话报了这个错误; 2、能生成lmdb文件并不代表生成的就是你想要的
你好,请教一下,我运行create_lmdb_dataset.py出现not a valid image
戴志 /opt/crnn/images/9998.png is not a valid image /opt/crnn/images/9999.png 窦君晶 /opt/crnn/images/9999.png is not a valid image Created dataset with 0 samples 请问这是什么原因呢