Commit 531eb043 authored by Paranagama R.P.S.D.'s avatar Paranagama R.P.S.D.

fix : Run video for all frames & add frame count threshold

parent 48efc63a
...@@ -169,11 +169,15 @@ class SignLanguagePredictionService: ...@@ -169,11 +169,15 @@ class SignLanguagePredictionService:
frames_per_sign = self.speed_levels.get(speed, 50) # Default to level 1 if speed level is not provided frames_per_sign = self.speed_levels.get(speed, 50) # Default to level 1 if speed level is not provided
# Loop through the frames of the video # Loop through the frames of the video
while frame_count < 50: while frame_count <= video.get(cv2.CAP_PROP_FRAME_COUNT):
success, frame = video.read() success, frame = video.read()
if not success: if not success:
break break
# TODO Add to COnfig
if frame_count >= 250:
break
# Preprocess the frame # Preprocess the frame
frame = cv2.cvtColor(frame, cv2.COLOR_BGR2RGB) frame = cv2.cvtColor(frame, cv2.COLOR_BGR2RGB)
frame = cv2.resize(frame, (IMG_SIZE, IMG_SIZE)) frame = cv2.resize(frame, (IMG_SIZE, IMG_SIZE))
...@@ -190,6 +194,8 @@ class SignLanguagePredictionService: ...@@ -190,6 +194,8 @@ class SignLanguagePredictionService:
# Store the prediction for the frame # Store the prediction for the frame
predictions.append(sinhala_letter) predictions.append(sinhala_letter)
frame_count += 1 frame_count += 1
# TODO Add to COnfig
threshold_percentage = 60 threshold_percentage = 60
# Check if the required number of frames per sign has been reached # Check if the required number of frames per sign has been reached
......
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