WIP
This commit is contained in:
parent
80ac412a5a
commit
cb02cd0eaa
12
main.py
12
main.py
@ -5,9 +5,13 @@ import cv2 as cv
|
||||
import tempfile
|
||||
import numpy as np
|
||||
import tensorflow as tf
|
||||
from crop_hand_skeleton import crop_hand
|
||||
from cvzone.HandTrackingModule import HandDetector
|
||||
|
||||
if __name__ == "__main__":
|
||||
detector = HandDetector(maxHands=1, mode=True, detectionCon=0.7, minTrackCon=0.8)
|
||||
model = tf.keras.models.load_model('model_pred/VGG16_sign_char_detection_model')
|
||||
|
||||
st.set_page_config(
|
||||
page_title="Projekt widzenie"
|
||||
)
|
||||
@ -22,13 +26,15 @@ if __name__ == "__main__":
|
||||
tfile = tempfile.NamedTemporaryFile(delete=False)
|
||||
tfile.write(upload_movie.read())
|
||||
video_cap = cv.VideoCapture(tfile.name)
|
||||
result, num = segment_video(video_cap, fps=1.5)
|
||||
result, num = segment_video(video_cap, fps=10)
|
||||
st.write(f"Załadowano {num} klatek")
|
||||
for img in result:
|
||||
img2= cv.resize(img,dsize=(224,224))
|
||||
img_skeleton = crop_hand(img, detector)
|
||||
img2= cv.resize(img_skeleton,dsize=(224,224))
|
||||
#breakpoint()
|
||||
img_np = np.asarray(img2)
|
||||
classification = classify(img_np[:,:,::-1], model)
|
||||
st.image(img[:,:,::-1])
|
||||
st.image(img_skeleton[:,:,::-1])
|
||||
st.write(classification)
|
||||
|
||||
|
||||
|
@ -1,7 +1,7 @@
|
||||
import cv2
|
||||
import tensorflow as tf
|
||||
import numpy as np
|
||||
from crop_hands_skeleton import crop_hands
|
||||
from crop_hand_skeleton import crop_hand
|
||||
from cvzone.HandTrackingModule import HandDetector
|
||||
|
||||
class_names = ['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', 'del', 'nothing', 'space']
|
||||
@ -34,7 +34,7 @@ def save_frames(frames, dir):
|
||||
detector = HandDetector(maxHands=1, mode=True, detectionCon=0.7, minTrackCon=0.8)
|
||||
for i, frame in enumerate(frames):
|
||||
print(i)
|
||||
cv2.imwrite(f"{dir}/frame{i}.jpg", crop_hands(frame, detector))
|
||||
cv2.imwrite(f"{dir}/frame{i}.jpg", crop_hand(frame, detector))
|
||||
|
||||
|
||||
def classify(img, model):
|
||||
|
Loading…
Reference in New Issue
Block a user