# Python Yolov8 ###### tags: `交接資料` `python` >author: NanoStar030、wcyan、JamesLai >last update: 2024/01/19 ## 一、相關軟體 ### 1. Roboflow #### (1). 功能介紹 > Roboflow用來生成Yolo訓練時所需要的資料集。 > 網站連結: https://app.roboflow.com #### (2). 使用方法 > 至網站做資料集 > 標記(label)方式可分為 >> 1. mask (方框標註) >> 2. polygon (智慧標註) > > 基本上他的操作說明已經在網站上,但我們推薦使用多邊形功能,並且利用形狀的不同來區分不同的零件,才能夠更好的辨識出該辨識出的零件 ### 2. Yolov8 #### (1). 功能介紹 > 將Roboflow生成的資料集進行辨識訓練,訓練完後將會產生能夠辨識物品的模型,之後就可以使用模型,丟照片或影片給他辨識。 #### (2). 安裝方法 > 相關網站: https://docs.ultralytics.com/modes/train/#usage-examples > > 1.安裝 python 套件 ultralytics > ~~~ > pip install ultralytics > ~~~ > 2.創建 **訓練時** 使用的 python檔 train.py > ~~~ python > from ultralytics import YOLO > # Load yolov8n model to train your model > model = YOLO('D:\\yolov8\\yolov8n.pt') # Path to yolov8n.pt > # Train the model > results = model.train(data='data.yaml', epochs=25, imgsz=640) > ~~~ > 3.創建 **預測時** 使用的 python檔 detect.py > ~~~ python > from ultralytics import YOLO > import sys > model_path = "runs\\detect\\train\\weights\\best.pt" > model = YOLO(model_path) > target = sys.argv[1] > result = model.predict(source=target, save=True) > ~~~ > 4.整體 Yolov8資料夾 > > Yolov8 資料夾 >> train .py >> detect .py >> yolov8n. pt >> images 資料夾 >>> 要預測的照片1 .png/.jpg >>> 要預測的照片2 .png/.jpg >>> ... >>> >> roboflow 資料夾 >>> test 資料夾 >>> train 資料夾 >>> valid 資料夾 >>> data .yaml ## 二、整體使用流程  > 1.先使用 Roboflow產生資料集,並放在Yolov8資料夾底下 > 2.點進 Roboflow資料集的資料夾,滑鼠右鍵選 **在終端中開啟** > 3.在 **終端機** 中輸入以下指令,進行訓練 > ~~~ powershell > python ..\train.py > ~~~ > 4.訓練的結果會在 runs \detect \train 底下 > > 5.訓練完畢後同樣在 **終端機** 中輸入以下指令,進行預測 > ~~~ powershell > python ..\detect.py ..\images > ~~~ > 6.預測完的結果會生成在 runs \detect \predict 底下 ## 伺服器 https://cindyalex.pixnet.net/blog/post/238930883-unity-textmeshpro-%e4%b8%ad%e6%96%87 https://delightcollab.com/programming-tpl-implement-carto-dialogues-system-05-solve-textmeshpro-cant-display-chinese-problem/
×
Sign in
Email
Password
Forgot password
or
By clicking below, you agree to our
terms of service
.
Sign in via Facebook
Sign in via Twitter
Sign in via GitHub
Sign in via Dropbox
Sign in with Wallet
Wallet (
)
Connect another wallet
New to HackMD?
Sign up