wget https://developer.download.nvidia.com/compute/cuda/11.3.1/local_installers/cuda_11.3.1_465.19.01_linux.run
sudo sh cuda_11.3.1_465.19.01_linux.run
如果有了nvidia driver,可以不用install driver选项。
配置环境变量:
export PATH=“/usr/local/cuda-11.4/binKaTeX parse error: Expected '}', got 'EOF' at end of input: {PATH:+:{PATH}}”
export LD_LIBRARY_PATH=“/usr/local/cuda-11.4/lib64KaTeX parse error: Expected '}', got 'EOF' at end of input: …LIBRARY_PATH:+:{LD_LIBRARY_PATH}}”
source ~/.bashrc
https://blog.csdn.net/weixin_43301333/article/details/121537145
root@f5e52d307978:~/Downloads# sudo cp /var/cudnn-local-repo-ubuntu2004-8.5.0.96/cudnn-local-0579404E-keyring.gpg /usr/share/keyrings/
root@f5e52d307978:~/Downloads# sudo dpkg -i cudnn-local-repo-ubuntu2004-8.5.0.96_1.0-1_amd64.deb
(Reading database ... 66858 files and directories currently installed.)
Preparing to unpack cudnn-local-repo-ubuntu2004-8.5.0.96_1.0-1_amd64.deb ...
Unpacking cudnn-local-repo-ubuntu2004-8.5.0.96 (1.0-1) over (1.0-1) ...
Setting up cudnn-local-repo-ubuntu2004-8.5.0.96 (1.0-1) ...
The public CUDA GPG key does not appear to be installed.
To install the key, run this command:
sudo cp /var/cudnn-local-repo-ubuntu2004-8.5.0.96/cudnn-local-0579404E-keyring.gpg /usr/share/keyrings/
root@f5e52d307978:/# cd var
root@f5e52d307978:/var# ls
backups cache cudnn-local-repo-ubuntu2004-8.5.0.96 lib local lock log mail opt run spool tmp
root@f5e52d307978:/var# cd cudnn-local-repo-ubuntu2004-8.5.0.96/
root@f5e52d307978:/var/cudnn-local-repo-ubuntu2004-8.5.0.96# ls
0579404E.pub Local.md5 Packages Release cudnn-local-0579404E-keyring.gpg libcudnn8-samples_8.5.0.96-1+cuda11.7_amd64.deb
InRelease Local.md5.gpg Packages.gz Release.gpg libcudnn8-dev_8.5.0.96-1+cuda11.7_amd64.deb libcudnn8_8.5.0.96-1+cuda11.7_amd64.deb
root@f5e52d307978:/var/cudnn-local-repo-ubuntu2004-8.5.0.96# sudo apt-get install libcudnn8-samples_8.5.0.96-1+cuda11.7_amd64.deb
Reading package lists… Done
Building dependency tree
Reading state information… Done
E: Unable to locate package libcudnn8-samples_8.5.0.96-1+cuda11.7_amd64.deb
E: Couldn’t find any package by glob ‘libcudnn8-samples_8.5.0.96-1+cuda11.7_amd64.deb’
E: Couldn’t find any package by regex ‘libcudnn8-samples_8.5.0.96-1+cuda11.7_amd64.deb’
root@f5e52d307978:/var/cudnn-local-repo-ubuntu2004-8.5.0.96#
验证
上面的cuda和cudnn安装之后可以reboot重启一下,输入以下命令检验是否安装成功:
cd /usr/local/cuda-11.4/samples/1_Utilities/deviceQuery
sudo make
./deviceQuery
pass说明,安装成功。
安装anaconda
bash ana…sh
这里安装的是cuda113 python3.8
需要等一会儿,下载各种包
torch.cuda.is_available()
True
pip 修改镜像源
- 临时使用:
在使用pip的时候加参数-i
例如:pip install -i https://pypi.tuna.tsinghua.edu.cn/simple gevent
常用的pip源如下:
pypi 清华大学源:https://pypi.tuna.tsinghua.edu.cn/simple
pypi 豆瓣源 :http://pypi.douban.com/simple/
pypi 腾讯源:http://mirrors.cloud.tencent.com/pypi/simple
pypi 阿里源:https://mirrors.aliyun.com/pypi/
test yololandmark
(yolo) root@f5e52d307978:~/Projects/yolo5landmark# python detect.py --device 0 --conf 0.001 --iou 0.65 --weights runs/train/exp/weights/best.pt --source data/images/zidane.jpg --kpt-label
Namespace(agnostic_nms=False, augment=False, classes=None, conf_thres=0.001, device=‘0’, exist_ok=False, hide_conf=False, hide_labels=False, img_size=640, iou_thres=0.65, kpt_label=True, line_thickness=3, name=‘exp’, nosave=False, project=‘runs/detect’, save_bin=False, save_conf=False, save_crop=False, save_txt=False, save_txt_tidl=False, source=‘data/images/zidane.jpg’, update=False, view_img=False, weights=[‘runs/train/exp/weights/best.pt’])
YOLOv5 � 2022-12-30 torch 1.11.0 CUDA:0 (NVIDIA GeForce RTX 3090, 24268.3125MB)
Fusing layers…
RepConv.fuse_repvgg_block
RepConv.fuse_repvgg_block
/root/anaconda3/envs/yolo/lib/python3.8/site-packages/torch/functional.py:568: UserWarning: torch.meshgrid: in an upcoming release, it will be required to pass the indexing argument. (Triggered internally at /opt/conda/conda-bld/pytorch_1646755903507/work/aten/src/ATen/native/TensorShape.cpp:2228.)
return _VF.meshgrid(tensors, **kwargs) # type: ignore[attr-defined]
Model Summary: 366 layers, 9900136 parameters, 10144 gradients, 11.8 GFLOPS
image 1/1 /root/Projects/yolo5landmark/data/images/zidane.jpg: tensor(0.70898, device=‘cuda:0’)
640x640 4 faces, Done. (0.022s)
Results saved to runs/detect/exp3
Done. (0.071s)
(yolo) root@f5e52d307978:~/Projects/yolo5landmark# python detect_face_pose.py --conf 0.001 --iou 0.65 --weights runs/train/exp/weights/best.pt --image data/images/zidane.jpg
Namespace(conf_thres=0.001, image=‘data/images/zidane.jpg’, img_size=640, iou_thres=0.65, weights=[‘runs/train/exp/weights/best.pt’])
Fusing layers…
RepConv.fuse_repvgg_block
RepConv.fuse_repvgg_block
/root/anaconda3/envs/yolo/lib/python3.8/site-packages/torch/functional.py:568: UserWarning: torch.meshgrid: in an upcoming release, it will be required to pass the indexing argument. (Triggered internally at /opt/conda/conda-bld/pytorch_1646755903507/work/aten/src/ATen/native/TensorShape.cpp:2228.)
return _VF.meshgrid(tensors, **kwargs) # type: ignore[attr-defined]
img.shape: torch.Size([1, 3, 384, 640])
orgimg.shape: (720, 1280, 3)
train
python train.py --data w300_kpts.yaml --cfg yolov5s6_w300kpts_RepStem.yaml --weights weights/yolov5s6.pt --batch-size 32 --workers 4 --device 7 --img 640 --kpt-label
开始在远程服务器上训练!!!