Python/Yolo/README.md
2024-06-04 20:27:20 +08:00

135 lines
4.7 KiB
Markdown
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# YOLO
### 若電腦沒有顯卡則可以先用colab的方式進行一個簡單demo
### 建議都試看看如何使用Yolo可以套用到很多場景
#### 若對AI有興趣的可以去了解CNN、RNN、GAN、DON、DRL、LLM
##
# Yolo V5
### 可先透過YOLO的github進行查詢確認所需的環境需求
### V5 [連接](https://github.com/ultralytics/yolov5)
由文件中可知所需環境:
* Python 3.8以上
* Pytorch 1.8以上
![](http://140.125.21.65:8418/Education/Python/raw/branch/master/Yolo/img/%E5%9C%96%E7%89%871.png)
### 下載V5檔案 [連接](https://github.com/ultralytics/yolov5)
1. 按下Code
2. 按下Download ZIP
3. 解壓縮剛剛下載的檔案
![](http://140.125.21.65:8418/Education/Python/raw/branch/master/Yolo/img/%E5%9C%96%E7%89%872.png)
### 環境安裝
* 為了同一使用規範這邊一律採用WinPython的方式進行
* 可透過提供的環境繼續使用,若要自行架設,繼續往下觀看
* Winpython[連接](http://140.125.21.65:500/sharing/hS347f5na)
* 選擇所需要的即可之後安裝V5是採用3.8V8採用3.10
![](http://140.125.21.65:8418/Education/Python/raw/branch/master/Yolo/img/%E5%9C%96%E7%89%873.png)
安裝好WinPython後打開小黑框
![](http://140.125.21.65:8418/Education/Python/raw/branch/master/Yolo/img/%E5%9C%96%E7%89%874.png)
### 於指令中輸入 pip list
![](http://140.125.21.65:8418/Education/Python/raw/branch/master/Yolo/img/%E5%9C%96%E7%89%875.png)
### 尋找torch
若torch版本號後沒有cu的之類的 直接卸載
`pip uninstall torch`
接著按Y 確認刪除
`pip uninstall torchaudio`
接著按Y 確認刪除
`pip uninstall torchvision`
接著按Y 確認刪除
![](http://140.125.21.65:8418/Education/Python/raw/branch/master/Yolo/img/%E5%9C%96%E7%89%876.png)
### 上Pytorch的官網找尋歷史安裝包[link](https://pytorch.org/get-started/previous-versions/):
![](http://140.125.21.65:8418/Education/Python/raw/branch/master/Yolo/img/%E5%9C%96%E7%89%877.png)
於指令中輸入
`pip install torch==1.8.1+cu111 torchvision==0.9.1+cu111 torchaudio==0.8.1 -f https://download.pytorch.org/whl/torch_stable.html`
![](http://140.125.21.65:8418/Education/Python/raw/branch/master/Yolo/img/%E5%9C%96%E7%89%878.png)
於指令中輸入 pip list 確認
![](http://140.125.21.65:8418/Education/Python/raw/branch/master/Yolo/img/%E5%9C%96%E7%89%879.png)
### 遇到問題
若出現:
![](http://140.125.21.65:8418/Education/Python/raw/branch/master/Yolo/img/%E5%9C%96%E7%89%8710.png)
輸入 `pip install opencv-python`
若出現:
![](http://140.125.21.65:8418/Education/Python/raw/branch/master/Yolo/img/%E5%9C%96%E7%89%8711.png)
輸入 `pip install ultralytics`
### 測試環境
1. 根據我給的teching_test的資料夾
2. 使用指令到達此資料夾 cd D:\…….\teaching_test
![](http://140.125.21.65:8418/Education/Python/raw/branch/master/Yolo/img/%E5%9C%96%E7%89%8712.png)
3. 輸入
`python test_yolo.py `
4. 若能成功運行,並顯示以下畫面,則此環境就能使用了
![](http://140.125.21.65:8418/Education/Python/raw/branch/master/Yolo/img/%E5%9C%96%E7%89%8713.png)
##
# Yolo V8
### 可先透過YOLO的github進行查詢確認所需的環境需求
### V8 [連接](https://github.com/ultralytics/ultralytics)
由文件中可知所需環境:
* Python 3.8以上
* Pytorch 1.8以上
![](http://140.125.21.65:8418/Education/Python/raw/branch/master/Yolo/img/%E5%9C%96%E7%89%8714.png)
### 環境安裝
### 上Pytorch的官網找尋歷史安裝包[link](https://pytorch.org/get-started/previous-versions/):
![](http://140.125.21.65:8418/Education/Python/raw/branch/master/Yolo/img/%E5%9C%96%E7%89%8715.png)
###
安裝方式與V5差不多最終確認
![](http://140.125.21.65:8418/Education/Python/raw/branch/master/Yolo/img/%E5%9C%96%E7%89%8716.png)
### 測試環境
1. 根據我給的teching_test的資料夾
2. 使用指令到達此資料夾 cd D:\…….\teaching_test
![](http://140.125.21.65:8418/Education/Python/raw/branch/master/Yolo/img/%E5%9C%96%E7%89%8717.png)
3. 輸入
`python test_yolo.py `
![](http://140.125.21.65:8418/Education/Python/raw/branch/master/Yolo/img/%E5%9C%96%E7%89%8718.png)
4. 若能成功運行,並顯示以下畫面,則此環境就能使用了
![](http://140.125.21.65:8418/Education/Python/raw/branch/master/Yolo/img/%E5%9C%96%E7%89%8719.png)
## 若安裝許久都無法順利運行或許是環境有未下載到的可以直接安裝我提供的環境進行測試。目前實測2-3台都沒有太多問題。
網址 -[140.125.21.65:500]( http://140.125.21.65:500/)
帳號 : VIP125
密碼 : Aa125125
![](http://140.125.21.65:8418/Education/Python/raw/branch/master/Yolo/img/%E5%9C%96%E7%89%8720.png)