文章目录
- Linux安装环境
- python
- insightface环境
- 训练数据集准备
- todo
- 训练
Linux安装环境
python
我的cuda版本11.6:
$ nvcc --version
nvcc: NVIDIA (R) Cuda compiler driver
Copyright (c) 2005-2022 NVIDIA Corporation
Built on Tue_Mar__8_18:18:20_PST_2022
Cuda compilation tools, release 11.6, V11.6.124
Build cuda_11.6.r11.6/compiler.31057947_0
miniconda更换源:
vim ~/.condarc
channels:
- https://mirrors.ustc.edu.cn/anaconda/pkgs/main/
- https://mirrors.ustc.edu.cn/anaconda/pkgs/free/
- https://mirrors.ustc.edu.cn/anaconda/cloud/conda-forge/
ssl_verify: true
show_channel_urls: true
default_channels:
- https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main
- https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/r
- https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/msys2
custom_channels:
conda-forge: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
msys2: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
bioconda: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
menpo: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
pytorch: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
pytorch-lts: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
simpleitk: https://mirrors.tuna.tsinghua.edu.cn/anaconda/cloud
创建新的python环境:
conda create -n py38_cc python=3.8 -y && conda activate py38_cc
为了目前的兼容性,下载pytorch v1.12.1,https://pytorch.org/get-started/previous-versions/
conda install pytorch==1.12.1 torchvision==0.13.1 torchaudio==0.12.1 cudatoolkit=11.6 -c pytorch -c conda-forge
或者
pip install torch==1.12.1+cu116 torchvision==0.13.1+cu116 torchaudio==0.12.1 --extra-index-url https://download.pytorch.org/whl/cu116
等的时间太长,也可以加个自己的proxy:
export http_proxy=http://127.0.0.1:10809
export https_proxy=https://127.0.0.1:10809
conda config --set proxy_servers.http http://127.0.0.1:10809
conda config --set proxy_servers.https http://127.0.0.1:10809
Install MMCV using MIM.
pip install -U openmim
mim install mmcv-full
insightface环境
下载insightface源码:
https://github.com/deepinsight/insightface
去服务器scrfd路径:
cd detection/scrfd
执行:
pip install -r requirements.txt
pip install -v -e . # or "python setup.py develop"
训练数据集准备
label标记格式:
# <image_path> image_width image_height
bbox_x1 bbox_y1 bbox_x2 bbox_y2 (<keypoint,3>*N)
...
...
# <image_path> image_width image_height
bbox_x1 bbox_y1 bbox_x2 bbox_y2 (<keypoint,3>*N)
...
...
比如:
# 0--Parade/0_Parade_marchingband_1_849.jpg 1024 1385
449.00000 330.00000 571.00000 479.00000 488.90601 373.64301 0.00000 542.08899 376.44199 0.00000 515.03101 412.82999 0.00000 485.17401 425.89301 0.00000 538.35699 431.49100 0.00000
# 0--Parade/0_Parade_Parade_0_904.jpg 1024 1432
361.00000 98.00000 624.00000 437.00000 424.14301 251.65601 0.00000 547.13397 232.57100 0.00000 494.12100 325.87500 0.00000 453.82999 368.28601 0.00000 561.97803 342.83899 0.00000
# 0--Parade/0_Parade_marchingband_1_799.jpg 1024 768
78.00000 221.00000 85.00000 229.00000 -1.00000 -1.00000 -1.00000 -1.00000 -1.00000 -1.00000 -1.00000 -1.00000 -1.00000 -1.00000 -1.00000 -1.00000 -1.00000 -1.00000 -1.00000
78.00000 238.00000 92.00000 255.00000 84.18800 244.60699 1.00000 89.52700 244.49100 1.00000 86.97300 247.85699 1.00000 85.11600 250.64301 1.00000 88.48200 250.64301 1.00000
113.00000 212.00000 124.00000 227.00000 117.00000 220.00000 0.00000 122.00000 220.00000 0.00000 119.00000 222.00000 0.00000 118.00000 225.00000 0.00000 122.00000 225.00000 0.00000
todo
遇到问题
训练
CUDA_VISIBLE_DEVICES="0,1,2,3" PORT=29701 bash ./tools/dist_train.sh ./configs/scrfd/scrfd_1g.py 4