Skip to content

OneDevelopmentPL/MacVision

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

19 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

MacVision

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.

Quick Start (for MacVision)

  1. Clone this repo
git clone https://github.com/OneDevelopmentPL/MacVision.git
cd MacVision
  1. Create a virtual env.
python3 -m venv .venv
source .venv/bin/activate
  1. Install pip packages
pip3 install -r requirements.txt
  1. Run
python3 macvision.py

To quit press q.

Quick Start (for face changing system)

git clone https://github.com/OneDevelopmentPL/MacVision.git
cd MacVision/facechanging
  1. Create a virtual env.
python3 -m venv .venv
source .venv/bin/activate
  1. Install pip packages
pip3 install -r requirements_face.txt
  1. Download -face models (some are in Release tab, but if model disappoints, you can download different model here)
  2. Place the model in the facechanging folder.
  3. Place the face image in the facechanging folder.
  4. Edit facechanging.py file and fill the settings.
    Example:
[...]

MODEL_PATH = "yolov8n-face.pt"
REPLACEMENT_IMG = "face.png"

USE_DEFAULT_SIZE = False
DRAW_BOX = True
TEXT_LABEL = "Face"

[...]
  1. Run the file
python3 facechanging.py

Quit pressing q button.

YOLO V8 Models

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

How to change the model?

In macvision.py change: model = YOLO("modelhere.pt") Selected model will download on app start.

Tested models by me:

Tested on Mac mini M4 16GB RAM
yolov8n -> very fast (30-50FPS)
yolov8s -> not tested
yolov8m -> mid (15-20FPS)
yolov8l -> bad (5-10FPS)

How to convert .PT to .MLPACKAGE?

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).

  1. Download packages via pip
pip install ultralytics coremltools
  1. Type this command into a terminal (make sure it is MacVision root directory)
python3 pt2ml.py --file youtyolofile.pt
  1. Change in macvision.py:
model = YOLO("file.mlpackage")

READY TO USE!

HAVE FUN USING THIS PROJECT!

Project is licensed under MIT LICENSE

More here!

Authors

OneDevelopment

About

Computer Vision for Apple (M-series chip + 16GB RAM) laptops or computers

Resources

License

Stars

Watchers

Forks

Contributors

Languages