[捉虫笔记]PaddleDetection训练报错与对应

错误

今天在AI Stuido上训练PaddleDetection项目的时候报出了如下错误:

2020-09-27 14:35:18,743-INFO: Decompressing /home/aistudio/.cache/paddle/weights/ResNet101_vd_pretrained.tar...
Traceback (most recent call last):
  File "tools/train.py", line 370, in <module>
    main()
  File "tools/train.py", line 198, in main
    checkpoint.load_and_fusebn(exe, train_prog, cfg.pretrain_weights)
  File "/home/aistudio/PaddleDetection/ppdet/utils/checkpoint.py", line 216, in load_and_fusebn
    path = _get_weight_path(path)
  File "/home/aistudio/PaddleDetection/ppdet/utils/checkpoint.py", line 78, in _get_weight_path
    path = get_weights_path(path)
  File "/home/aistudio/PaddleDetection/ppdet/utils/download.py", line 97, in get_weights_path
    path, _ = get_path(url, WEIGHTS_HOME)
  File "/home/aistudio/PaddleDetection/ppdet/utils/download.py", line 215, in get_path
    _decompress(fullname)
  File "/home/aistudio/PaddleDetection/ppdet/utils/download.py", line 342, in _decompress
    tf.extractall(path=fpath_tmp)
  File "/opt/conda/envs/python35-paddle120-env/lib/python3.7/tarfile.py", line 2002, in extractall
    numeric_owner=numeric_owner)
  File "/opt/conda/envs/python35-paddle120-env/lib/python3.7/tarfile.py", line 2044, in extract
    numeric_owner=numeric_owner)
  File "/opt/conda/envs/python35-paddle120-env/lib/python3.7/tarfile.py", line 2114, in _extract_member
    self.makefile(tarinfo, targetpath)
  File "/opt/conda/envs/python35-paddle120-env/lib/python3.7/tarfile.py", line 2163, in makefile
    copyfileobj(source, target, tarinfo.size, ReadError, bufsize)
  File "/opt/conda/envs/python35-paddle120-env/lib/python3.7/tarfile.py", line 249, in copyfileobj
    raise exception("unexpected end of data")
tarfile.ReadError: unexpected end of data

对策

进入报错中提到的预训练权重那个文件夹,发现里面是有这个文件的。那么,猜想有可能是自动下载的这个文件有什么问题。所以,把这个文件重命名一下。这样之后重新训练的时候,应该可以重新下载。

aistudio@jupyter-92276-1027892:~/.cache/paddle/weights$ ll
total 40972
drwxr-xr-x 3 aistudio aistudio     4096 Sep 27 14:35 ./
drwxr-xr-x 4 aistudio aistudio     4096 Sep 26 23:34 ../
-rw-r--r-- 1 aistudio aistudio 41943040 Sep 26 23:51 ResNet101_vd_pretrained.tar
drwxr-xr-x 3 aistudio aistudio     4096 Sep 27 14:35 tmp/
aistudio@jupyter-92276-1027892:~/.cache/paddle/weights$ mv ResNet101_vd_pretrained.tar ResNet101_vd_pretrained.tar.bak 
aistudio@jupyter-92276-1027892:~/.cache/paddle/weights$

结果

之后,重新训练,果然问题得以解决。
总结一下,当发生临时文件相关问题时,可以删除临时文件,重新取得。往往可以快速的解决问题。

你可能感兴趣的:(深度学习)