Comments (19)
可以贴一下详细的错误信息吗
from ocr.pytorch.
我觉得应该还是trans.py对图像处理过程出了问题,可能输入的图像本身长或宽不够,造成resize后的图像长或宽小于等于了0。但是这应该如何修改呢?
from ocr.pytorch.
from ocr.pytorch.
一个简单粗暴的方法是在mydataset.py文件中把__getitem__中的代码加一个try catch,就比如用下面的代码替换一下
def __getitem__(self, index): try: img = Image.open(self.files[index]) if self.transform is not None: img = self.transform( img ) img = img.convert('L') label = self.labels[index] if self.target_transform is not None: label = self.target_transform( label ) return (img,label) except: return self.__getitem__(np.random.randint(self.__len__()))
from ocr.pytorch.
emmm插入的代码不知道为啥排版不太好,重新发一下吧:
def getitem(self, index):
try:
img = Image.open(self.files[index])
if self.transform is not None:
img = self.transform( img )
img = img.convert('L')
label = self.labels[index]
if self.target_transform is not None:
label = self.target_transform( label )
return (img,label)
except:
return self.getitem(np.random.randint(self.len()))
就是在原来的基础上加一个try catch如果有异常则重新换一个
from ocr.pytorch.
谢谢您的指点,不过我加入了异常处理后又出现了新的错误,您能否帮我看一下是什么原因?我还需要修改哪些地方?
from ocr.pytorch.
这个问题应该是在验证集上测试的时候报的错,看着似乎是模型时cpu上的 输入的图像是gpu上的造成的,你是在cpu上训练的吗?
正常在GPU上训练的话,不会出现这样的情况。。
from ocr.pytorch.
不好意思,我发现config没有调回来,这应该是CPU上训练的结果,我如果在CPU上训练需要对测试的代码进行什么改动呢?我现在GPU出现了一些状况没办法输出运行结果,等拿到出错信息后我再给您看。
from ocr.pytorch.
在训练代码中找到这一行num_correct, num_all = val_model(config.val_infofile,net,True,log_file='compare-'+config.saved_model_prefix+'.log'),
把True改成False
from ocr.pytorch.
谢谢作者大佬,CPU上的运行已经没有问题了,但是在GPU上训练时输入某些图片还会出错,我把一张出错的图片放在下面,您能帮我看一下为什么会报错吗?
from ocr.pytorch.
从图片上看不出问题啊,报的什么错呢?异常处理也解决不了吗?
from ocr.pytorch.
因为我是连服务器上运行的,一到这种图片服务器就把我kill了,而且没有错误信息,用nohup指令也没法把错误信息输出来。您能否试一下这张图片有没有什么问题?非常感谢!
from ocr.pytorch.
你好,我这边暂时也没有空余的GPU服务器没法再GPU上测试,不过我在本地测试了一下这张图似乎没啥问题,我在想是不是因为路径什么的有错误,其他的我也说不上来什么原因。
我觉得至少得有点错误信息才能看看是哪个环节有问题,或者你在那个try catch的地方让它在catch之后把捕捉的错误打出来看看。
from ocr.pytorch.
好的,谢谢您的帮助,我再想想办法。不过奇怪的是这张图片在CPU模型里没有问题,到了GPU就出问题了。
from ocr.pytorch.
大佬您好,我让朋友帮我测试了一下,他遇到了一个奇怪的问题,但是感觉这个错误比较奇怪,如果是这种错误感觉我之前不可能跑通,为什么会遇到这种问题呢?
from ocr.pytorch.
顺带一问,我在CPU训练的检测部分遇到了outputsize过小的问题,这有办法解决吗?
from ocr.pytorch.
大佬您好,我让朋友帮我测试了一下,他遇到了一个奇怪的问题,但是感觉这个错误比较奇怪,如果是这种错误感觉我之前不可能跑通,为什么会遇到这种问题呢?
应该是pytorch版本的问题,比较早的版本没有这个zero_infinity参数
from ocr.pytorch.
抱歉,从图中看不出outputsize过小的问题
from ocr.pytorch.
作者大佬您好,我在cpu上训练时基本上不会出现错误,但是在训练到第二个epoch时速度就会变得非常慢,基本上处在停滞状态,这可能是因为什么引起的?
from ocr.pytorch.
Related Issues (20)
- inference for batch?
- 提供的CRNN模型不可用
- CRNN数据集
- CRNN出现str不可用,不知道该怎么修改,求赐教 HOT 7
- crnn训练的时候出现损失在140多,精度为0 HOT 1
- 关于重新训练自己的数据集,预测为空的问题 HOT 1
- I made a pytorch-lightning implementation of your CTPN HOT 2
- crnn.py中看到有好几个不同的crnn模型 HOT 2
- 能否说说怎么返回识别出的文字的在原图中的坐标位置?
- CRNN可以用在Khmer语言吗? HOT 1
- CRNN这个是怎么回事?Aborted (core dumped)
- 请问用合成数据集训练新的模型时,遇到无法读取infofile中的fname和label的问题怎么解决呢?
- Is there any option for language?
- need help for training with custom images
- 你好,有没有日文的crnn checkpoints ?微信nlanguage?
- CRNN数据集制作方法 HOT 2
- 请问crnn识别的准确率怎么看啊
- 在运行demo的时候遇到了一个问题,输出的都是大写英文字母
- export to onnx model
- Is pretrained CRNN bias towards Chinese character?
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from ocr.pytorch.