Yolo 又有新版了, 建立可以執行訓練的環境, 可以使用GPU CUDA, 3080 TI

目錄: https://github.com/WongKinYiu/yolov7

0. copy file to d:\yolov7,  cd yolov7

1. conda create --name y7 python=3.8

    conda create --name y7 python=3.6

#### 直接安裝3.6 可能就直接成功從 step 2 一直到step5 ===========

2.  source code 中有一file requirements.txt

pip install -r requirements.txt

 

在 WongKinYiugithub 官網中 testing 中, download yolov7.pt

3.  python test.py --data data/coco.yaml --img 640 --batch 32 --conf 0.001 --iou 0.65 --device 0 --weights yolov7.pt --name yolov7_640_val

應該可以成功 inference

4.  在 scripts 中 執行 get_coco.sh,   download 下來的檔會在scripts目錄中. 同時會產生 coco 目錄在 scripts 中

5. 將 coco 目錄搬到, yolov7 中, 然後在prompt d:\yolov7 執行

python train.py --workers 8 --device 0 --batch-size 32 --data data/coco.yaml --img 640 640 --cfg cfg/training/yolov7.yaml --weights '' --name yolov7 --hyp data/hyp.scratch.p5.yaml

6. 但會有no GPU 的錯誤. 因為沒有install pytorch with CUDA/GPU

7. pip unistall pytorch

8. conda install pytorch torchvision torchaudio cudatoolkit=11.3 -c pytorch
    conda install pytorch==1.11.0 torchvision torchaudio cudatoolkit=11.3 -c pytorch

9. 重新做5. pillow 的版本不對. pip uninstall pillow, 指定版本6.2.1

   pip install pillow==6.2.1

10. 重新做5. 缺 train2017.txt, 在 yolov7 目錄, 執行以下2個命令, 會產生txt 在coco 目錄中.  

  dir coco\images\train2017\*.* /s/b >color\train2017.txt
  dir coco\images\val2017\*.* /s/b >color\val2017.txt

11. 再執行5. 就會成功往下跑!! training (可能與python 版本不合有關, 請重頭改安裝python 3.6, 或使用下面方法暫時避開

libiomp5md.dll already initialized

改train.py

import os
os.environ["KMP_DUPLICATE_LIB_OK"]="TRUE"

12

分頁檔太小,無法完成操作。 Error loading "C:\Users\user\.conda\envs\y77\lib\site-packages\torch\lib\shm.dll" or one of its dependencies.

只好改. training 參數

img 改小, 可以進行training

python train.py --workers 8 --device 0 --batch-size 32 --data data/coco.yaml --img 256 256 --cfg cfg/training/yolov7.yaml --weights '' --name yolov7 --hyp data/hyp.scratch.p5.yaml
 

AI 環境建立:

[LLAMA][oobabooga] webui 安裝及使用 (windows)

 

arrow
arrow

    cianfen 發表在 痞客邦 留言(0) 人氣()