Open szzwy opened 4 months ago
你好,我认为是数据集没能正确导入的问题。请检查图像维度是否正确,这可以在out_cls, out_regr = model(imgs)加上print(imgs.size())来看图像是否为[1, 3, hight, wide],若不是,则说明输入的图像维度有问题,这可能需要在数据预处理或数据加载处做修改。
好的,明天我重新装一下后试一下,楼主你的环境py、tf、pytroch、cuda是什么版本的呀
你好,我的环境分别是python:3.10,tensorflow:2.14.0,pytorch:1.13.1+cpu,没有安装cuda,我是用电脑cpu训练的。
你好楼主,我换了个服务器,分别用无卡模式和3090跑,测试代码里自带的数据集没问题,换成我的数据集就报错了:
Traceback (most recent call last):
File "train.py", line 86, in
我分别打开了自带的和我自己的标注json文件,我这样的json文件是不是有问题应该换一个标注软件?
你好,不好意思,昨日有点忙,没能及时回复你。你的json文件没有问题,但由于你json文件里的标注框(即第二张图片中points的内容)给出的是四个点,而本项目的json文件的标注框只有两点,所以你需要修改dataset.py中readxml函数中x2, y2 = points[1],把其修改为x2, y2 = points[2],即确保读入的标注框坐标为左上角和右下角两点。
感谢楼主您在忙碌之中抽空回复,根据楼主的提示修改已经成功了!非常感谢!: ) ![Uploading screenshot-1714293824590.png…]()
有一个问题是跑完之后貌似有什么缓存之类的东西没有自动删除,我的磁盘空间快爆满了T_T
楼主我OK了,找到服务器里的缓存文件了 :)
Traceback (most recent call last): File "/mnt/workspace/OCR-Invoice_Identification/train_code/ctpn_train_code/train.py", line 106, in
out_cls, out_regr = model(imgs)
File "/opt/conda/lib/python3.10/site-packages/torch/nn/modules/module.py", line 1518, in _wrapped_call_impl
return self._call_impl(*args, kwargs)
File "/opt/conda/lib/python3.10/site-packages/torch/nn/modules/module.py", line 1527, in _call_impl
return forward_call(*args, *kwargs)
File "/mnt/workspace/OCR-Invoice_Identification/train_code/ctpn_train_code/ctpn/ctpn.py", line 127, in forward
x = self.base_layers(x)
File "/opt/conda/lib/python3.10/site-packages/torch/nn/modules/module.py", line 1518, in _wrapped_call_impl
return self._call_impl(args, kwargs)
File "/opt/conda/lib/python3.10/site-packages/torch/nn/modules/module.py", line 1527, in _call_impl
return forward_call(*args, kwargs)
File "/opt/conda/lib/python3.10/site-packages/torch/nn/modules/container.py", line 215, in forward
input = module(input)
File "/opt/conda/lib/python3.10/site-packages/torch/nn/modules/module.py", line 1518, in _wrapped_call_impl
return self._call_impl(*args, *kwargs)
File "/opt/conda/lib/python3.10/site-packages/torch/nn/modules/module.py", line 1527, in _call_impl
return forward_call(args, kwargs)
File "/opt/conda/lib/python3.10/site-packages/torch/nn/modules/conv.py", line 460, in forward
return self._conv_forward(input, self.weight, self.bias)
File "/opt/conda/lib/python3.10/site-packages/torch/nn/modules/conv.py", line 456, in _conv_forward
return F.conv2d(input, weight, bias, self.stride,
RuntimeError: Expected 3D (unbatched) or 4D (batched) input to conv2d, but got input of size: [0]
是我环境的问题吗
_Originally posted by @szzwy in https://github.com/Cooduck/OCR-Invoice_Identification/issues/1#issuecomment-2076874191_