whai362 / PSENet

Official Pytorch implementations of PSENet.
Apache License 2.0
1.17k stars 344 forks source link

TypeError: function takes exactly 5 arguments (1 given)如何解决呀? #165

Open LKCN opened 3 years ago

LKCN commented 3 years ago

Traceback (most recent call last): File "E:/WangJianFeng/2020/TextDetection/PSENet/train_ic15.py", line 285, in main(args) File "E:/WangJianFeng/2020/TextDetection/PSENet/train_ic15.py", line 253, in main train_loss, train_te_acc, train_ke_acc, train_te_iou, train_ke_iou = train(train_loader, model, dice_loss, optimizer, epoch) File "E:/WangJianFeng/2020/TextDetection/PSENet/train_ic15.py", line 112, in train for batch_idx, (imgs, gt_texts, gt_kernels, training_masks) in enumerate(train_loader): File "D:\Anaconda3\envs\pytorch_gpu\lib\site-packages\torch\utils\data\dataloader.py", line 345, in next data = self._next_data() File "D:\Anaconda3\envs\pytorch_gpu\lib\site-packages\torch\utils\data\dataloader.py", line 856, in _next_data return self._process_data(data) File "D:\Anaconda3\envs\pytorch_gpu\lib\site-packages\torch\utils\data\dataloader.py", line 881, in _process_data data.reraise() File "D:\Anaconda3\envs\pytorch_gpu\lib\site-packages\torch_utils.py", line 395, in reraise raise self.exc_type(msg) TypeError: function takes exactly 5 arguments (1 given)

BigWhit commented 3 years ago

I met the same problem. Did you fix it?

RoseSakurai commented 3 years ago

看起来像是dataloader有问题,请帖上更多代码或者自己查查看。

As-David commented 3 years ago

检查一下checkpoint和图片路径是否正确,把num_worker设置成0试试

wlsh1up commented 3 years ago

同样的问题已经解决.
搜索的是docker引起的莫名其妙的错误. 可能是我用的集群分给给每个用户是docker虚拟出来的 解决方法: https://github.com/whai362/PSENet/blob/4d95395658662f2223805c36dcd573d9e190ce26/train.py#L158 改为 num_workers=0

运行后出现另外一个新错误. UnicodeDecodeError: 'ascii' codec can't decode byte 0xef in position 0: ordinal not in range(128) 卸载旧版本mmcv,安装最新版本的mmcv即可 pip uninstall mmcv pip install mmcv

解决完后,就能正常运行了..然后把num_worker改为gpu_num整数倍也没问题了