working
This commit is contained in:
15
main.py
15
main.py
@ -5,8 +5,10 @@ from ultralytics import YOLO
|
||||
import cv2
|
||||
import time
|
||||
|
||||
import utils
|
||||
from calculate import normalize_pose, compare_poses_boolean
|
||||
from draw import draw_new
|
||||
from utils import find_closest
|
||||
from video_methods import initialize_method
|
||||
|
||||
model = YOLO("yolo11x-pose.pt")
|
||||
@ -51,6 +53,8 @@ def main():
|
||||
for i, move in enumerate(moves):
|
||||
moves[i] = (move[0] - startValue, move[1], move[2])
|
||||
|
||||
print(moves)
|
||||
|
||||
while True:
|
||||
frame = method.receive_frame()
|
||||
|
||||
@ -74,9 +78,11 @@ def main():
|
||||
img = frame
|
||||
|
||||
normalized = normalize_pose(result.keypoints.xy.cpu().numpy()[0])
|
||||
cv2.imshow('you', draw_new(result.keypoints.xy.cpu()[0]))
|
||||
|
||||
if currTimeIndex != 0 and moves.index(find_closest(time.time() - currTimeIndex)) == len(moves) - 1:
|
||||
draw = utils.normalize(result.keypoints.xy.cpu().numpy()[0])
|
||||
cv2.imshow('you', draw_new(draw * 100 + 100))
|
||||
|
||||
if currTimeIndex != 0 and moves.index(find_closest(moves, time.time() - currTimeIndex)) == len(moves) - 1:
|
||||
mehCount = totalCount - failCount - goodCount
|
||||
|
||||
print(
|
||||
@ -96,7 +102,7 @@ def main():
|
||||
else:
|
||||
changed = False
|
||||
|
||||
closest = find_closest(time.time() - currTimeIndex)
|
||||
closest = find_closest(moves, time.time() - currTimeIndex)
|
||||
cv2.imshow('Dots', draw_new(closest[2]))
|
||||
|
||||
if abs((time.time() - currTimeIndex) - moves[currIndex][0]) > failRate:
|
||||
@ -130,7 +136,8 @@ def main():
|
||||
# moves.append((time.time() - startTime, normalize_pose(result.keypoints.xy.cpu().numpy()[0]), result.keypoints.xy.cpu()[0]))
|
||||
# elif len(moves) != 0:
|
||||
# with open('moves.pkl', 'wb') as f: # 'wb' = write binary
|
||||
# pickle.dump(moves, f)
|
||||
# pickle.dump
|
||||
# (moves, f)
|
||||
#
|
||||
# exit(1)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user