← Back to list

【macOS Sonoma 14.1.2】Object Detection on Custom Dataset using YOLOv8 on MacBook Pro with M3 Pro

14-inch MacBook Pro with M3 Pro

yuhsi chen · 2023-12-13 12:14 · 0 claps · 2.6 min read
#m3-pro #macos #yolov8 #metal-performance-shaders #deep-learning
Open on Medium ↗
Wiki topics: ML · Machine Learning EDU · Education & Learning

【macOS Sonoma 14.1.2】Object Detection on Custom Dataset using YOLOv8 on MacBook Pro with M3 Pro

14-inch MacBook Pro with M3 Pro

1️⃣Create conda environment 2️⃣Clone official repository and install required packages 3️⃣Monitor resouce usage 4️⃣Demo inference on image using CPU and MPS 5️⃣Prepare custom.yaml file for custom training 6️⃣Train on custom dataset using CPU 7️⃣Train on custom dataset using MPS 8️⃣Inference on test.mp4 using CPU and MPS 9️⃣Results Acknowledgments and References

1️⃣Create conda environment

$ conda env list
$ conda create -n yolov8 python=3.9 -y

conda create -n yolov8 python=3.9 -y

conda create -n yolov8 python=3.9 -y

↪Back to the content⤴

2️⃣Clone official repository and install required packages

$ conda activate yolov8
$ cd src/
$ git clone https://github.com/ultralytics/ultralytics.git
$ cd ultralytics/

git clone https://github.com/ultralytics/ultralytics.git

git clone https://github.com/ultralytics/ultralytics.git

$ pip install -r requirements.txt
$ pip install ultralytics

pip install -r requirements.txt

pip install -r requirements.txt

↪Back to the content⤴

3️⃣Monitor resouce usage

$ top

top

top

$ sudo powermetrics --samplers gpu_power -i5000

sudo powermetrics — samplers gpu_power -i5000

sudo powermetrics — samplers gpu_power -i5000

↪Back to the content⤴

4️⃣Demo inference on image using CPU and MPS

$ yolo task=detect mode=predict model=yolov8n.pt source="../yolov5/data/images/bus.jpg"
$ yolo task=detect mode=predict model=yolov8n.pt source="../yolov5/data/images/bus.jpg" device=mps

Demo

Demo

↪Back to the content⤴

5️⃣Prepare custom.yaml file for custom training

$ vim custom.yaml

vim custom.yaml

vim custom.yaml

↪Back to the content⤴

6️⃣Train on custom dataset using CPU

$ yolo task=detect mode=train model=yolov8n.pt data=custom.yaml epochs=10 imgsz=640

yolo task=detect mode=train model=yolov8n.pt data=custom.yaml epochs=10 imgsz=640

yolo task=detect mode=train model=yolov8n.pt data=custom.yaml epochs=10 imgsz=640

top & sudo powermetrics — samplers gpu_power -i5000

top & sudo powermetrics — samplers gpu_power -i5000

↪Back to the content⤴

7️⃣Train on custom dataset using MPS

$ yolo task=detect mode=train model=yolov8n.pt data=custom.yaml epochs=10 imgsz=640 device=mps

yolo task=detect mode=train model=yolov8n.pt data=custom.yaml epochs=10 imgsz=640 device=mps

yolo task=detect mode=train model=yolov8n.pt data=custom.yaml epochs=10 imgsz=640 device=mps

top & sudo powermetrics — samplers gpu_power -i5000

top & sudo powermetrics — samplers gpu_power -i5000

↪Back to the content⤴

8️⃣Inference on test.mp4 using CPU and MPS

$ yolo task=detect mode=predict  model=runs/detect/train/weights/best.pt source="../test.mp4"
$ yolo task=detect mode=predict  model=runs/detect/train2/weights/best.pt source="../test.mp4" device=mps

yolo task=detect mode=predict model=runs/detect/train/weights/best.pt source=”../test.mp4"

yolo task=detect mode=predict model=runs/detect/train/weights/best.pt source=”../test.mp4"

yolo task=detect mode=predict model=runs/detect/train2/weights/best.pt source=”../test.mp4" device=mps

yolo task=detect mode=predict model=runs/detect/train2/weights/best.pt source=”../test.mp4" device=mps

↪Back to the content⤴

9️⃣Results

Inference results

Inference results

↪Back to the content⤴

Acknowledgments and References

↪Back to the content⤴


메타데이터
post_id
b2fe2e706db5
slug
macos-sonoma-14-1-2-object-detection-on-custom-dataset-using-yolov8-on-macbook-pro-with-m3-pro-b2fe2e706db5
url
https://medium.com/@scofield44165/macos-sonoma-14-1-2-object-detection-on-custom-dataset-using-yolov8-on-macbook-pro-with-m3-pro-b2fe2e706db5
canonical_url
https://medium.com/@scofield44165/macos-sonoma-14-1-2-object-detection-on-custom-dataset-using-yolov8-on-macbook-pro-with-m3-pro-b2fe2e706db5
author_url
https://medium.com/@scofield44165
status
ok
fetched_at
2026-07-14 10:09:25