Jul 24, 2024
data_training.py
for training the modelinference.py
for making predictions.data_collection.py
multiple times to gather emoji data:
hello.npy
good_luck.npy
nope.npy
.npy
to filter correctly.data_training.py
)Imports Needed:
os
for file handling.numpy as np
for array manipulation.cv2
if using OpenCV.Load Data Files:
os.listdir()
to retrieve all files in the directory..npy
.Initialize Data Arrays:
x
for features and y
for labels initially set to empty.x
and create corresponding y
labels.y
is set as an array of integers corresponding to the labels.Handle Label Encoding:
y
data into categorical format using to_categorical
from Keras utilities.Model Creation:
rmsprop
optimizer and categorical_crossentropy
loss function.Training the Model:
x
and y
data for a defined number of epochs.inference.py
)Setup:
cv2
, numpy
, mediapipe
, and Keras model loading utilities.Capture Video:
Prediction Logic: