A face segmentation tool based on YOLOv8 and SAM2
output.mp4
- Create a Python3 virtual env
python3 -m venv ./venv
- Activate the environment creatred in the previous step
- install the requirements in requirements.txt file
pip install -r requirements
- Code for inferring the pipeline on image and video
import cv2
from FaceSegmentHandler import FaceSegmentHandler
img = cv2.imread(r".\test_data\people.jpg")
fs = FaceSegmentHandler()
segmented_img = fs.segment_on_image(img)
cv2.imwrite("segmented_img.png", segmented_img)
fs.segment_on_video(r".\test_data\people.mp4")