AjaykumarPilla commited on
Commit
74942a3
·
verified ·
1 Parent(s): dd5210b

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -4
app.py CHANGED
@@ -15,8 +15,8 @@ model.to('cuda' if torch.cuda.is_available() else 'cpu') # Use GPU if available
15
  # Constants for LBW decision and video processing
16
  STUMPS_WIDTH = 0.2286 # meters (width of stumps)
17
  BALL_DIAMETER = 0.073 # meters (approx. cricket ball diameter)
18
- FRAME_RATE = 20 # Input video frame rate (adjust if known)
19
- SLOW_MOTION_FACTOR = 3 # For very slow motion (6x slower)
20
  CONF_THRESHOLD = 0.2 # Confidence threshold
21
  IMPACT_ZONE_Y = 0.85 # Fraction of frame height where impact is likely
22
  IMPACT_DELTA_Y = 50 # Pixels for detecting sudden y-position change
@@ -125,8 +125,7 @@ def estimate_trajectory(ball_positions, frames, detection_frames):
125
  f"Trajectory estimated successfully\n"
126
  f"Pitch point at frame {pitch_frame + 1}: ({pitch_point[0]:.1f}, {pitch_point[1]:.1f})\n"
127
  f"Impact point at frame {impact_frame + 1}: ({impact_point[0]:.1f}, {impact_point[1]:.1f})\n"
128
- f"Detections in frames: {detection_frames}\n"
129
- f"Y-coordinate changes: {[abs(y_coords[i] - y_coords[i-1]) for i in range(1, len(y_coords))]}"
130
  )
131
  return trajectory_2d, pitch_point, impact_point, pitch_frame, impact_frame, detections_3d, trajectory_3d, pitch_point_3d, impact_point_3d, debug_log
132
 
 
15
  # Constants for LBW decision and video processing
16
  STUMPS_WIDTH = 0.2286 # meters (width of stumps)
17
  BALL_DIAMETER = 0.073 # meters (approx. cricket ball diameter)
18
+ FRAME_RATE = 20 # Input video frame rate
19
+ SLOW_MOTION_FACTOR = 3 # For very slow motion (3x slower)
20
  CONF_THRESHOLD = 0.2 # Confidence threshold
21
  IMPACT_ZONE_Y = 0.85 # Fraction of frame height where impact is likely
22
  IMPACT_DELTA_Y = 50 # Pixels for detecting sudden y-position change
 
125
  f"Trajectory estimated successfully\n"
126
  f"Pitch point at frame {pitch_frame + 1}: ({pitch_point[0]:.1f}, {pitch_point[1]:.1f})\n"
127
  f"Impact point at frame {impact_frame + 1}: ({impact_point[0]:.1f}, {impact_point[1]:.1f})\n"
128
+ f"Detections in frames: {detection_frames}"
 
129
  )
130
  return trajectory_2d, pitch_point, impact_point, pitch_frame, impact_frame, detections_3d, trajectory_3d, pitch_point_3d, impact_point_3d, debug_log
131