mediapipe, cvzone, ulltralytics
)torch CUDA
should be installed for better fps in the inferenceMediapipe
:Find faces in realtime using the light weight model provided in the mediapipe
library.
When we install the cvzone
Library we found in it FaceDetecionModule.py
based on the mediapipe
Library β¦It contain Function named findFaces
that returns img, bboxs
While True :
detector = FaceDetector()
success, img = cap.read()
imgOut = img.copy()
img, bboxs = detector.findFaces(img, draw=False)
Collecting the classeFake
Dataset Notated by 0
Collecting the classe Real
Dataset Notated by 1
Merging all of them in ALL folder To do The training on It using YOLO v8 nano Version
All folder conttains 20 Fake Image + 20 Real Image (80 file = 40 image + 40 teir text files)
.txt
to be used for training purposes (YOLO)listInfo.append(f"{classID} {xcn} {ycn} {wn} {hn}\\n")
#->Exemple
0 0.485156 0.482292 0.417187 0.789583
train, val ,test
from the folder All
for the training : Use SplitData.py
put the test , val , train
in tge same folder and zip it to put it on Google colab
Unzip it !unzip data.zip -d /content/Data
Train the model
!yolo task=detect mode=train data=/content/Data/data.yaml model=yolov8l.pt epochs=100 imgsz=640 patience=25
With data.yaml
:
path: ./Data
train: train/images
val: val/images
test: test/images
nc: 2
names: ["fake", "real"]
<aside> β
For The training Procedure cheeck My Kaggle Notebook
</aside>
main.py