princewang1994 / TextSnake.pytorch

A PyTorch implementation of ECCV2018 Paper: TextSnake: A Flexible Representation for Detecting Text of Arbitrary Shapes
https://arxiv.org/abs/1807.01544
MIT License
437 stars 92 forks source link

RuntimeError: cuda runtime error (11) : invalid argument at /opt/conda/conda-bld/pytorch_1532579805626/work/aten/src/THC/THCGeneral.cpp:663 #36

Closed Shualite closed 5 years ago

Shualite commented 5 years ago

遇到一些问题想请教一下作者。首先是bash download.sh运行失败。索性自己去github地址上面下下来了total-text数据集。然而github上面的totaltext 其gt使用txt标记。于是首先吧txt改为了csv文件,然后修改total-text.py中的parse_mat()函数为如下代码: ''' def parse_csv(self, csv_path): with open(csv_path,'rt', encoding='UTF-8') as row_data: readers = csv.reader(row_data, delimiter=',') data = list(readers)

        polygons = []
        for cell in data:
            x = [int(num) for num in re.findall('\d+', str(cell[0].strip()))]
            y = [int(num) for num in re.findall('\d+', str(cell[1].strip()))]

            text = re.findall('\'([^>]+?)\'', str(cell[3]))[0]
            ori = re.findall('\'([^>]+?)\'', str(cell[2]))[0]

            text = text if len(text)>0 else '#'
            ori = ori if len(ori)>0 else 'c'

            if len(x) < 4:  # too few points
                continue
            pts = np.stack([x, y]).T.astype(np.int32)
            polygons.append(TextInstance(pts, ori, text))

    return polygons

'''

最后这是我的运行结果: ''' aceback (most recent call last): File "eval_textsnake.py", line 123, in main() File "eval_textsnake.py", line 102, in main inference(detector, test_loader, output_dir) File "eval_textsnake.py", line 48, in inference contours, output = detector.detect(image) File "/root/fsy_SceneTextRec/Docker-pytorch0.4.1/TextSnake.pytorch/util/detection.py", line 237, in detect output = self.model(image) File "/opt/conda/lib/python3.6/site-packages/torch/nn/modules/module.py", line 477, in call result = self.forward(*input, kwargs) File "/root/fsy_SceneTextRec/Docker-pytorch0.4.1/TextSnake.pytorch/network/textnet.py", line 47, in forward C1, C2, C3, C4, C5 = self.backbone(x) File "/opt/conda/lib/python3.6/site-packages/torch/nn/modules/module.py", line 477, in call result = self.forward(*input, *kwargs) File "/root/fsy_SceneTextRec/Docker-pytorch0.4.1/TextSnake.pytorch/network/vgg.py", line 92, in forward C1 = self.stage1(x) File "/opt/conda/lib/python3.6/site-packages/torch/nn/modules/module.py", line 477, in call result = self.forward(input, kwargs) File "/opt/conda/lib/python3.6/site-packages/torch/nn/modules/container.py", line 91, in forward input = module(input) File "/opt/conda/lib/python3.6/site-packages/torch/nn/modules/module.py", line 477, in call result = self.forward(*input, **kwargs) File "/opt/conda/lib/python3.6/site-packages/torch/nn/modules/conv.py", line 301, in forward self.padding, self.dilation, self.groups) RuntimeError: cuda runtime error (11) : invalid argument at /opt/conda/conda-bld/pytorch_1532579805626/work/aten/src/THC/THCGeneral.cpp:663 ''' 运行环境是RTX2070,pytorch0.4.1的官方docker,cuda9.0

Shualite commented 5 years ago

@princewang1994 It's my mistake that i download gt with txt format. I do it again, downloading the mat format gt and run the code that clone from you directly, but i still meet this cudaerror

princewang1994 commented 5 years ago

执行那个下载脚本语言科学上网哈,因为数据是在google drive上的,如果终端不能上网建议直接上复制脚本中的地址

另外,那个错误应该是环境导致的,这是在提取特征阶段出问题,可能是普通的卷积都跑不起来,先试一下普通的vgg能不能跑通

Shualite commented 5 years ago

已经科学上网了,还是下不了。然而我到github那个地址上面把两个文件下好,注释掉脚本里面下载的那部分,成功运行。 至于那个cudaerror,电脑的显卡是2070,cuda版本为9.0,这样的环境下出异常。 然而我换到服务器上运行时,一切正常。服务器为1080ti,同样cuda9.0。 原因应该是rtx系列对cuda9的支持问题。