Today we introduce the deployment of object recognition yolov7 deployment on Ubuntu
First of all, you need to download Anaconda to create a virtual environment, which is currently the most convenient
Creating a virtual environment does not affect other environments of the machine
1.1conda ‐version # Get the conda version
1.2 conda update conda #Upgrade conda
1.3conda env list (list virtual environment information)
<code>conda create -n <env_name> (创建虚拟环境)# 命令示例conda create -n py38 -yconda create -n py39 python=3.9 -y# 官方推荐使用这种方式conda create -n py39_2 -y && conda install -n py39_2 python=3.9 -y</env_name></code>
Specify the python version when creating the environment, and The results of installing the specified version of python after creating the environment are no different. So why does the official recommend using python=3.9 to specify the python
version when creating the environment? This is because if you want to use python in this virtual environment, you should download python3.9 at the beginning of creating the environment. Then other packages downloaded in this virtual environment will match the dependencies and constraints of python3.9. If you install python3.9 after installing many other packages, dealing with environmental dependencies will become more complicated, and may even lead to some subtle bugs
1.4conda activate
# Command example
conda activate py39
1.5conda deactivate
# Command example
conda deactivate
1.6conda remove -n
# Delete test virtual environment
conda remove -n test --all
conda env list
2.1 List the channels configured in conda, according to the priority from low to high Level arrangement
conda config --get channels
2.2 Add channels, add domestic channels, which is what we often call adding domestic sources
<code>conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/free/conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/conda-forge/conda config --add channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/bioconda/</code>
2.3 Delete channels
<code>方法 1 (通过命令删除):# 首先查看 channelsconda config --get channels# 删除指定的 channelsconda config --remove channels https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud/bioconda/方法 2 (编辑 .condarc 文件删除想要删除 channels 对应的行)vi ~/.condarc</code>
1. conda create -n py python=3.8
Created successfully, enter the virtual environment
conda activate py
2. Download yolov7
You can rewrite this sentence as: "Use the following command to clone WongKinYiu YOLOv7 code base: git clone https://github.com/WongKinYiu/yolov7.git”
Directly download the compressed package https://github.com/WongKinYiu/yolov7.git
After the download is completed, enter the folder
cd yolov7
Install dependencies
pip install -r requirements.txt
Patiently wait for the dependency package to be installed successfully
3. Download the model file
<code>https://github.com/WongKinYiu/yolov7/releases/download/v0.1/yolov7.pthttps://github.com/WongKinYiu/yolov7/releases/download/v0.1/yolov7x.pthttps://github.com/WongKinYiu/yolov7/releases/download/v0.1/yolov7-w6.pthttps://github.com/WongKinYiu/yolov7/releases/download/v0.1/yolov7-e6.pthttps://github.com/WongKinYiu/yolov7/releases/download/v0.1/yolov7-d6.pthttps://github.com/WongKinYiu/yolov7/releases/download/v0.1/yolov7-e6e.pt</code>
and then run
python detect.py --weights yolov7.pt -- conf 0.25 --img-size 640 --source inference/images/horses.jpg
See if there are other modules missing, just download them with pip separately
The above is the detailed content of Artificial intelligence yolov7 target detection is deployed on ubuntu. For more information, please follow other related articles on the PHP Chinese website!