调试Centerface程序时,报错如下
1.错误1
(torch110) root@fb488cec2ed5:/home/work/gaotong/xinying/ZCenterFace/src# python main.py
Traceback (most recent call last):
File "main.py", line 14, in <module>
from models.model import create_model, load_model, save_model
File "/home/work/gaotong/xinying/ZCenterFace/src/lib/models/model.py", line 5, in <module>
import torchvision.models as models
File "/root/anaconda3/lib/python3.7/site-packages/torchvision/__init__.py", line 2, in <module>
from torchvision import datasets
File "/root/anaconda3/lib/python3.7/site-packages/torchvision/datasets/__init__.py", line 9, in <module>
from .fakedata import FakeData
File "/root/anaconda3/lib/python3.7/site-packages/torchvision/datasets/fakedata.py", line 3, in <module>
from .. import transforms
File "/root/anaconda3/lib/python3.7/site-packages/torchvision/transforms/__init__.py", line 1, in <module>
from .transforms import *
File "/root/anaconda3/lib/python3.7/site-packages/torchvision/transforms/transforms.py", line 17, in <module>
from . import functional as F
File "/root/anaconda3/lib/python3.7/site-packages/torchvision/transforms/functional.py", line 5, in <module>
from PIL import Image, ImageOps, ImageEnhance, PILLOW_VERSION
ImportError: cannot import name 'PILLOW_VERSION' from 'PIL' (/root/anaconda3/lib/python3.7/site-packages/PIL/__init__.py)
解决方法:根据报错的最后一行提示,打开function.py文件,
使用from PIL import Image, ImageOps, ImageEnhance, __version__ 替换文件中from PIL import Image, ImageOps, ImageEnhance,PILLOW_VERSION这句。
说白了就是用__version__ 替换原来的PILLOW_VERSION。点击保存即可。
参考博客:https://blog.csdn.net/Lee_lg/article/details/103901632
....................................................................................................
2.错误二
(torch110) root@fb488cec2ed5:/home/work/gaotong/xinying/ZCenterFace/src# python test_wider_face.py
Traceback (most recent call last):
File "test_wider_face.py", line 13, in <module>
from datasets.dataset_factory import get_dataset
File "/home/work/gaotong/xinying/ZCenterFace/src/lib/datasets/dataset_factory.py", line 8, in <module>
from .sample.multi_pose import MultiPoseDataset
File "/home/work/gaotong/xinying/ZCenterFace/src/lib/datasets/sample/multi_pose.py", line 20, in <module>
from torch._six import container_abcs, string_classes, int_classes
ImportError: cannot import name 'container_abcs'
解决方法:torch的版本不对,下载0.4.1出现这个问题,有下载了1.1版就不存在这个问题了
3.错误3
运行测试程序时,nms编译不成功
解决方法:把0.4.1的pytorch升级成1.0.0,都没再编译,就运行成功了
4.错误4
RuntimeError: CUDA out of memory. Tried to allocate 175.88 MiB (GPU 0; 11.17 GiB total capacity; 2.6
解决方法: batchsize设为8,设置为多卡训练,chunk size改成2
5.错误5:
:cannot connect to X server
解决方法:把/sec/lib/detectors/Molti_pose.py脚本中的99行
改成debugger.save_all_imgs(path='/home/work/gaotong/xinying/ZCenterFace/output',genID=True),
path设为自己的路径