Adding new model
This commit is contained in:
0
__init__.py
Normal file
0
__init__.py
Normal file
BIN
models/model_A-L.pth
Normal file
BIN
models/model_A-L.pth
Normal file
Binary file not shown.
@@ -114,4 +114,6 @@ def train():
|
||||
|
||||
print(f"Best val acc: {top_val_acc} | Best train acc: {top_train_acc} | Epoch: {checkpoint_index}")
|
||||
|
||||
train()
|
||||
# Path: src/train.py
|
||||
if __name__ == "__main__":
|
||||
train()
|
||||
@@ -187,7 +187,7 @@
|
||||
"name": "python",
|
||||
"nbconvert_exporter": "python",
|
||||
"pygments_lexer": "ipython3",
|
||||
"version": "3.9.13"
|
||||
"version": "3.9.16"
|
||||
},
|
||||
"vscode": {
|
||||
"interpreter": {
|
||||
|
||||
@@ -20,16 +20,23 @@ cap = cv2.VideoCapture(0)
|
||||
|
||||
keypoints = []
|
||||
|
||||
spoter_model = SPOTER(num_classes=5, hidden_dim=len(LANDMARKS) *2)
|
||||
spoter_model.load_state_dict(torch.load('models/spoter_56.pth'))
|
||||
spoter_model = SPOTER(num_classes=12, hidden_dim=len(LANDMARKS) *2)
|
||||
spoter_model.load_state_dict(torch.load('models/spoter_57.pth'))
|
||||
|
||||
m = {
|
||||
0: "A",
|
||||
1: "B",
|
||||
2: "C",
|
||||
3: "D",
|
||||
4: "E"
|
||||
}
|
||||
4: "E",
|
||||
5: "F",
|
||||
6: "G",
|
||||
7: "H",
|
||||
8: "I",
|
||||
9: "J",
|
||||
10: "K",
|
||||
11: "L",
|
||||
}
|
||||
|
||||
while True:
|
||||
# Read a frame from the webcam
|
||||
@@ -117,6 +124,9 @@ while True:
|
||||
mp_drawing.draw_landmarks(frame, results.right_hand_landmarks, mp_holistic.HAND_CONNECTIONS)
|
||||
mp_drawing.draw_landmarks(frame, results.pose_landmarks, mp_holistic.POSE_CONNECTIONS)
|
||||
|
||||
# frame to rgb
|
||||
frame = cv2.cvtColor(frame, cv2.COLOR_RGB2BGR)
|
||||
|
||||
# Show the frame
|
||||
cv2.imshow('MediaPipe Hands', frame)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user