Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
*.pickle

# Byte-compiled / optimized / DLL files
__pycache__/

# Jupyter Notebook
.ipynb_checkpoints

# Environments
.env
.venv
env/
venv/
9 changes: 7 additions & 2 deletions create_dataset.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,21 +3,25 @@

import mediapipe as mp
import cv2
import matplotlib.pyplot as plt


mp_hands = mp.solutions.hands
mp_drawing = mp.solutions.drawing_utils
mp_drawing_styles = mp.solutions.drawing_styles

hands = mp_hands.Hands(static_image_mode=True, min_detection_confidence=0.3)
hands = mp_hands.Hands(static_image_mode=True, min_detection_confidence=0.3, max_num_hands=1)

DATA_DIR = './data'

data = []
labels = []
for dir_ in os.listdir(DATA_DIR):
# skip files (like .gitignore)
if not os.path.isdir(os.path.join(DATA_DIR, dir_)):
continue

for img_path in os.listdir(os.path.join(DATA_DIR, dir_)):
print(f'Processing {dir_}/{img_path}...')
data_aux = []

x_ = []
Expand Down Expand Up @@ -48,3 +52,4 @@
f = open('data.pickle', 'wb')
pickle.dump({'data': data, 'labels': labels}, f)
f.close()
print('Data saved to data.pickle')
4 changes: 2 additions & 2 deletions data/.gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
.gitignore

!.gitignore
*