Python deep learning solves the error problem encountered 2

Table of contents

1. Solve the error UnicodeDecodeError: 'utf-8' codec can't decode byte 0xe3 in position 15: invalid continuation byte

二、解决ERROR: Could not build wheels for pycocotools, which is required to install pyproject.toml-based pro

3. Solve OSError: [WinError 1314] The client does not have the required privileges. : 'D:\\my\\else\\code-learning2\\python-study\\deep-learning\\network\\yolo\\Yolov5_for_PyTorch-master\\Yolov5_for_PyTorch-master\\coco\\train2017' -> './images/train2017'

四、解决RuntimeError: PytorchStreamReader failed reading zip archive: failed finding central directory


1. Solve the error UnicodeDecodeError: 'utf-8' codec can't decode byte 0xe3 in position 15: invalid continuation byte

Problem : Unrecognized characters appear, causing the model file to fail to load, and this unrecognized character is the 15th character.

# 读取验证集csv
X_valid = pd.read_csv("./database/X_valid.csv", index_col=0)
y_valid = pd.read_csv("./database/y_valid.csv", index_col=0)

The error is as follows, 

Reason : In fact, it is because utf-8 cannot decode the path characters of the model file passed in this code.

Solution: The path of the model file contains  Chinese  , which causes the decoding to fail. Specifically, the folder storing the model is in Chinese. After changing the folder to  English  , the code runs successfully.

二、解决ERROR: Could not build wheels for pycocotools, which is required to install pyproject.toml-based pro

Problem : An error is reported when installing pycocotools,

Cause : The root error lies in Microsoft Visual C++ 14.0 or greater is required. 

Solution: We can install Microsoft C++ Build Tools directly without installing Visual Studio.

(1) Download address: http://my.visualstudio.com/, first, log in to your account and click to enter the download page. Next, search for Build Tools for Visual Studio 2015 with Update 3 on the download page,

Address: Downloads - Visual Studio Subscriptions Portal

In the search results, click Visual Studio 2015 update 3 and download the corresponding file, which is about 1.1G. Here you need to change the format to DVD. 

(2) After the download is complete, we got the file mu_visual_cpp_build_tools_2015_update_3_x64_dvd_dfd9a39c.iso,

Double-click to open, and then double-click VisualCppBuildTools_Full.exe to install automatically.

start installation,

(3) After installation, you can use pip to install the corresponding package normally.

pip install  -i https://pypi.tuna.tsinghua.edu.cn/simple pycocotools

 OK, solved.

3. Solve OSError: [WinError 1314] The client does not have the required privileges. : 'D:\\my\\else\\code-learning2\\python-study\\deep-learning\\network\\yolo\\Yolov5_for_PyTorch-master\\Yolov5_for_PyTorch-master\\coco\\train2017' -> './images/train2017'

Solution : run pycharm as an administrator, and then re-run the training command.

四、解决RuntimeError: PytorchStreamReader failed reading zip archive: failed finding central directory

question:

Reason :

  1. During model training, the pytorch version is inconsistent with the currently used pytorch version and cannot be well compatible.
  2. The original model was damaged.

Solution:

  1. During model training, the pytorch version is inconsistent with the currently used pytorch version and cannot be well compatible.
  2. The original model is damaged: the pre-training model file is damaged or the pre-training parameter file is damaged. It is ok to find and replace it.

Indeed, I trained the model first, and kept the model parameters in a .ph file before testing. I read online that it was because the original model was damaged, and then I guessed that it was because of the damaged .ph file. After retraining the model, it will be fine.

Guess you like

Origin blog.csdn.net/qq_45956730/article/details/131403405