Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CTC计算出来的loss非常大,大于60的loss, 不知道哪里出了问题 #72

Open
joeqincai opened this issue Oct 15, 2019 · 10 comments

Comments

@joeqincai
Copy link

No description provided.

@ShangLe0607
Copy link

你好,请教一下,我运行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
请问这是什么原因呢

@joeqincai
Copy link
Author

joeqincai commented Oct 15, 2019 via email

@ShangLe0607
Copy link

@joeqincai 谢谢您,但是我试了试jpg格式还是同样的结果---、not valid image

@joeqincai
Copy link
Author

你使用绝对路径去读一张图片试一下,我采用的是lmdb保存图片路径的方式,而不是保存图片字符串来做的

@ShangLe0607
Copy link

@joeqincai
改成了这种保存全路径的方式,还是同样的结果

@joeqincai
Copy link
Author

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 = six.BytesIO()
# 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)

@joeqincai
Copy link
Author

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 = six.BytesIO() # 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)

@joeqincai
Copy link
Author

你需要先确定这个错误是在哪一句代码报错来的,然后再去尝试修复

@ShangLe0607
Copy link

我这个要得到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]#

@joeqincai
Copy link
Author

1、你要用编译器单步调试跟进去去看,在哪一句话报了这个错误;
2、能生成lmdb文件并不代表生成的就是你想要的

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants