Commit e386e7c8 authored by Shehan Liyanage's avatar Shehan Liyanage

add jupyter notebooks

parent e82fe00e
{
"cells": [
{
"cell_type": "markdown",
"id": "174b5cb4",
"metadata": {},
"source": [
"# Installing and importing dependencies"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "d35d0afb",
"metadata": {},
"outputs": [],
"source": [
"# install these\n",
"!pip install tensorflow==2.13.0 \n",
"!pip install mediapipe==0.10.3\n",
"!pip install scikit-learn==1.3.1\n",
"!pip install opencv-python==4.9.0.80\n",
"!pip install matplotlib==3.8.3"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "0cdb80ee",
"metadata": {},
"outputs": [],
"source": [
"import cv2\n",
"import numpy as np\n",
"import os\n",
"from matplotlib import pyplot as plt\n",
"import time\n",
"import mediapipe as mp"
]
},
{
"cell_type": "markdown",
"id": "c823bc27",
"metadata": {},
"source": [
"# Collecting keypoints from mediapipe holistics"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "81a10b4a",
"metadata": {},
"outputs": [],
"source": [
"mp_holistic = mp.solutions.holistic #we are bringing the holistic model of mideapipe\n",
"mp_drawing = mp.solutions.drawing_utils #we are also bringing the drawing utilities of mideapipe."
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "ccb80832",
"metadata": {},
"outputs": [],
"source": [
"def mediapipe_detection(image, model):\n",
" image = cv2.cvtColor(image, cv2.COLOR_BGR2RGB) # COLOR CONVERSION BGR 2 RGB\n",
" image.flags.writeable = False # Image is no longer writeable\n",
" results = model.process(image) # Make prediction\n",
" image.flags.writeable = True # Image is now writeable \n",
" image = cv2.cvtColor(image, cv2.COLOR_RGB2BGR) # COLOR COVERSION RGB 2 BGR\n",
" return image, results"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "fe20a0f8",
"metadata": {},
"outputs": [],
"source": [
"def draw_landmarks(image, results):\n",
" # Draw face connections\n",
" mp_drawing.draw_landmarks(image, results.face_landmarks, mp_holistic.FACEMESH_TESSELATION, \n",
" mp_drawing.DrawingSpec(color=(70,110,10), thickness=1, circle_radius=1), \n",
" mp_drawing.DrawingSpec(color=(70,256,121), thickness=1, circle_radius=1)\n",
" ) \n",
" # Draw pose connections\n",
" mp_drawing.draw_landmarks(image, results.pose_landmarks, mp_holistic.POSE_CONNECTIONS,\n",
" mp_drawing.DrawingSpec(color=(70,22,10), thickness=2, circle_radius=4), \n",
" mp_drawing.DrawingSpec(color=(70,44,121), thickness=2, circle_radius=2)\n",
" ) \n",
" # Draw left hand connections\n",
" mp_drawing.draw_landmarks(image, results.left_hand_landmarks, mp_holistic.HAND_CONNECTIONS, \n",
" mp_drawing.DrawingSpec(color=(121,22,76), thickness=2, circle_radius=4), \n",
" mp_drawing.DrawingSpec(color=(121,44,250), thickness=2, circle_radius=2)\n",
" ) \n",
" # Draw right hand connections \n",
" mp_drawing.draw_landmarks(image, results.right_hand_landmarks, mp_holistic.HAND_CONNECTIONS, \n",
" mp_drawing.DrawingSpec(color=(245,117,66), thickness=2, circle_radius=4), \n",
" mp_drawing.DrawingSpec(color=(245,66,230), thickness=2, circle_radius=2)\n",
" ) "
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "a075f076",
"metadata": {},
"outputs": [],
"source": [
"cap = cv2.VideoCapture(0)\n",
"# Set mediapipe model \n",
"with mp_holistic.Holistic(min_detection_confidence=0.5, min_tracking_confidence=0.5) as holistic:\n",
" while cap.isOpened():\n",
" #here we are reading the feed\n",
" ret,frame = cap.read()\n",
" \n",
" #make detections\n",
" image,results = mediapipe_detection(frame,holistic)\n",
" print(results)\n",
" \n",
" #drawing landmarks on real time\n",
" draw_landmarks(image,results)\n",
" \n",
" #now we are showing the feed to the screen\n",
" cv2.imshow(\"OpenCV Feed\",image)\n",
"\n",
" #breaking the loop if we press q.\n",
" if cv2.waitKey(10) & 0xFF==ord('q'):\n",
" break\n",
" cap.release()\n",
" cv2.destroyAllWindows()"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "5f81ba75",
"metadata": {},
"outputs": [],
"source": [
"results.left_hand_landmarks"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "b4bf5df6",
"metadata": {},
"outputs": [],
"source": [
"draw_landmarks(frame,results)\n",
"plt.imshow(cv2.cvtColor(frame, cv2.COLOR_BGR2RGB))"
]
},
{
"cell_type": "markdown",
"id": "256834f5",
"metadata": {},
"source": [
"# Extracting keypoints value"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "c1b8c1ce",
"metadata": {},
"outputs": [],
"source": [
"# results.pose_landmarks\n",
"# len(results.face_landmarks.landmark)\n",
"len(results.right_hand_landmarks.landmark)"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "18576048",
"metadata": {},
"outputs": [],
"source": [
"pose = np.array([[res.x,res.y,res.z,res.visibility] for res in results.pose_landmarks.landmark]).flatten() if results.pose_landmarks else np.zeros(132)\n",
"face = np.array([[res.x, res.y, res.z] for res in results.face_landmarks.landmark]).flatten() if results.face_landmarks else np.zeros(1404)\n",
"lh = np.array([[res.x, res.y, res.z] for res in results.left_hand_landmarks.landmark]).flatten() if results.left_hand_landmarks else np.zeros(21*3)\n",
"rh = np.array([[res.x, res.y, res.z] for res in results.right_hand_landmarks.landmark]).flatten() if results.right_hand_landmarks else np.zeros(21*3)"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "cdba5b51",
"metadata": {},
"outputs": [],
"source": [
"def extract_keypoints(results):\n",
" pose = np.array([[res.x, res.y, res.z, res.visibility] for res in results.pose_landmarks.landmark]).flatten() if results.pose_landmarks else np.zeros(33*4)\n",
" face = np.array([[res.x, res.y, res.z] for res in results.face_landmarks.landmark]).flatten() if results.face_landmarks else np.zeros(468*3)\n",
" lh = np.array([[res.x, res.y, res.z] for res in results.left_hand_landmarks.landmark]).flatten() if results.left_hand_landmarks else np.zeros(21*3)\n",
" rh = np.array([[res.x, res.y, res.z] for res in results.right_hand_landmarks.landmark]).flatten() if results.right_hand_landmarks else np.zeros(21*3)\n",
" return np.concatenate([pose, face, lh, rh])"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "d54f49eb",
"metadata": {},
"outputs": [],
"source": [
"extract_keypoints(results).shape\n",
"# 468*3+33*4+21*3+21*3"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "065aef3f",
"metadata": {},
"outputs": [],
"source": [
"result_test = extract_keypoints(results)"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "af6df385",
"metadata": {},
"outputs": [],
"source": [
"result_test"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "848358f7",
"metadata": {},
"outputs": [],
"source": [
"np.save('0',result_test)"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "e8742aff",
"metadata": {},
"outputs": [],
"source": [
"np.load('0.npy')#load backup our array"
]
},
{
"cell_type": "markdown",
"id": "28582d44",
"metadata": {},
"source": [
"# Folder setup for data Collection"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "099ad60b",
"metadata": {},
"outputs": [],
"source": [
"# path for exported data,numpy arrays\n",
"PATH = os.path.join(\"MP_Data\")\n",
"\n",
"# Actions that we are trying to detect\n",
"#\n",
"actions = [\"haloo\", \"dannwa\",\"mama\", \"obata\" ,\"puluwan\", \"suba\" ,\"udaasanak\"]\n",
"# ,,, --\n",
"\n",
"# total number of sequences that we are trying to collect which is 30 videos worth of data\n",
"no_sequences = 50\n",
"\n",
"# 30 frames length of video\n",
"sequence_length = 50\n",
"\n",
"# folder start\n",
"start_folder = 50"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "bba40fb1",
"metadata": {},
"outputs": [],
"source": [
"for action in actions:\n",
" for sequence in range(no_sequences):\n",
" try:\n",
" os.makedirs(os.path.join(PATH,action,str(sequence)))\n",
" except:\n",
" pass"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "31f37a2b",
"metadata": {},
"outputs": [],
"source": [
"os.listdir()"
]
},
{
"cell_type": "markdown",
"id": "5a396320",
"metadata": {},
"source": [
"# COLLECTING KEYPOINTS FOR TRAINING AND TESTING"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "1714ef8b",
"metadata": {},
"outputs": [],
"source": [
"cap = cv2.VideoCapture(0)\n",
"# Set mediapipe model \n",
"with mp_holistic.Holistic(min_detection_confidence=0.5, min_tracking_confidence=0.5) as holistic:\n",
" \n",
" # NEW LOOP\n",
" # Loop through actions\n",
" for action in actions:\n",
" # Loop through sequences aka videos\n",
" for sequence in range(no_sequences):\n",
" # Loop through video length aka sequence length\n",
" for frame_num in range(sequence_length):\n",
"\n",
" #here we are reading the feed\n",
" ret,frame = cap.read()\n",
"\n",
" #make detections\n",
" image,results = mediapipe_detection(frame,holistic)\n",
"\n",
" #drawing landmarks on real time\n",
" draw_landmarks(image,results)\n",
" \n",
" # NEW Apply wait logic\n",
" if frame_num == 0: \n",
" cv2.putText(image, 'STARTING COLLECTION', (120,200), \n",
" cv2.FONT_HERSHEY_SIMPLEX , 1, (255, 0,0), 4, cv2.LINE_AA)\n",
" cv2.putText(image, 'Collecting frames for {} Video Number {}'.format(action, sequence), (15,12), \n",
" cv2.FONT_HERSHEY_SIMPLEX , 0.5, (0, 255,0), 1, cv2.LINE_AA)\n",
" # Show to screen\n",
" cv2.imshow('OpenCV Feed', image)\n",
" cv2.waitKey(3000)\n",
" else: \n",
" cv2.putText(image, 'Collecting frames for {} Video Number {}'.format(action, sequence), (15,12), \n",
" cv2.FONT_HERSHEY_SIMPLEX , 0.5, (0, 0, 255), 1, cv2.LINE_AA)\n",
" # Show to screen\n",
" cv2.imshow('OpenCV Feed', image)\n",
" \n",
" # NEW Export keypoints\n",
" keypoints = extract_keypoints(results)\n",
" npy_path = os.path.join(PATH, action, str(sequence), str(frame_num))\n",
" np.save(npy_path, keypoints)\n",
"\n",
" # Break gracefully\n",
" if cv2.waitKey(10) & 0xFF == ord('q'):\n",
" break\n",
" \n",
" cap.release()\n",
" cv2.destroyAllWindows()"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "fcfa9787",
"metadata": {},
"outputs": [],
"source": [
"cap.release()\n",
"cv2.destroyAllWindows()"
]
},
{
"cell_type": "markdown",
"id": "77eeca8c",
"metadata": {},
"source": [
"# Preprocessing our data"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "ff20ae81",
"metadata": {},
"outputs": [],
"source": [
"from sklearn.model_selection import train_test_split\n",
"from tensorflow.keras.utils import to_categorical"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "6608f51e",
"metadata": {},
"outputs": [],
"source": [
"label_map = {label:num for num, label in enumerate(actions)}\n",
"label_map"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "db923ffe",
"metadata": {},
"outputs": [],
"source": [
"sequences, labels = [], []\n",
"for action in actions:\n",
" for sequence in range(no_sequences):\n",
" video = []\n",
" for frame_num in range(sequence_length):\n",
" res = np.load(os.path.join(PATH, action, str(sequence), \"{}.npy\".format(frame_num)))\n",
" video.append(res)\n",
" sequences.append(video)\n",
" labels.append(label_map[action])"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "323b08a9",
"metadata": {},
"outputs": [],
"source": [
"print(np.array(sequences).shape)\n",
"print(np.array(labels).shape)"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "cb74ec71",
"metadata": {},
"outputs": [],
"source": [
"X = np.array(sequences)\n",
"X.shape"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "b74e8540",
"metadata": {},
"outputs": [],
"source": [
"y = to_categorical(labels).astype(int)\n",
"y"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "1395ccc1",
"metadata": {},
"outputs": [],
"source": [
"X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.05)\n",
"X_train.shape"
]
},
{
"cell_type": "markdown",
"id": "ff1588e9",
"metadata": {},
"source": [
"# Building and training LSTM DL Model"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "949ec61a",
"metadata": {},
"outputs": [],
"source": [
"from tensorflow.keras.models import Sequential\n",
"from tensorflow.keras.layers import LSTM, Dense\n",
"from tensorflow.keras.layers import Dropout\n",
"# from tensorflow.keras.callbacks import TensorBoard\n",
"import tensorflow as tf"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "9f77f681",
"metadata": {},
"outputs": [],
"source": [
"# !pip install tensorboard==2.13.0\n",
"# load_ext tensorboard\n"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "42241ea3",
"metadata": {},
"outputs": [],
"source": [
"log_dir = os.path.join('Logs')\n",
"# tb_callback = TensorBoard(log_dir=log_dir)\n",
"tensorboard_callback = tf.keras.callbacks.TensorBoard(log_dir, histogram_freq=1)"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "9f38c04f",
"metadata": {
"scrolled": true
},
"outputs": [],
"source": [
"#instantiating our model\n",
"#here we are using media-pipe holistic and lstm model .\n",
"#less data is required,it is faster to train with 1.53 million parameters\n",
"model = Sequential()\n",
"model.add(LSTM(128, return_sequences=True, activation='tanh', input_shape=(50, 1662)))\n",
"model.add(Dropout(0.2))\n",
"model.add(LSTM(256, return_sequences=True, activation='tanh'))\n",
"model.add(Dropout(0.2))\n",
"model.add(LSTM(128, return_sequences=False, activation='tanh'))\n",
"model.add(Dropout(0.2))\n",
"model.add(Dense(128, activation='relu'))\n",
"model.add(Dropout(0.2))\n",
"model.add(Dense(64, activation='relu'))\n",
"model.add(Dense(np.array(actions).shape[0], activation='softmax'))\n",
"optimizer = tf.keras.optimizers.Adam(learning_rate=0.001)"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "1adc370e",
"metadata": {},
"outputs": [],
"source": [
"np.array(actions).shape"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "2655277e",
"metadata": {},
"outputs": [],
"source": [
"model.compile(loss='categorical_crossentropy', optimizer=optimizer, metrics=['accuracy'])"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "f4f80cbe",
"metadata": {},
"outputs": [],
"source": [
"model.fit(X_train, y_train, epochs=2000, callbacks=[tensorboard_callback])"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "2faa67ea",
"metadata": {
"scrolled": true
},
"outputs": [],
"source": [
"# tensorboard --logdir logs"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "59d11d60",
"metadata": {},
"outputs": [],
"source": [
"model.summary()"
]
},
{
"cell_type": "markdown",
"id": "622c25a2",
"metadata": {},
"source": [
"# Predicting result from test data"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "0ae31efd",
"metadata": {},
"outputs": [],
"source": [
"result = model.predict(X_test)"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "4e4c3ad0",
"metadata": {},
"outputs": [],
"source": [
"actions[np.argmax(result[0])]"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "c127bae9",
"metadata": {},
"outputs": [],
"source": [
"actions[np.argmax(y_test[0])]"
]
},
{
"cell_type": "markdown",
"id": "b1f90159",
"metadata": {},
"source": [
"# Saving weights for future"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "301ec59b",
"metadata": {},
"outputs": [],
"source": [
"tf.keras.models.save_model(\n",
" model, \"/Users/shehanliyanage/Research/MLAndFlask/finalModel.h5\"\n",
")"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "1319a76e",
"metadata": {},
"outputs": [],
"source": [
"# del model\n",
"from tensorflow.keras.models import load_model"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "4c74de9b",
"metadata": {},
"outputs": [],
"source": [
"model.load_weights(\"finalModel.h5\")"
]
},
{
"cell_type": "markdown",
"id": "7c5a8092",
"metadata": {},
"source": [
"# Accuracy Calculation and Evaluation using Confusion matrix"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "42ef880d",
"metadata": {},
"outputs": [],
"source": [
"from sklearn.metrics import multilabel_confusion_matrix, accuracy_score"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "298e79bb",
"metadata": {},
"outputs": [],
"source": [
"yhat = model.predict(X_test)"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "6f2df9c7",
"metadata": {},
"outputs": [],
"source": [
"ytrue = np.argmax(y_test, axis=1).tolist()\n",
"yhat = np.argmax(yhat, axis=1).tolist()"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "f1d0c708",
"metadata": {},
"outputs": [],
"source": [
"multilabel_confusion_matrix(ytrue, yhat)"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "b0037941",
"metadata": {},
"outputs": [],
"source": [
"accuracy_score(ytrue, yhat)"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "de7080df",
"metadata": {},
"outputs": [],
"source": []
},
{
"cell_type": "code",
"execution_count": null,
"id": "e7e64d99",
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
"kernelspec": {
"display_name": "venv",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.10.10"
}
},
"nbformat": 4,
"nbformat_minor": 5
}
{
"cells": [
{
"cell_type": "markdown",
"id": "174b5cb4",
"metadata": {},
"source": [
"# Installing and importing dependencies"
]
},
{
"cell_type": "code",
"execution_count": 1,
"id": "d35d0afb",
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Collecting tensorflow==2.13.0\n",
" Using cached tensorflow-2.13.0-cp310-cp310-macosx_12_0_arm64.whl (1.9 kB)\n",
"Collecting tensorflow-macos==2.13.0\n",
" Using cached tensorflow_macos-2.13.0-cp310-cp310-macosx_12_0_arm64.whl (189.3 MB)\n",
"Collecting numpy<=1.24.3,>=1.22\n",
" Using cached numpy-1.24.3-cp310-cp310-macosx_11_0_arm64.whl (13.9 MB)\n",
"Collecting absl-py>=1.0.0\n",
" Using cached absl_py-2.1.0-py3-none-any.whl (133 kB)\n",
"Collecting grpcio<2.0,>=1.24.3\n",
" Using cached grpcio-1.63.0-cp310-cp310-macosx_12_0_universal2.whl (10.1 MB)\n",
"Collecting protobuf!=4.21.0,!=4.21.1,!=4.21.2,!=4.21.3,!=4.21.4,!=4.21.5,<5.0.0dev,>=3.20.3\n",
" Using cached protobuf-4.25.3-cp37-abi3-macosx_10_9_universal2.whl (394 kB)\n",
"Requirement already satisfied: six>=1.12.0 in ./venv/lib/python3.10/site-packages (from tensorflow-macos==2.13.0->tensorflow==2.13.0) (1.16.0)\n",
"Collecting h5py>=2.9.0\n",
" Using cached h5py-3.11.0-cp310-cp310-macosx_11_0_arm64.whl (2.9 MB)\n",
"Collecting tensorboard<2.14,>=2.13\n",
" Using cached tensorboard-2.13.0-py3-none-any.whl (5.6 MB)\n",
"Collecting flatbuffers>=23.1.21\n",
" Using cached flatbuffers-24.3.25-py2.py3-none-any.whl (26 kB)\n",
"Collecting wrapt>=1.11.0\n",
" Using cached wrapt-1.16.0-cp310-cp310-macosx_11_0_arm64.whl (38 kB)\n",
"Collecting tensorflow-estimator<2.14,>=2.13.0\n",
" Using cached tensorflow_estimator-2.13.0-py2.py3-none-any.whl (440 kB)\n",
"Requirement already satisfied: setuptools in ./venv/lib/python3.10/site-packages (from tensorflow-macos==2.13.0->tensorflow==2.13.0) (65.5.0)\n",
"Collecting opt-einsum>=2.3.2\n",
" Using cached opt_einsum-3.3.0-py3-none-any.whl (65 kB)\n",
"Collecting gast<=0.4.0,>=0.2.1\n",
" Using cached gast-0.4.0-py3-none-any.whl (9.8 kB)\n",
"Requirement already satisfied: packaging in ./venv/lib/python3.10/site-packages (from tensorflow-macos==2.13.0->tensorflow==2.13.0) (24.0)\n",
"Collecting keras<2.14,>=2.13.1\n",
" Using cached keras-2.13.1-py3-none-any.whl (1.7 MB)\n",
"Collecting google-pasta>=0.1.1\n",
" Using cached google_pasta-0.2.0-py3-none-any.whl (57 kB)\n",
"Collecting typing-extensions<4.6.0,>=3.6.6\n",
" Using cached typing_extensions-4.5.0-py3-none-any.whl (27 kB)\n",
"Collecting astunparse>=1.6.0\n",
" Using cached astunparse-1.6.3-py2.py3-none-any.whl (12 kB)\n",
"Collecting termcolor>=1.1.0\n",
" Using cached termcolor-2.4.0-py3-none-any.whl (7.7 kB)\n",
"Collecting libclang>=13.0.0\n",
" Using cached libclang-18.1.1-py2.py3-none-macosx_11_0_arm64.whl (26.4 MB)\n",
"Collecting wheel<1.0,>=0.23.0\n",
" Using cached wheel-0.43.0-py3-none-any.whl (65 kB)\n",
"Collecting markdown>=2.6.8\n",
" Using cached Markdown-3.6-py3-none-any.whl (105 kB)\n",
"Collecting google-auth-oauthlib<1.1,>=0.5\n",
" Using cached google_auth_oauthlib-1.0.0-py2.py3-none-any.whl (18 kB)\n",
"Collecting werkzeug>=1.0.1\n",
" Using cached werkzeug-3.0.3-py3-none-any.whl (227 kB)\n",
"Collecting requests<3,>=2.21.0\n",
" Using cached requests-2.31.0-py3-none-any.whl (62 kB)\n",
"Collecting tensorboard-data-server<0.8.0,>=0.7.0\n",
" Using cached tensorboard_data_server-0.7.2-py3-none-any.whl (2.4 kB)\n",
"Collecting google-auth<3,>=1.6.3\n",
" Using cached google_auth-2.29.0-py2.py3-none-any.whl (189 kB)\n",
"Collecting pyasn1-modules>=0.2.1\n",
" Using cached pyasn1_modules-0.4.0-py3-none-any.whl (181 kB)\n",
"Collecting rsa<5,>=3.1.4\n",
" Using cached rsa-4.9-py3-none-any.whl (34 kB)\n",
"Collecting cachetools<6.0,>=2.0.0\n",
" Using cached cachetools-5.3.3-py3-none-any.whl (9.3 kB)\n",
"Collecting requests-oauthlib>=0.7.0\n",
" Using cached requests_oauthlib-2.0.0-py2.py3-none-any.whl (24 kB)\n",
"Collecting urllib3<3,>=1.21.1\n",
" Using cached urllib3-2.2.1-py3-none-any.whl (121 kB)\n",
"Collecting idna<4,>=2.5\n",
" Using cached idna-3.7-py3-none-any.whl (66 kB)\n",
"Collecting certifi>=2017.4.17\n",
" Using cached certifi-2024.2.2-py3-none-any.whl (163 kB)\n",
"Collecting charset-normalizer<4,>=2\n",
" Using cached charset_normalizer-3.3.2-cp310-cp310-macosx_11_0_arm64.whl (120 kB)\n",
"Collecting MarkupSafe>=2.1.1\n",
" Using cached MarkupSafe-2.1.5-cp310-cp310-macosx_10_9_universal2.whl (18 kB)\n",
"Collecting pyasn1<0.7.0,>=0.4.6\n",
" Using cached pyasn1-0.6.0-py2.py3-none-any.whl (85 kB)\n",
"Collecting oauthlib>=3.0.0\n",
" Using cached oauthlib-3.2.2-py3-none-any.whl (151 kB)\n",
"Installing collected packages: libclang, flatbuffers, wrapt, wheel, urllib3, typing-extensions, termcolor, tensorflow-estimator, tensorboard-data-server, pyasn1, protobuf, oauthlib, numpy, MarkupSafe, markdown, keras, idna, grpcio, google-pasta, gast, charset-normalizer, certifi, cachetools, absl-py, werkzeug, rsa, requests, pyasn1-modules, opt-einsum, h5py, astunparse, requests-oauthlib, google-auth, google-auth-oauthlib, tensorboard, tensorflow-macos, tensorflow\n",
" Attempting uninstall: typing-extensions\n",
" Found existing installation: typing_extensions 4.11.0\n",
" Uninstalling typing_extensions-4.11.0:\n",
" Successfully uninstalled typing_extensions-4.11.0\n",
"\u001b[31mERROR: pip's dependency resolver does not currently take into account all the packages that are installed. This behaviour is the source of the following dependency conflicts.\n",
"ipython 8.24.0 requires typing-extensions>=4.6; python_version < \"3.12\", but you have typing-extensions 4.5.0 which is incompatible.\u001b[0m\u001b[31m\n",
"\u001b[0mSuccessfully installed MarkupSafe-2.1.5 absl-py-2.1.0 astunparse-1.6.3 cachetools-5.3.3 certifi-2024.2.2 charset-normalizer-3.3.2 flatbuffers-24.3.25 gast-0.4.0 google-auth-2.29.0 google-auth-oauthlib-1.0.0 google-pasta-0.2.0 grpcio-1.63.0 h5py-3.11.0 idna-3.7 keras-2.13.1 libclang-18.1.1 markdown-3.6 numpy-1.24.3 oauthlib-3.2.2 opt-einsum-3.3.0 protobuf-4.25.3 pyasn1-0.6.0 pyasn1-modules-0.4.0 requests-2.31.0 requests-oauthlib-2.0.0 rsa-4.9 tensorboard-2.13.0 tensorboard-data-server-0.7.2 tensorflow-2.13.0 tensorflow-estimator-2.13.0 tensorflow-macos-2.13.0 termcolor-2.4.0 typing-extensions-4.5.0 urllib3-2.2.1 werkzeug-3.0.3 wheel-0.43.0 wrapt-1.16.0\n",
"\n",
"\u001b[1m[\u001b[0m\u001b[34;49mnotice\u001b[0m\u001b[1;39;49m]\u001b[0m\u001b[39;49m A new release of pip available: \u001b[0m\u001b[31;49m22.3.1\u001b[0m\u001b[39;49m -> \u001b[0m\u001b[32;49m24.0\u001b[0m\n",
"\u001b[1m[\u001b[0m\u001b[34;49mnotice\u001b[0m\u001b[1;39;49m]\u001b[0m\u001b[39;49m To update, run: \u001b[0m\u001b[32;49mpip install --upgrade pip\u001b[0m\n",
"Collecting mediapipe==0.10.3\n",
" Using cached mediapipe-0.10.3-cp310-cp310-macosx_11_0_universal2.whl (53.5 MB)\n",
"Collecting opencv-contrib-python\n",
" Using cached opencv_contrib_python-4.9.0.80-cp37-abi3-macosx_11_0_arm64.whl (44.2 MB)\n",
"Requirement already satisfied: numpy in ./venv/lib/python3.10/site-packages (from mediapipe==0.10.3) (1.24.3)\n",
"Collecting sounddevice>=0.4.4\n",
" Using cached sounddevice-0.4.6-py3-none-macosx_10_6_x86_64.macosx_10_6_universal2.whl (107 kB)\n",
"Collecting matplotlib\n",
" Using cached matplotlib-3.9.0-cp310-cp310-macosx_11_0_arm64.whl (7.8 MB)\n",
"Requirement already satisfied: flatbuffers>=2.0 in ./venv/lib/python3.10/site-packages (from mediapipe==0.10.3) (24.3.25)\n",
"Requirement already satisfied: absl-py in ./venv/lib/python3.10/site-packages (from mediapipe==0.10.3) (2.1.0)\n",
"Collecting attrs>=19.1.0\n",
" Using cached attrs-23.2.0-py3-none-any.whl (60 kB)\n",
"Collecting protobuf<4,>=3.11\n",
" Using cached protobuf-3.20.3-py2.py3-none-any.whl (162 kB)\n",
"Collecting CFFI>=1.0\n",
" Using cached cffi-1.16.0-cp310-cp310-macosx_11_0_arm64.whl (176 kB)\n",
"Collecting contourpy>=1.0.1\n",
" Using cached contourpy-1.2.1-cp310-cp310-macosx_11_0_arm64.whl (244 kB)\n",
"Requirement already satisfied: packaging>=20.0 in ./venv/lib/python3.10/site-packages (from matplotlib->mediapipe==0.10.3) (24.0)\n",
"Requirement already satisfied: python-dateutil>=2.7 in ./venv/lib/python3.10/site-packages (from matplotlib->mediapipe==0.10.3) (2.9.0.post0)\n",
"Collecting pillow>=8\n",
" Using cached pillow-10.3.0-cp310-cp310-macosx_11_0_arm64.whl (3.4 MB)\n",
"Collecting pyparsing>=2.3.1\n",
" Using cached pyparsing-3.1.2-py3-none-any.whl (103 kB)\n",
"Collecting kiwisolver>=1.3.1\n",
" Using cached kiwisolver-1.4.5-cp310-cp310-macosx_11_0_arm64.whl (66 kB)\n",
"Collecting fonttools>=4.22.0\n",
" Using cached fonttools-4.51.0-cp310-cp310-macosx_10_9_universal2.whl (2.8 MB)\n",
"Collecting cycler>=0.10\n",
" Using cached cycler-0.12.1-py3-none-any.whl (8.3 kB)\n",
"Collecting pycparser\n",
" Using cached pycparser-2.22-py3-none-any.whl (117 kB)\n",
"Requirement already satisfied: six>=1.5 in ./venv/lib/python3.10/site-packages (from python-dateutil>=2.7->matplotlib->mediapipe==0.10.3) (1.16.0)\n",
"Installing collected packages: pyparsing, pycparser, protobuf, pillow, opencv-contrib-python, kiwisolver, fonttools, cycler, contourpy, attrs, matplotlib, CFFI, sounddevice, mediapipe\n",
" Attempting uninstall: protobuf\n",
" Found existing installation: protobuf 4.25.3\n",
" Uninstalling protobuf-4.25.3:\n",
" Successfully uninstalled protobuf-4.25.3\n",
"Successfully installed CFFI-1.16.0 attrs-23.2.0 contourpy-1.2.1 cycler-0.12.1 fonttools-4.51.0 kiwisolver-1.4.5 matplotlib-3.9.0 mediapipe-0.10.3 opencv-contrib-python-4.9.0.80 pillow-10.3.0 protobuf-3.20.3 pycparser-2.22 pyparsing-3.1.2 sounddevice-0.4.6\n",
"\n",
"\u001b[1m[\u001b[0m\u001b[34;49mnotice\u001b[0m\u001b[1;39;49m]\u001b[0m\u001b[39;49m A new release of pip available: \u001b[0m\u001b[31;49m22.3.1\u001b[0m\u001b[39;49m -> \u001b[0m\u001b[32;49m24.0\u001b[0m\n",
"\u001b[1m[\u001b[0m\u001b[34;49mnotice\u001b[0m\u001b[1;39;49m]\u001b[0m\u001b[39;49m To update, run: \u001b[0m\u001b[32;49mpip install --upgrade pip\u001b[0m\n",
"Collecting scikit-learn==1.3.1\n",
" Using cached scikit_learn-1.3.1-cp310-cp310-macosx_12_0_arm64.whl (9.5 MB)\n",
"Collecting scipy>=1.5.0\n",
" Using cached scipy-1.13.0-cp310-cp310-macosx_12_0_arm64.whl (30.3 MB)\n",
"Collecting threadpoolctl>=2.0.0\n",
" Using cached threadpoolctl-3.5.0-py3-none-any.whl (18 kB)\n",
"Requirement already satisfied: numpy<2.0,>=1.17.3 in ./venv/lib/python3.10/site-packages (from scikit-learn==1.3.1) (1.24.3)\n",
"Collecting joblib>=1.1.1\n",
" Using cached joblib-1.4.2-py3-none-any.whl (301 kB)\n",
"Installing collected packages: threadpoolctl, scipy, joblib, scikit-learn\n",
"Successfully installed joblib-1.4.2 scikit-learn-1.3.1 scipy-1.13.0 threadpoolctl-3.5.0\n",
"\n",
"\u001b[1m[\u001b[0m\u001b[34;49mnotice\u001b[0m\u001b[1;39;49m]\u001b[0m\u001b[39;49m A new release of pip available: \u001b[0m\u001b[31;49m22.3.1\u001b[0m\u001b[39;49m -> \u001b[0m\u001b[32;49m24.0\u001b[0m\n",
"\u001b[1m[\u001b[0m\u001b[34;49mnotice\u001b[0m\u001b[1;39;49m]\u001b[0m\u001b[39;49m To update, run: \u001b[0m\u001b[32;49mpip install --upgrade pip\u001b[0m\n",
"Collecting opencv-python==4.9.0.80\n",
" Using cached opencv_python-4.9.0.80-cp37-abi3-macosx_11_0_arm64.whl (35.4 MB)\n",
"Requirement already satisfied: numpy>=1.17.0 in ./venv/lib/python3.10/site-packages (from opencv-python==4.9.0.80) (1.24.3)\n",
"Installing collected packages: opencv-python\n",
"Successfully installed opencv-python-4.9.0.80\n",
"\n",
"\u001b[1m[\u001b[0m\u001b[34;49mnotice\u001b[0m\u001b[1;39;49m]\u001b[0m\u001b[39;49m A new release of pip available: \u001b[0m\u001b[31;49m22.3.1\u001b[0m\u001b[39;49m -> \u001b[0m\u001b[32;49m24.0\u001b[0m\n",
"\u001b[1m[\u001b[0m\u001b[34;49mnotice\u001b[0m\u001b[1;39;49m]\u001b[0m\u001b[39;49m To update, run: \u001b[0m\u001b[32;49mpip install --upgrade pip\u001b[0m\n",
"Collecting matplotlib==3.8.3\n",
" Using cached matplotlib-3.8.3-cp310-cp310-macosx_11_0_arm64.whl (7.5 MB)\n",
"Requirement already satisfied: numpy<2,>=1.21 in ./venv/lib/python3.10/site-packages (from matplotlib==3.8.3) (1.24.3)\n",
"Requirement already satisfied: python-dateutil>=2.7 in ./venv/lib/python3.10/site-packages (from matplotlib==3.8.3) (2.9.0.post0)\n",
"Requirement already satisfied: fonttools>=4.22.0 in ./venv/lib/python3.10/site-packages (from matplotlib==3.8.3) (4.51.0)\n",
"Requirement already satisfied: pillow>=8 in ./venv/lib/python3.10/site-packages (from matplotlib==3.8.3) (10.3.0)\n",
"Requirement already satisfied: contourpy>=1.0.1 in ./venv/lib/python3.10/site-packages (from matplotlib==3.8.3) (1.2.1)\n",
"Requirement already satisfied: pyparsing>=2.3.1 in ./venv/lib/python3.10/site-packages (from matplotlib==3.8.3) (3.1.2)\n",
"Requirement already satisfied: cycler>=0.10 in ./venv/lib/python3.10/site-packages (from matplotlib==3.8.3) (0.12.1)\n",
"Requirement already satisfied: packaging>=20.0 in ./venv/lib/python3.10/site-packages (from matplotlib==3.8.3) (24.0)\n",
"Requirement already satisfied: kiwisolver>=1.3.1 in ./venv/lib/python3.10/site-packages (from matplotlib==3.8.3) (1.4.5)\n",
"Requirement already satisfied: six>=1.5 in ./venv/lib/python3.10/site-packages (from python-dateutil>=2.7->matplotlib==3.8.3) (1.16.0)\n",
"Installing collected packages: matplotlib\n",
" Attempting uninstall: matplotlib\n",
" Found existing installation: matplotlib 3.9.0\n",
" Uninstalling matplotlib-3.9.0:\n",
" Successfully uninstalled matplotlib-3.9.0\n",
"Successfully installed matplotlib-3.8.3\n",
"\n",
"\u001b[1m[\u001b[0m\u001b[34;49mnotice\u001b[0m\u001b[1;39;49m]\u001b[0m\u001b[39;49m A new release of pip available: \u001b[0m\u001b[31;49m22.3.1\u001b[0m\u001b[39;49m -> \u001b[0m\u001b[32;49m24.0\u001b[0m\n",
"\u001b[1m[\u001b[0m\u001b[34;49mnotice\u001b[0m\u001b[1;39;49m]\u001b[0m\u001b[39;49m To update, run: \u001b[0m\u001b[32;49mpip install --upgrade pip\u001b[0m\n"
]
}
],
"source": [
"!pip install tensorflow==2.13.0\n",
"!pip install mediapipe==0.10.3\n",
"!pip install scikit-learn==1.3.1\n",
"!pip install opencv-python==4.9.0.80\n",
"!pip install matplotlib==3.8.3"
]
},
{
"cell_type": "code",
"execution_count": 2,
"id": "0cdb80ee",
"metadata": {},
"outputs": [],
"source": [
"import cv2\n",
"import numpy as np\n",
"import os\n",
"from matplotlib import pyplot as plt\n",
"import time\n",
"import mediapipe as mp"
]
},
{
"cell_type": "markdown",
"id": "c823bc27",
"metadata": {},
"source": [
"# Collecting keypoints from mediapipe holistics"
]
},
{
"cell_type": "code",
"execution_count": 3,
"id": "81a10b4a",
"metadata": {},
"outputs": [],
"source": [
"mp_holistic = mp.solutions.holistic #we are bringing the holistic model of mideapipe\n",
"mp_drawing = mp.solutions.drawing_utils #we are also bringing the drawing utilities of mideapipe."
]
},
{
"cell_type": "code",
"execution_count": 4,
"id": "ccb80832",
"metadata": {},
"outputs": [],
"source": [
"def mediapipe_detection(image, model):\n",
" image = cv2.cvtColor(image, cv2.COLOR_BGR2RGB) # COLOR CONVERSION BGR 2 RGB\n",
" image.flags.writeable = False # Image is no longer writeable\n",
" results = model.process(image) # Make prediction\n",
" image.flags.writeable = True # Image is now writeable \n",
" image = cv2.cvtColor(image, cv2.COLOR_RGB2BGR) # COLOR COVERSION RGB 2 BGR\n",
" return image, results"
]
},
{
"cell_type": "code",
"execution_count": 5,
"id": "fe20a0f8",
"metadata": {},
"outputs": [],
"source": [
"def draw_landmarks(image, results):\n",
" # Draw face connections\n",
" mp_drawing.draw_landmarks(image, results.face_landmarks, mp_holistic.FACEMESH_TESSELATION, \n",
" mp_drawing.DrawingSpec(color=(70,110,10), thickness=1, circle_radius=1), \n",
" mp_drawing.DrawingSpec(color=(70,256,121), thickness=1, circle_radius=1)\n",
" ) \n",
" # Draw pose connections\n",
" mp_drawing.draw_landmarks(image, results.pose_landmarks, mp_holistic.POSE_CONNECTIONS,\n",
" mp_drawing.DrawingSpec(color=(70,22,10), thickness=2, circle_radius=4), \n",
" mp_drawing.DrawingSpec(color=(70,44,121), thickness=2, circle_radius=2)\n",
" ) \n",
" # Draw left hand connections\n",
" mp_drawing.draw_landmarks(image, results.left_hand_landmarks, mp_holistic.HAND_CONNECTIONS, \n",
" mp_drawing.DrawingSpec(color=(121,22,76), thickness=2, circle_radius=4), \n",
" mp_drawing.DrawingSpec(color=(121,44,250), thickness=2, circle_radius=2)\n",
" ) \n",
" # Draw right hand connections \n",
" mp_drawing.draw_landmarks(image, results.right_hand_landmarks, mp_holistic.HAND_CONNECTIONS, \n",
" mp_drawing.DrawingSpec(color=(245,117,66), thickness=2, circle_radius=4), \n",
" mp_drawing.DrawingSpec(color=(245,66,230), thickness=2, circle_radius=2)\n",
" ) "
]
},
{
"cell_type": "markdown",
"id": "256834f5",
"metadata": {},
"source": [
"# Extracting keypoints value"
]
},
{
"cell_type": "code",
"execution_count": 6,
"id": "cdba5b51",
"metadata": {},
"outputs": [],
"source": [
"def extract_keypoints(results):\n",
" pose = np.array([[res.x, res.y, res.z, res.visibility] for res in results.pose_landmarks.landmark]).flatten() if results.pose_landmarks else np.zeros(33*4)\n",
" face = np.array([[res.x, res.y, res.z] for res in results.face_landmarks.landmark]).flatten() if results.face_landmarks else np.zeros(468*3)\n",
" lh = np.array([[res.x, res.y, res.z] for res in results.left_hand_landmarks.landmark]).flatten() if results.left_hand_landmarks else np.zeros(21*3)\n",
" rh = np.array([[res.x, res.y, res.z] for res in results.right_hand_landmarks.landmark]).flatten() if results.right_hand_landmarks else np.zeros(21*3)\n",
" return np.concatenate([pose, face, lh, rh])"
]
},
{
"cell_type": "markdown",
"id": "28582d44",
"metadata": {},
"source": [
"# Folder setup for data Collection"
]
},
{
"cell_type": "code",
"execution_count": 7,
"id": "659c0f2a",
"metadata": {},
"outputs": [],
"source": [
"from tensorflow.keras.models import load_model"
]
},
{
"cell_type": "code",
"execution_count": 8,
"id": "c2bd8487",
"metadata": {},
"outputs": [],
"source": [
"# new\n",
"actions = (\"haloo\", \"dannwa\", \"mama\", \"obata\", \"puluwan\", \"suba\", \"udaasanak\")\n",
"\n",
"model = load_model(r\"/Users/shehanliyanage/Github/Sinhala-Sign-Language-Detection-using-ACTION-RECOGNITION/finalModel.h5\")"
]
},
{
"cell_type": "code",
"execution_count": 9,
"id": "64ef7452",
"metadata": {},
"outputs": [
{
"name": "stderr",
"output_type": "stream",
"text": [
"INFO: Created TensorFlow Lite XNNPACK delegate for CPU.\n"
]
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"1/1 [==============================] - 1s 630ms/step\n",
"mama\n",
"-----------------------------------------------\n",
"1/1 [==============================] - 0s 18ms/step\n",
"mama\n",
"-----------------------------------------------\n",
"1/1 [==============================] - 0s 18ms/step\n",
"mama\n",
"-----------------------------------------------\n",
"1/1 [==============================] - 0s 18ms/step\n",
"mama\n",
"-----------------------------------------------\n",
"1/1 [==============================] - 0s 18ms/step\n",
"mama\n",
"-----------------------------------------------\n",
"1/1 [==============================] - 0s 18ms/step\n",
"mama\n",
"-----------------------------------------------\n",
"1/1 [==============================] - 0s 16ms/step\n",
"mama\n",
"-----------------------------------------------\n",
"1/1 [==============================] - 0s 16ms/step\n",
"mama\n",
"-----------------------------------------------\n",
"1/1 [==============================] - 0s 16ms/step\n",
"mama\n",
"-----------------------------------------------\n",
"1/1 [==============================] - 0s 16ms/step\n",
"mama\n",
"-----------------------------------------------\n",
"1/1 [==============================] - 0s 16ms/step\n",
"mama\n",
"-----------------------------------------------\n",
"1/1 [==============================] - 0s 16ms/step\n",
"mama\n",
"-----------------------------------------------\n",
"1/1 [==============================] - 0s 17ms/step\n",
"mama\n",
"-----------------------------------------------\n",
"1/1 [==============================] - 0s 16ms/step\n",
"mama\n",
"-----------------------------------------------\n",
"1/1 [==============================] - 0s 15ms/step\n",
"mama\n",
"-----------------------------------------------\n",
"1/1 [==============================] - 0s 16ms/step\n",
"mama\n",
"-----------------------------------------------\n",
"1/1 [==============================] - 0s 15ms/step\n",
"mama\n",
"-----------------------------------------------\n",
"1/1 [==============================] - 0s 16ms/step\n",
"suba\n",
"-----------------------------------------------\n",
"1/1 [==============================] - 0s 15ms/step\n",
"suba\n",
"-----------------------------------------------\n",
"1/1 [==============================] - 0s 16ms/step\n",
"suba\n",
"-----------------------------------------------\n",
"1/1 [==============================] - 0s 16ms/step\n",
"puluwan\n",
"-----------------------------------------------\n",
"1/1 [==============================] - 0s 16ms/step\n",
"puluwan\n",
"-----------------------------------------------\n",
"1/1 [==============================] - 0s 16ms/step\n",
"puluwan\n",
"-----------------------------------------------\n",
"1/1 [==============================] - 0s 16ms/step\n",
"puluwan\n",
"-----------------------------------------------\n",
"1/1 [==============================] - 0s 16ms/step\n",
"puluwan\n",
"-----------------------------------------------\n",
"1/1 [==============================] - 0s 16ms/step\n",
"puluwan\n",
"-----------------------------------------------\n",
"1/1 [==============================] - 0s 16ms/step\n",
"puluwan\n",
"-----------------------------------------------\n",
"1/1 [==============================] - 0s 16ms/step\n",
"puluwan\n",
"-----------------------------------------------\n",
"1/1 [==============================] - 0s 16ms/step\n",
"puluwan\n",
"-----------------------------------------------\n",
"1/1 [==============================] - 0s 16ms/step\n",
"puluwan\n",
"-----------------------------------------------\n",
"1/1 [==============================] - 0s 16ms/step\n",
"puluwan\n",
"-----------------------------------------------\n",
"1/1 [==============================] - 0s 16ms/step\n",
"puluwan\n",
"-----------------------------------------------\n",
"1/1 [==============================] - 0s 16ms/step\n",
"puluwan\n",
"-----------------------------------------------\n",
"1/1 [==============================] - 0s 17ms/step\n",
"puluwan\n",
"-----------------------------------------------\n",
"1/1 [==============================] - 0s 15ms/step\n",
"puluwan\n",
"-----------------------------------------------\n",
"1/1 [==============================] - 0s 15ms/step\n",
"puluwan\n",
"-----------------------------------------------\n",
"1/1 [==============================] - 0s 16ms/step\n",
"puluwan\n",
"-----------------------------------------------\n",
"1/1 [==============================] - 0s 16ms/step\n",
"puluwan\n",
"-----------------------------------------------\n",
"1/1 [==============================] - 0s 16ms/step\n",
"puluwan\n",
"-----------------------------------------------\n",
"1/1 [==============================] - 0s 16ms/step\n",
"puluwan\n",
"-----------------------------------------------\n",
"1/1 [==============================] - 0s 16ms/step\n",
"puluwan\n",
"-----------------------------------------------\n",
"1/1 [==============================] - 0s 16ms/step\n",
"puluwan\n",
"-----------------------------------------------\n",
"1/1 [==============================] - 0s 15ms/step\n",
"puluwan\n",
"-----------------------------------------------\n",
"1/1 [==============================] - 0s 16ms/step\n",
"puluwan\n",
"-----------------------------------------------\n",
"1/1 [==============================] - 0s 16ms/step\n",
"udaasanak\n",
"-----------------------------------------------\n",
"1/1 [==============================] - 0s 16ms/step\n",
"puluwan\n",
"-----------------------------------------------\n",
"1/1 [==============================] - 0s 16ms/step\n",
"puluwan\n",
"-----------------------------------------------\n",
"1/1 [==============================] - 0s 16ms/step\n",
"suba\n",
"-----------------------------------------------\n",
"1/1 [==============================] - 0s 16ms/step\n",
"suba\n",
"-----------------------------------------------\n",
"1/1 [==============================] - 0s 16ms/step\n",
"puluwan\n",
"-----------------------------------------------\n",
"1/1 [==============================] - 0s 16ms/step\n",
"puluwan\n",
"-----------------------------------------------\n",
"1/1 [==============================] - 0s 16ms/step\n",
"puluwan\n",
"-----------------------------------------------\n",
"1/1 [==============================] - 0s 16ms/step\n",
"puluwan\n",
"-----------------------------------------------\n",
"1/1 [==============================] - 0s 17ms/step\n",
"puluwan\n",
"-----------------------------------------------\n",
"1/1 [==============================] - 0s 16ms/step\n",
"puluwan\n",
"-----------------------------------------------\n",
"1/1 [==============================] - 0s 16ms/step\n",
"puluwan\n",
"-----------------------------------------------\n",
"1/1 [==============================] - 0s 16ms/step\n",
"puluwan\n",
"-----------------------------------------------\n",
"1/1 [==============================] - 0s 16ms/step\n",
"puluwan\n",
"-----------------------------------------------\n",
"1/1 [==============================] - 0s 16ms/step\n",
"puluwan\n",
"-----------------------------------------------\n",
"1/1 [==============================] - 0s 16ms/step\n",
"udaasanak\n",
"-----------------------------------------------\n",
"1/1 [==============================] - 0s 16ms/step\n",
"suba\n",
"-----------------------------------------------\n",
"1/1 [==============================] - 0s 16ms/step\n",
"obata\n",
"-----------------------------------------------\n",
"1/1 [==============================] - 0s 16ms/step\n",
"obata\n",
"-----------------------------------------------\n",
"1/1 [==============================] - 0s 16ms/step\n",
"obata\n",
"-----------------------------------------------\n",
"1/1 [==============================] - 0s 16ms/step\n",
"obata\n",
"-----------------------------------------------\n",
"1/1 [==============================] - 0s 16ms/step\n",
"obata\n",
"-----------------------------------------------\n",
"1/1 [==============================] - 0s 16ms/step\n",
"obata\n",
"-----------------------------------------------\n",
"1/1 [==============================] - 0s 17ms/step\n",
"obata\n",
"-----------------------------------------------\n",
"1/1 [==============================] - 0s 16ms/step\n",
"obata\n",
"-----------------------------------------------\n",
"1/1 [==============================] - 0s 15ms/step\n",
"obata\n",
"-----------------------------------------------\n",
"1/1 [==============================] - 0s 16ms/step\n",
"obata\n",
"-----------------------------------------------\n",
"1/1 [==============================] - 0s 16ms/step\n",
"obata\n",
"-----------------------------------------------\n",
"1/1 [==============================] - 0s 16ms/step\n",
"obata\n",
"-----------------------------------------------\n",
"1/1 [==============================] - 0s 16ms/step\n",
"suba\n",
"-----------------------------------------------\n",
"1/1 [==============================] - 0s 17ms/step\n",
"suba\n",
"-----------------------------------------------\n",
"1/1 [==============================] - 0s 16ms/step\n",
"puluwan\n",
"-----------------------------------------------\n",
"1/1 [==============================] - 0s 16ms/step\n",
"puluwan\n",
"-----------------------------------------------\n",
"1/1 [==============================] - 0s 16ms/step\n",
"puluwan\n",
"-----------------------------------------------\n",
"1/1 [==============================] - 0s 16ms/step\n",
"puluwan\n",
"-----------------------------------------------\n",
"1/1 [==============================] - 0s 15ms/step\n",
"puluwan\n",
"-----------------------------------------------\n",
"1/1 [==============================] - 0s 16ms/step\n",
"puluwan\n",
"-----------------------------------------------\n",
"1/1 [==============================] - 0s 17ms/step\n",
"puluwan\n",
"-----------------------------------------------\n",
"1/1 [==============================] - 0s 16ms/step\n",
"puluwan\n",
"-----------------------------------------------\n",
"1/1 [==============================] - 0s 16ms/step\n",
"puluwan\n",
"-----------------------------------------------\n",
"1/1 [==============================] - 0s 16ms/step\n",
"puluwan\n",
"-----------------------------------------------\n",
"1/1 [==============================] - 0s 16ms/step\n",
"puluwan\n",
"-----------------------------------------------\n",
"1/1 [==============================] - 0s 16ms/step\n",
"puluwan\n",
"-----------------------------------------------\n",
"1/1 [==============================] - 0s 18ms/step\n",
"puluwan\n",
"-----------------------------------------------\n",
"1/1 [==============================] - 0s 16ms/step\n",
"puluwan\n",
"-----------------------------------------------\n",
"1/1 [==============================] - 0s 16ms/step\n",
"puluwan\n",
"-----------------------------------------------\n",
"1/1 [==============================] - 0s 16ms/step\n",
"puluwan\n",
"-----------------------------------------------\n",
"1/1 [==============================] - 0s 16ms/step\n",
"puluwan\n",
"-----------------------------------------------\n",
"1/1 [==============================] - 0s 16ms/step\n",
"puluwan\n",
"-----------------------------------------------\n",
"1/1 [==============================] - 0s 16ms/step\n",
"puluwan\n",
"-----------------------------------------------\n",
"1/1 [==============================] - 0s 16ms/step\n",
"puluwan\n",
"-----------------------------------------------\n",
"1/1 [==============================] - 0s 16ms/step\n",
"puluwan\n",
"-----------------------------------------------\n",
"1/1 [==============================] - 0s 16ms/step\n",
"puluwan\n",
"-----------------------------------------------\n",
"1/1 [==============================] - 0s 16ms/step\n",
"puluwan\n",
"-----------------------------------------------\n",
"1/1 [==============================] - 0s 16ms/step\n",
"puluwan\n",
"-----------------------------------------------\n",
"1/1 [==============================] - 0s 16ms/step\n",
"puluwan\n",
"-----------------------------------------------\n",
"1/1 [==============================] - 0s 16ms/step\n",
"puluwan\n",
"-----------------------------------------------\n",
"1/1 [==============================] - 0s 17ms/step\n",
"puluwan\n",
"-----------------------------------------------\n",
"1/1 [==============================] - 0s 16ms/step\n",
"puluwan\n",
"-----------------------------------------------\n",
"1/1 [==============================] - 0s 16ms/step\n",
"puluwan\n",
"-----------------------------------------------\n",
"1/1 [==============================] - 0s 16ms/step\n",
"puluwan\n",
"-----------------------------------------------\n",
"1/1 [==============================] - 0s 16ms/step\n",
"puluwan\n",
"-----------------------------------------------\n",
"1/1 [==============================] - 0s 17ms/step\n",
"puluwan\n",
"-----------------------------------------------\n",
"1/1 [==============================] - 0s 17ms/step\n",
"puluwan\n",
"-----------------------------------------------\n",
"1/1 [==============================] - 0s 16ms/step\n",
"puluwan\n",
"-----------------------------------------------\n",
"1/1 [==============================] - 0s 16ms/step\n",
"puluwan\n",
"-----------------------------------------------\n",
"1/1 [==============================] - 0s 18ms/step\n",
"puluwan\n",
"-----------------------------------------------\n",
"1/1 [==============================] - 0s 16ms/step\n",
"udaasanak\n",
"-----------------------------------------------\n",
"1/1 [==============================] - 0s 16ms/step\n",
"udaasanak\n",
"-----------------------------------------------\n",
"1/1 [==============================] - 0s 16ms/step\n",
"udaasanak\n",
"-----------------------------------------------\n",
"1/1 [==============================] - 0s 16ms/step\n",
"udaasanak\n",
"-----------------------------------------------\n",
"1/1 [==============================] - 0s 16ms/step\n",
"udaasanak\n",
"-----------------------------------------------\n",
"1/1 [==============================] - 0s 16ms/step\n",
"udaasanak\n",
"-----------------------------------------------\n",
"1/1 [==============================] - 0s 17ms/step\n",
"udaasanak\n",
"-----------------------------------------------\n",
"1/1 [==============================] - 0s 16ms/step\n",
"udaasanak\n",
"-----------------------------------------------\n",
"1/1 [==============================] - 0s 16ms/step\n",
"udaasanak\n",
"-----------------------------------------------\n",
"1/1 [==============================] - 0s 16ms/step\n",
"udaasanak\n",
"-----------------------------------------------\n",
"1/1 [==============================] - 0s 16ms/step\n",
"udaasanak\n",
"-----------------------------------------------\n",
"1/1 [==============================] - 0s 16ms/step\n",
"udaasanak\n",
"-----------------------------------------------\n",
"1/1 [==============================] - 0s 16ms/step\n",
"udaasanak\n",
"-----------------------------------------------\n",
"1/1 [==============================] - 0s 16ms/step\n",
"puluwan\n",
"-----------------------------------------------\n",
"1/1 [==============================] - 0s 16ms/step\n",
"puluwan\n",
"-----------------------------------------------\n",
"1/1 [==============================] - 0s 16ms/step\n",
"puluwan\n",
"-----------------------------------------------\n",
"1/1 [==============================] - 0s 16ms/step\n",
"puluwan\n",
"-----------------------------------------------\n",
"1/1 [==============================] - 0s 16ms/step\n",
"puluwan\n",
"-----------------------------------------------\n",
"1/1 [==============================] - 0s 16ms/step\n",
"puluwan\n",
"-----------------------------------------------\n",
"1/1 [==============================] - 0s 16ms/step\n",
"puluwan\n",
"-----------------------------------------------\n",
"1/1 [==============================] - 0s 17ms/step\n",
"puluwan\n",
"-----------------------------------------------\n",
"1/1 [==============================] - 0s 16ms/step\n",
"puluwan\n",
"-----------------------------------------------\n",
"1/1 [==============================] - 0s 16ms/step\n",
"puluwan\n",
"-----------------------------------------------\n",
"1/1 [==============================] - 0s 16ms/step\n",
"puluwan\n",
"-----------------------------------------------\n",
"1/1 [==============================] - 0s 16ms/step\n",
"puluwan\n",
"-----------------------------------------------\n",
"1/1 [==============================] - 0s 16ms/step\n",
"puluwan\n",
"-----------------------------------------------\n",
"1/1 [==============================] - 0s 17ms/step\n",
"puluwan\n",
"-----------------------------------------------\n",
"1/1 [==============================] - 0s 18ms/step\n",
"suba\n",
"-----------------------------------------------\n",
"1/1 [==============================] - 0s 17ms/step\n",
"suba\n",
"-----------------------------------------------\n",
"1/1 [==============================] - 0s 18ms/step\n",
"suba\n",
"-----------------------------------------------\n",
"1/1 [==============================] - 0s 17ms/step\n",
"suba\n",
"-----------------------------------------------\n",
"1/1 [==============================] - 0s 18ms/step\n",
"suba\n",
"-----------------------------------------------\n",
"1/1 [==============================] - 0s 17ms/step\n",
"puluwan\n",
"-----------------------------------------------\n",
"1/1 [==============================] - 0s 18ms/step\n",
"puluwan\n",
"-----------------------------------------------\n",
"1/1 [==============================] - 0s 17ms/step\n",
"puluwan\n",
"-----------------------------------------------\n",
"1/1 [==============================] - 0s 18ms/step\n",
"puluwan\n",
"-----------------------------------------------\n",
"1/1 [==============================] - 0s 17ms/step\n",
"suba\n",
"-----------------------------------------------\n",
"1/1 [==============================] - 0s 16ms/step\n",
"puluwan\n",
"-----------------------------------------------\n",
"1/1 [==============================] - 0s 17ms/step\n",
"suba\n",
"-----------------------------------------------\n",
"1/1 [==============================] - 0s 18ms/step\n",
"suba\n",
"-----------------------------------------------\n",
"1/1 [==============================] - 0s 17ms/step\n",
"suba\n",
"-----------------------------------------------\n",
"1/1 [==============================] - 0s 17ms/step\n",
"suba\n",
"-----------------------------------------------\n",
"1/1 [==============================] - 0s 17ms/step\n",
"suba\n",
"-----------------------------------------------\n",
"1/1 [==============================] - 0s 17ms/step\n",
"suba\n",
"-----------------------------------------------\n",
"1/1 [==============================] - 0s 17ms/step\n",
"suba\n",
"-----------------------------------------------\n",
"1/1 [==============================] - 0s 17ms/step\n",
"puluwan\n",
"-----------------------------------------------\n",
"1/1 [==============================] - 0s 17ms/step\n",
"puluwan\n",
"-----------------------------------------------\n",
"1/1 [==============================] - 0s 17ms/step\n",
"puluwan\n",
"-----------------------------------------------\n",
"1/1 [==============================] - 0s 18ms/step\n",
"puluwan\n",
"-----------------------------------------------\n",
"1/1 [==============================] - 0s 17ms/step\n",
"puluwan\n",
"-----------------------------------------------\n",
"1/1 [==============================] - 0s 17ms/step\n",
"puluwan\n",
"-----------------------------------------------\n",
"1/1 [==============================] - 0s 17ms/step\n",
"puluwan\n",
"-----------------------------------------------\n",
"1/1 [==============================] - 0s 17ms/step\n",
"puluwan\n",
"-----------------------------------------------\n",
"1/1 [==============================] - 0s 17ms/step\n",
"puluwan\n",
"-----------------------------------------------\n",
"1/1 [==============================] - 0s 17ms/step\n",
"puluwan\n",
"-----------------------------------------------\n",
"1/1 [==============================] - 0s 17ms/step\n",
"puluwan\n",
"-----------------------------------------------\n",
"1/1 [==============================] - 0s 17ms/step\n",
"puluwan\n",
"-----------------------------------------------\n",
"1/1 [==============================] - 0s 17ms/step\n",
"puluwan\n",
"-----------------------------------------------\n",
"1/1 [==============================] - 0s 17ms/step\n",
"puluwan\n",
"-----------------------------------------------\n",
"1/1 [==============================] - 0s 17ms/step\n",
"puluwan\n",
"-----------------------------------------------\n",
"1/1 [==============================] - 0s 17ms/step\n",
"suba\n",
"-----------------------------------------------\n",
"1/1 [==============================] - 0s 17ms/step\n",
"suba\n",
"-----------------------------------------------\n",
"1/1 [==============================] - 0s 17ms/step\n",
"suba\n",
"-----------------------------------------------\n",
"1/1 [==============================] - 0s 17ms/step\n",
"obata\n",
"-----------------------------------------------\n",
"1/1 [==============================] - 0s 18ms/step\n",
"obata\n",
"-----------------------------------------------\n",
"1/1 [==============================] - 0s 17ms/step\n",
"obata\n",
"-----------------------------------------------\n",
"1/1 [==============================] - 0s 17ms/step\n",
"obata\n",
"-----------------------------------------------\n",
"1/1 [==============================] - 0s 17ms/step\n",
"obata\n",
"-----------------------------------------------\n",
"1/1 [==============================] - 0s 17ms/step\n",
"obata\n",
"-----------------------------------------------\n",
"1/1 [==============================] - 0s 17ms/step\n",
"obata\n",
"-----------------------------------------------\n",
"1/1 [==============================] - 0s 17ms/step\n",
"obata\n",
"-----------------------------------------------\n",
"1/1 [==============================] - 0s 17ms/step\n",
"obata\n",
"-----------------------------------------------\n",
"1/1 [==============================] - 0s 17ms/step\n",
"obata\n",
"-----------------------------------------------\n",
"1/1 [==============================] - 0s 17ms/step\n",
"obata\n",
"-----------------------------------------------\n",
"1/1 [==============================] - 0s 17ms/step\n",
"obata\n",
"-----------------------------------------------\n",
"1/1 [==============================] - 0s 17ms/step\n",
"obata\n",
"-----------------------------------------------\n",
"1/1 [==============================] - 0s 17ms/step\n",
"obata\n",
"-----------------------------------------------\n",
"1/1 [==============================] - 0s 17ms/step\n",
"obata\n",
"-----------------------------------------------\n",
"1/1 [==============================] - 0s 17ms/step\n",
"obata\n",
"-----------------------------------------------\n",
"1/1 [==============================] - 0s 17ms/step\n",
"obata\n",
"-----------------------------------------------\n",
"1/1 [==============================] - 0s 17ms/step\n",
"obata\n",
"-----------------------------------------------\n",
"1/1 [==============================] - 0s 17ms/step\n",
"obata\n",
"-----------------------------------------------\n",
"1/1 [==============================] - 0s 17ms/step\n",
"obata\n",
"-----------------------------------------------\n",
"1/1 [==============================] - 0s 17ms/step\n",
"obata\n",
"-----------------------------------------------\n",
"1/1 [==============================] - 0s 17ms/step\n",
"obata\n",
"-----------------------------------------------\n",
"1/1 [==============================] - 0s 16ms/step\n",
"obata\n",
"-----------------------------------------------\n",
"1/1 [==============================] - 0s 17ms/step\n",
"obata\n",
"-----------------------------------------------\n",
"1/1 [==============================] - 0s 17ms/step\n",
"obata\n",
"-----------------------------------------------\n",
"1/1 [==============================] - 0s 17ms/step\n",
"obata\n",
"-----------------------------------------------\n",
"1/1 [==============================] - 0s 17ms/step\n",
"obata\n",
"-----------------------------------------------\n",
"1/1 [==============================] - 0s 17ms/step\n",
"obata\n",
"-----------------------------------------------\n",
"1/1 [==============================] - 0s 17ms/step\n",
"obata\n",
"-----------------------------------------------\n",
"1/1 [==============================] - 0s 18ms/step\n",
"obata\n",
"-----------------------------------------------\n",
"1/1 [==============================] - 0s 17ms/step\n",
"obata\n",
"-----------------------------------------------\n",
"1/1 [==============================] - 0s 16ms/step\n",
"obata\n",
"-----------------------------------------------\n",
"1/1 [==============================] - 0s 16ms/step\n",
"obata\n",
"-----------------------------------------------\n",
"1/1 [==============================] - 0s 16ms/step\n",
"obata\n",
"-----------------------------------------------\n",
"1/1 [==============================] - 0s 16ms/step\n",
"obata\n",
"-----------------------------------------------\n",
"1/1 [==============================] - 0s 16ms/step\n",
"obata\n",
"-----------------------------------------------\n",
"1/1 [==============================] - 0s 16ms/step\n",
"suba\n",
"-----------------------------------------------\n",
"1/1 [==============================] - 0s 16ms/step\n",
"suba\n",
"-----------------------------------------------\n",
"1/1 [==============================] - 0s 16ms/step\n",
"suba\n",
"-----------------------------------------------\n",
"1/1 [==============================] - 0s 17ms/step\n",
"suba\n",
"-----------------------------------------------\n",
"1/1 [==============================] - 0s 16ms/step\n",
"suba\n",
"-----------------------------------------------\n",
"1/1 [==============================] - 0s 16ms/step\n",
"suba\n",
"-----------------------------------------------\n",
"1/1 [==============================] - 0s 16ms/step\n",
"suba\n",
"-----------------------------------------------\n",
"1/1 [==============================] - 0s 16ms/step\n",
"suba\n",
"-----------------------------------------------\n",
"1/1 [==============================] - 0s 17ms/step\n",
"suba\n",
"-----------------------------------------------\n",
"1/1 [==============================] - 0s 16ms/step\n",
"suba\n",
"-----------------------------------------------\n",
"1/1 [==============================] - 0s 16ms/step\n",
"suba\n",
"-----------------------------------------------\n",
"1/1 [==============================] - 0s 16ms/step\n",
"suba\n",
"-----------------------------------------------\n",
"1/1 [==============================] - 0s 16ms/step\n",
"suba\n",
"-----------------------------------------------\n",
"1/1 [==============================] - 0s 16ms/step\n",
"suba\n",
"-----------------------------------------------\n",
"1/1 [==============================] - 0s 16ms/step\n",
"suba\n",
"-----------------------------------------------\n",
"1/1 [==============================] - 0s 16ms/step\n",
"suba\n",
"-----------------------------------------------\n",
"1/1 [==============================] - 0s 16ms/step\n",
"suba\n",
"-----------------------------------------------\n",
"1/1 [==============================] - 0s 16ms/step\n",
"puluwan\n",
"-----------------------------------------------\n",
"1/1 [==============================] - 0s 16ms/step\n",
"puluwan\n",
"-----------------------------------------------\n",
"1/1 [==============================] - 0s 16ms/step\n",
"puluwan\n",
"-----------------------------------------------\n",
"1/1 [==============================] - 0s 16ms/step\n",
"puluwan\n",
"-----------------------------------------------\n",
"1/1 [==============================] - 0s 16ms/step\n",
"puluwan\n",
"-----------------------------------------------\n",
"1/1 [==============================] - 0s 16ms/step\n",
"puluwan\n",
"-----------------------------------------------\n",
"1/1 [==============================] - 0s 16ms/step\n",
"puluwan\n",
"-----------------------------------------------\n",
"1/1 [==============================] - 0s 16ms/step\n",
"puluwan\n",
"-----------------------------------------------\n",
"1/1 [==============================] - 0s 16ms/step\n",
"puluwan\n",
"-----------------------------------------------\n",
"1/1 [==============================] - 0s 16ms/step\n",
"puluwan\n",
"-----------------------------------------------\n",
"1/1 [==============================] - 0s 16ms/step\n",
"puluwan\n",
"-----------------------------------------------\n",
"1/1 [==============================] - 0s 16ms/step\n",
"puluwan\n",
"-----------------------------------------------\n",
"1/1 [==============================] - 0s 16ms/step\n",
"puluwan\n",
"-----------------------------------------------\n",
"1/1 [==============================] - 0s 16ms/step\n",
"puluwan\n",
"-----------------------------------------------\n",
"1/1 [==============================] - 0s 16ms/step\n",
"puluwan\n",
"-----------------------------------------------\n",
"1/1 [==============================] - 0s 16ms/step\n"
]
},
{
"name": "stderr",
"output_type": "stream",
"text": [
"2024-05-19 09:25:34.535 Python[49219:945613] WARNING: Secure coding is not enabled for restorable state! Enable secure coding by implementing NSApplicationDelegate.applicationSupportsSecureRestorableState: and returning YES.\n"
]
},
{
"name": "stdout",
"output_type": "stream",
"text": [
"puluwan\n",
"-----------------------------------------------\n",
"1/1 [==============================] - 0s 16ms/step\n",
"puluwan\n",
"-----------------------------------------------\n",
"1/1 [==============================] - 0s 16ms/step\n",
"puluwan\n",
"-----------------------------------------------\n",
"1/1 [==============================] - 0s 16ms/step\n",
"puluwan\n",
"-----------------------------------------------\n",
"1/1 [==============================] - 0s 17ms/step\n",
"haloo\n",
"-----------------------------------------------\n",
"1/1 [==============================] - 0s 16ms/step\n",
"haloo\n",
"-----------------------------------------------\n",
"1/1 [==============================] - 0s 16ms/step\n",
"haloo\n",
"-----------------------------------------------\n",
"1/1 [==============================] - 0s 16ms/step\n",
"haloo\n",
"-----------------------------------------------\n",
"1/1 [==============================] - 0s 16ms/step\n",
"haloo\n",
"-----------------------------------------------\n",
"1/1 [==============================] - 0s 16ms/step\n",
"haloo\n",
"-----------------------------------------------\n",
"1/1 [==============================] - 0s 16ms/step\n",
"haloo\n",
"-----------------------------------------------\n",
"1/1 [==============================] - 0s 16ms/step\n",
"haloo\n",
"-----------------------------------------------\n",
"1/1 [==============================] - 0s 16ms/step\n",
"haloo\n",
"-----------------------------------------------\n",
"1/1 [==============================] - 0s 16ms/step\n",
"haloo\n",
"-----------------------------------------------\n",
"1/1 [==============================] - 0s 16ms/step\n",
"haloo\n",
"-----------------------------------------------\n",
"1/1 [==============================] - 0s 16ms/step\n",
"haloo\n",
"-----------------------------------------------\n",
"1/1 [==============================] - 0s 16ms/step\n",
"haloo\n",
"-----------------------------------------------\n",
"1/1 [==============================] - 0s 17ms/step\n",
"haloo\n",
"-----------------------------------------------\n",
"1/1 [==============================] - 0s 16ms/step\n",
"haloo\n",
"-----------------------------------------------\n",
"1/1 [==============================] - 0s 16ms/step\n",
"dannwa\n",
"-----------------------------------------------\n",
"1/1 [==============================] - 0s 16ms/step\n",
"dannwa\n",
"-----------------------------------------------\n",
"1/1 [==============================] - 0s 16ms/step\n",
"dannwa\n",
"-----------------------------------------------\n",
"1/1 [==============================] - 0s 16ms/step\n",
"haloo\n",
"-----------------------------------------------\n",
"1/1 [==============================] - 0s 16ms/step\n",
"haloo\n",
"-----------------------------------------------\n",
"1/1 [==============================] - 0s 16ms/step\n",
"haloo\n",
"-----------------------------------------------\n",
"1/1 [==============================] - 0s 16ms/step\n",
"haloo\n",
"-----------------------------------------------\n",
"1/1 [==============================] - 0s 16ms/step\n",
"haloo\n",
"-----------------------------------------------\n",
"1/1 [==============================] - 0s 16ms/step\n",
"mama\n",
"-----------------------------------------------\n",
"1/1 [==============================] - 0s 16ms/step\n",
"mama\n",
"-----------------------------------------------\n",
"1/1 [==============================] - 0s 16ms/step\n",
"mama\n",
"-----------------------------------------------\n",
"1/1 [==============================] - 0s 16ms/step\n",
"mama\n",
"-----------------------------------------------\n",
"1/1 [==============================] - 0s 16ms/step\n",
"mama\n",
"-----------------------------------------------\n",
"1/1 [==============================] - 0s 16ms/step\n",
"mama\n",
"-----------------------------------------------\n",
"1/1 [==============================] - 0s 17ms/step\n",
"mama\n",
"-----------------------------------------------\n",
"1/1 [==============================] - 0s 16ms/step\n",
"mama\n",
"-----------------------------------------------\n",
"1/1 [==============================] - 0s 16ms/step\n",
"mama\n",
"-----------------------------------------------\n",
"1/1 [==============================] - 0s 16ms/step\n",
"mama\n",
"-----------------------------------------------\n",
"1/1 [==============================] - 0s 16ms/step\n",
"mama\n",
"-----------------------------------------------\n",
"1/1 [==============================] - 0s 16ms/step\n",
"mama\n",
"-----------------------------------------------\n",
"1/1 [==============================] - 0s 16ms/step\n",
"mama\n",
"-----------------------------------------------\n",
"1/1 [==============================] - 0s 16ms/step\n",
"mama\n",
"-----------------------------------------------\n",
"1/1 [==============================] - 0s 16ms/step\n",
"mama\n",
"-----------------------------------------------\n",
"1/1 [==============================] - 0s 16ms/step\n",
"mama\n",
"-----------------------------------------------\n",
"1/1 [==============================] - 0s 16ms/step\n",
"mama\n",
"-----------------------------------------------\n",
"1/1 [==============================] - 0s 16ms/step\n",
"obata\n",
"-----------------------------------------------\n",
"1/1 [==============================] - 0s 16ms/step\n",
"obata\n",
"-----------------------------------------------\n",
"1/1 [==============================] - 0s 16ms/step\n",
"suba\n",
"-----------------------------------------------\n",
"1/1 [==============================] - 0s 17ms/step\n",
"suba\n",
"-----------------------------------------------\n",
"1/1 [==============================] - 0s 16ms/step\n",
"puluwan\n",
"-----------------------------------------------\n",
"1/1 [==============================] - 0s 16ms/step\n",
"puluwan\n",
"-----------------------------------------------\n",
"1/1 [==============================] - 0s 16ms/step\n",
"obata\n",
"-----------------------------------------------\n",
"1/1 [==============================] - 0s 16ms/step\n",
"mama\n",
"-----------------------------------------------\n",
"1/1 [==============================] - 0s 16ms/step\n",
"mama\n",
"-----------------------------------------------\n",
"1/1 [==============================] - 0s 16ms/step\n",
"mama\n",
"-----------------------------------------------\n",
"1/1 [==============================] - 0s 17ms/step\n",
"mama\n",
"-----------------------------------------------\n",
"1/1 [==============================] - 0s 16ms/step\n",
"mama\n",
"-----------------------------------------------\n",
"1/1 [==============================] - 0s 16ms/step\n",
"mama\n",
"-----------------------------------------------\n",
"1/1 [==============================] - 0s 16ms/step\n",
"mama\n",
"-----------------------------------------------\n",
"1/1 [==============================] - 0s 16ms/step\n",
"mama\n",
"-----------------------------------------------\n",
"1/1 [==============================] - 0s 16ms/step\n",
"mama\n",
"-----------------------------------------------\n",
"1/1 [==============================] - 0s 16ms/step\n",
"suba\n",
"-----------------------------------------------\n",
"1/1 [==============================] - 0s 17ms/step\n",
"suba\n",
"-----------------------------------------------\n",
"1/1 [==============================] - 0s 16ms/step\n",
"suba\n",
"-----------------------------------------------\n",
"1/1 [==============================] - 0s 16ms/step\n",
"suba\n",
"-----------------------------------------------\n",
"1/1 [==============================] - 0s 16ms/step\n",
"suba\n",
"-----------------------------------------------\n",
"1/1 [==============================] - 0s 16ms/step\n",
"suba\n",
"-----------------------------------------------\n",
"1/1 [==============================] - 0s 16ms/step\n",
"suba\n",
"-----------------------------------------------\n",
"1/1 [==============================] - 0s 17ms/step\n",
"suba\n",
"-----------------------------------------------\n",
"1/1 [==============================] - 0s 16ms/step\n",
"suba\n",
"-----------------------------------------------\n",
"1/1 [==============================] - 0s 16ms/step\n",
"suba\n",
"-----------------------------------------------\n",
"1/1 [==============================] - 0s 16ms/step\n",
"suba\n",
"-----------------------------------------------\n",
"1/1 [==============================] - 0s 16ms/step\n",
"suba\n",
"-----------------------------------------------\n",
"1/1 [==============================] - 0s 17ms/step\n",
"suba\n",
"-----------------------------------------------\n",
"1/1 [==============================] - 0s 16ms/step\n",
"suba\n",
"-----------------------------------------------\n",
"1/1 [==============================] - 0s 16ms/step\n",
"puluwan\n",
"-----------------------------------------------\n",
"1/1 [==============================] - 0s 16ms/step\n",
"puluwan\n",
"-----------------------------------------------\n",
"1/1 [==============================] - 0s 16ms/step\n",
"puluwan\n",
"-----------------------------------------------\n",
"1/1 [==============================] - 0s 16ms/step\n",
"puluwan\n",
"-----------------------------------------------\n",
"1/1 [==============================] - 0s 16ms/step\n",
"puluwan\n",
"-----------------------------------------------\n",
"1/1 [==============================] - 0s 16ms/step\n",
"puluwan\n",
"-----------------------------------------------\n",
"1/1 [==============================] - 0s 16ms/step\n",
"puluwan\n",
"-----------------------------------------------\n",
"1/1 [==============================] - 0s 16ms/step\n",
"puluwan\n",
"-----------------------------------------------\n",
"1/1 [==============================] - 0s 16ms/step\n",
"puluwan\n",
"-----------------------------------------------\n",
"1/1 [==============================] - 0s 16ms/step\n",
"puluwan\n",
"-----------------------------------------------\n",
"1/1 [==============================] - 0s 16ms/step\n",
"puluwan\n",
"-----------------------------------------------\n",
"1/1 [==============================] - 0s 16ms/step\n",
"puluwan\n",
"-----------------------------------------------\n",
"1/1 [==============================] - 0s 16ms/step\n",
"puluwan\n",
"-----------------------------------------------\n",
"1/1 [==============================] - 0s 16ms/step\n",
"puluwan\n",
"-----------------------------------------------\n",
"1/1 [==============================] - 0s 17ms/step\n",
"puluwan\n",
"-----------------------------------------------\n",
"1/1 [==============================] - 0s 17ms/step\n",
"puluwan\n",
"-----------------------------------------------\n",
"1/1 [==============================] - 0s 16ms/step\n",
"puluwan\n",
"-----------------------------------------------\n",
"1/1 [==============================] - 0s 16ms/step\n",
"puluwan\n",
"-----------------------------------------------\n",
"1/1 [==============================] - 0s 16ms/step\n",
"puluwan\n",
"-----------------------------------------------\n",
"1/1 [==============================] - 0s 16ms/step\n",
"puluwan\n",
"-----------------------------------------------\n",
"1/1 [==============================] - 0s 16ms/step\n",
"puluwan\n",
"-----------------------------------------------\n",
"1/1 [==============================] - 0s 16ms/step\n",
"puluwan\n",
"-----------------------------------------------\n",
"1/1 [==============================] - 0s 16ms/step\n",
"puluwan\n",
"-----------------------------------------------\n",
"1/1 [==============================] - 0s 16ms/step\n",
"puluwan\n",
"-----------------------------------------------\n",
"1/1 [==============================] - 0s 16ms/step\n",
"puluwan\n",
"-----------------------------------------------\n",
"1/1 [==============================] - 0s 16ms/step\n",
"puluwan\n",
"-----------------------------------------------\n",
"1/1 [==============================] - 0s 16ms/step\n",
"puluwan\n",
"-----------------------------------------------\n",
"1/1 [==============================] - 0s 16ms/step\n",
"puluwan\n",
"-----------------------------------------------\n",
"1/1 [==============================] - 0s 16ms/step\n",
"puluwan\n",
"-----------------------------------------------\n",
"1/1 [==============================] - 0s 16ms/step\n",
"puluwan\n",
"-----------------------------------------------\n",
"1/1 [==============================] - 0s 16ms/step\n",
"puluwan\n",
"-----------------------------------------------\n",
"1/1 [==============================] - 0s 16ms/step\n",
"puluwan\n",
"-----------------------------------------------\n",
"1/1 [==============================] - 0s 16ms/step\n",
"puluwan\n",
"-----------------------------------------------\n",
"1/1 [==============================] - 0s 16ms/step\n",
"puluwan\n",
"-----------------------------------------------\n",
"1/1 [==============================] - 0s 16ms/step\n",
"udaasanak\n",
"-----------------------------------------------\n",
"1/1 [==============================] - 0s 16ms/step\n",
"udaasanak\n",
"-----------------------------------------------\n",
"1/1 [==============================] - 0s 16ms/step\n",
"udaasanak\n",
"-----------------------------------------------\n",
"1/1 [==============================] - 0s 16ms/step\n",
"puluwan\n",
"-----------------------------------------------\n",
"1/1 [==============================] - 0s 16ms/step\n",
"udaasanak\n",
"-----------------------------------------------\n",
"1/1 [==============================] - 0s 16ms/step\n",
"udaasanak\n",
"-----------------------------------------------\n",
"1/1 [==============================] - 0s 16ms/step\n",
"udaasanak\n",
"-----------------------------------------------\n",
"1/1 [==============================] - 0s 16ms/step\n",
"udaasanak\n",
"-----------------------------------------------\n",
"1/1 [==============================] - 0s 17ms/step\n",
"udaasanak\n",
"-----------------------------------------------\n",
"1/1 [==============================] - 0s 16ms/step\n",
"udaasanak\n",
"-----------------------------------------------\n",
"1/1 [==============================] - 0s 16ms/step\n",
"udaasanak\n",
"-----------------------------------------------\n",
"1/1 [==============================] - 0s 16ms/step\n",
"udaasanak\n",
"-----------------------------------------------\n",
"1/1 [==============================] - 0s 17ms/step\n",
"udaasanak\n",
"-----------------------------------------------\n",
"1/1 [==============================] - 0s 16ms/step\n",
"udaasanak\n",
"-----------------------------------------------\n",
"1/1 [==============================] - 0s 16ms/step\n",
"udaasanak\n",
"-----------------------------------------------\n",
"1/1 [==============================] - 0s 16ms/step\n",
"udaasanak\n",
"-----------------------------------------------\n",
"1/1 [==============================] - 0s 16ms/step\n",
"udaasanak\n",
"-----------------------------------------------\n",
"1/1 [==============================] - 0s 16ms/step\n",
"udaasanak\n",
"-----------------------------------------------\n",
"1/1 [==============================] - 0s 17ms/step\n",
"udaasanak\n",
"-----------------------------------------------\n",
"1/1 [==============================] - 0s 20ms/step\n",
"udaasanak\n",
"-----------------------------------------------\n",
"1/1 [==============================] - 0s 16ms/step\n",
"udaasanak\n",
"-----------------------------------------------\n",
"1/1 [==============================] - 0s 17ms/step\n",
"udaasanak\n",
"-----------------------------------------------\n",
"1/1 [==============================] - 0s 17ms/step\n",
"udaasanak\n",
"-----------------------------------------------\n",
"1/1 [==============================] - 0s 16ms/step\n",
"udaasanak\n",
"-----------------------------------------------\n",
"1/1 [==============================] - 0s 16ms/step\n",
"udaasanak\n",
"-----------------------------------------------\n",
"1/1 [==============================] - 0s 16ms/step\n",
"udaasanak\n",
"-----------------------------------------------\n",
"1/1 [==============================] - 0s 16ms/step\n",
"udaasanak\n",
"-----------------------------------------------\n",
"1/1 [==============================] - 0s 16ms/step\n",
"udaasanak\n",
"-----------------------------------------------\n",
"1/1 [==============================] - 0s 16ms/step\n",
"udaasanak\n",
"-----------------------------------------------\n",
"1/1 [==============================] - 0s 16ms/step\n",
"udaasanak\n",
"-----------------------------------------------\n",
"1/1 [==============================] - 0s 16ms/step\n",
"udaasanak\n",
"-----------------------------------------------\n",
"1/1 [==============================] - 0s 16ms/step\n",
"udaasanak\n",
"-----------------------------------------------\n",
"1/1 [==============================] - 0s 16ms/step\n",
"udaasanak\n",
"-----------------------------------------------\n",
"1/1 [==============================] - 0s 16ms/step\n",
"udaasanak\n",
"-----------------------------------------------\n",
"1/1 [==============================] - 0s 16ms/step\n",
"udaasanak\n",
"-----------------------------------------------\n",
"1/1 [==============================] - 0s 16ms/step\n",
"udaasanak\n",
"-----------------------------------------------\n",
"1/1 [==============================] - 0s 16ms/step\n",
"udaasanak\n",
"-----------------------------------------------\n",
"1/1 [==============================] - 0s 16ms/step\n",
"udaasanak\n",
"-----------------------------------------------\n",
"1/1 [==============================] - 0s 16ms/step\n",
"udaasanak\n",
"-----------------------------------------------\n",
"1/1 [==============================] - 0s 16ms/step\n",
"udaasanak\n",
"-----------------------------------------------\n",
"1/1 [==============================] - 0s 16ms/step\n",
"udaasanak\n",
"-----------------------------------------------\n",
"1/1 [==============================] - 0s 16ms/step\n",
"udaasanak\n",
"-----------------------------------------------\n",
"1/1 [==============================] - 0s 16ms/step\n",
"udaasanak\n",
"-----------------------------------------------\n",
"1/1 [==============================] - 0s 16ms/step\n",
"udaasanak\n",
"-----------------------------------------------\n",
"1/1 [==============================] - 0s 16ms/step\n",
"udaasanak\n",
"-----------------------------------------------\n",
"1/1 [==============================] - 0s 16ms/step\n",
"udaasanak\n",
"-----------------------------------------------\n",
"1/1 [==============================] - 0s 16ms/step\n",
"udaasanak\n",
"-----------------------------------------------\n"
]
}
],
"source": [
"sequence = []\n",
"sentence = []\n",
"predictions = []\n",
"threshold = 0.7\n",
"\n",
"cap = cv2.VideoCapture(0)\n",
"# Set mediapipe model \n",
"with mp_holistic.Holistic(min_detection_confidence=0.5, min_tracking_confidence=0.5) as holistic:\n",
" while cap.isOpened():\n",
"\n",
" # Read feed\n",
" ret, frame = cap.read()\n",
"\n",
" # Make detections\n",
" image, results = mediapipe_detection(frame, holistic)\n",
"# print(results)\n",
" \n",
" # Draw landmarks\n",
" draw_landmarks(image, results)\n",
" \n",
" # 2. Prediction logic\n",
" keypoints = extract_keypoints(results)\n",
" sequence.append(keypoints)\n",
" sequence = sequence[-50:]\n",
" \n",
" if len(sequence) == 50:\n",
" res = model.predict(np.expand_dims(sequence, axis=0))[0]\n",
" print(actions[np.argmax(res)])\n",
" print('-----------------------------------------------')\n",
" predictions.append(np.argmax(res))\n",
" \n",
" \n",
" #3. Viz logic\n",
" if np.unique(predictions[-25:])[0]==np.argmax(res): \n",
" if res[np.argmax(res)] > threshold: \n",
" \n",
" if len(sentence) > 0: \n",
" if actions[np.argmax(res)] != sentence[-1]:\n",
" sentence.append(actions[np.argmax(res)])\n",
" else:\n",
" sentence.append(actions[np.argmax(res)])\n",
"\n",
" if len(sentence) > 5: \n",
" sentence = sentence[-5:]\n",
" \n",
" cv2.rectangle(image, (0,0), (1500, 60), (0, 102, 255), -1)\n",
" cv2.putText(image, ' '.join(sentence), (5,20), cv2.FONT_HERSHEY_SIMPLEX, 1.2, (255, 255, 255), 2, cv2.LINE_AA)\n",
"\n",
" # Show to screen\n",
" cv2.imshow('OpenCV Feed', image)\n",
"\n",
" # Break gracefully\n",
" if cv2.waitKey(10) & 0xFF == ord('q'):\n",
" break\n",
" cap.release()\n",
" cv2.destroyAllWindows()"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "9730488b",
"metadata": {},
"outputs": [],
"source": [
"cap.release()\n",
"cv2.destroyAllWindows()"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "5efd9fb7",
"metadata": {},
"outputs": [],
"source": []
}
],
"metadata": {
"kernelspec": {
"display_name": "venv",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.10.10"
}
},
"nbformat": 4,
"nbformat_minor": 5
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment