What is MacVision? MacVision is a python project made for object detection with pre-trained YOLO models. This repo also includes face changing system using YOLO-face. It detects faces, changes them with face image.
- Clone this repo
git clone https://github.com/OneDevelopmentPL/MacVision.git
cd MacVision- Create a virtual env.
python3 -m venv .venv
source .venv/bin/activate- Install pip packages
pip3 install -r requirements.txt- Run
python3 macvision.pyTo quit press q.
git clone https://github.com/OneDevelopmentPL/MacVision.git
cd MacVision/facechanging- Create a virtual env.
python3 -m venv .venv
source .venv/bin/activate- Install pip packages
pip3 install -r requirements_face.txt- Download -face models (some are in Release tab, but if model disappoints, you can download different model here)
- Place the model in the
facechangingfolder. - Place the face image in the
facechangingfolder. - Edit
facechanging.pyfile and fill the settings.
Example:
[...]
MODEL_PATH = "yolov8n-face.pt"
REPLACEMENT_IMG = "face.png"
USE_DEFAULT_SIZE = False
DRAW_BOX = True
TEXT_LABEL = "Face"
[...]- Run the file
python3 facechanging.pyQuit pressing q button.
| Model | Size | Speed | Accuracy |
|---|---|---|---|
| yolov8n.pt | Smallest | Very fast | Mid |
| yolov8s.pt | Small | Fast | Better |
| yolov8m.pt | Mid | ok | Good |
| yolov8l.pt | Big | Slower | The best |
In macvision.py change:
model = YOLO("modelhere.pt")
Selected model will download on app start.
Tested on Mac mini M4 16GB RAM
yolov8n -> very fast (30-50FPS)
yolov8s -> not tested
yolov8m -> mid (15-20FPS)
yolov8l -> bad (5-10FPS)
What is .mlpackage?
.mlpackage is a modern model container format introduced by Apple, designed to replace the older .mlmodel for use with the Core ML framework. It is specifically optimized for Apple Silicon (M1, M2, M3, M4) and serves as the primary bridge to unlock the full power of the Neural Engine (ANE).
- Download packages via pip
pip install ultralytics coremltools- Type this command into a terminal (make sure it is MacVision root directory)
python3 pt2ml.py --file youtyolofile.pt- Change in
macvision.py:
model = YOLO("file.mlpackage")READY TO USE!
More here!
OneDevelopment