AjaykumarPilla commited on
Commit
25f8bcc
·
verified ·
1 Parent(s): 3652eaf

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +2 -2
app.py CHANGED
@@ -40,7 +40,7 @@ def process_video(video_path):
40
  break
41
  frame_count += 1
42
  frames.append(frame.copy())
43
- results = model.predict(frame, conf=CONF_THRESHOLD)
44
  detections = 0
45
  for detection in results[0].boxes:
46
  if detection.cls == 0: # Class 0 is the ball
@@ -128,7 +128,7 @@ def lbw_decision(ball_positions, trajectory, frames, pitch_point, impact_point):
128
 
129
  if pitch_x < stumps_x - stumps_width_pixels / 2 or pitch_x > stumps_x + stumps_width_pixels / 2:
130
  return f"Not Out (Pitched outside line at x: {pitch_x:.1f}, y: {pitch_y:.1f})", trajectory, pitch_point, impact_point
131
- if impact_x < stumps_x - stumps_width_pixels / imistakes_x + stumps_width_pixels / 2:
132
  return f"Not Out (Impact outside line at x: {impact_x:.1f}, y: {impact_y:.1f})", trajectory, pitch_point, impact_point
133
  for x, y in trajectory:
134
  if abs(x - stumps_x) < stumps_width_pixels / 2 and abs(y - stumps_y) < frame_height * 0.1:
 
40
  break
41
  frame_count += 1
42
  frames.append(frame.copy())
43
+ results = model.predict(frame, conf=CONF_THRESHOLD, imgsz=640)
44
  detections = 0
45
  for detection in results[0].boxes:
46
  if detection.cls == 0: # Class 0 is the ball
 
128
 
129
  if pitch_x < stumps_x - stumps_width_pixels / 2 or pitch_x > stumps_x + stumps_width_pixels / 2:
130
  return f"Not Out (Pitched outside line at x: {pitch_x:.1f}, y: {pitch_y:.1f})", trajectory, pitch_point, impact_point
131
+ if impact_x < stumps_x - stumps_width_pixels / 2 or impact_x > stumps_x + stumps_width_pixels / 2:
132
  return f"Not Out (Impact outside line at x: {impact_x:.1f}, y: {impact_y:.1f})", trajectory, pitch_point, impact_point
133
  for x, y in trajectory:
134
  if abs(x - stumps_x) < stumps_width_pixels / 2 and abs(y - stumps_y) < frame_height * 0.1: