Update app.py
Browse files
app.py
CHANGED
@@ -23,7 +23,7 @@ PITCH_WIDTH = 3.05 # Width of pitch
|
|
23 |
STUMP_HEIGHT = 0.71 # Stump height
|
24 |
STUMP_WIDTH = 0.2286 # Stump width (including bails)
|
25 |
|
26 |
-
# Model input size (adjust if
|
27 |
MODEL_INPUT_SIZE = (640, 640) # (height, width)
|
28 |
FRAME_SKIP = 2 # Process every 2nd frame
|
29 |
MIN_DETECTIONS = 10 # Stop after 10 detections
|
@@ -31,7 +31,7 @@ BATCH_SIZE = 4 # Process 4 frames at a time
|
|
31 |
|
32 |
# Load model
|
33 |
device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
|
34 |
-
model = attempt_load("yolov5s.pt") # Load
|
35 |
model.to(device).eval() # Move model to device and set to evaluation mode
|
36 |
|
37 |
# Function to process video and detect ball
|
|
|
23 |
STUMP_HEIGHT = 0.71 # Stump height
|
24 |
STUMP_WIDTH = 0.2286 # Stump width (including bails)
|
25 |
|
26 |
+
# Model input size (adjust if yolov5s.pt was trained with a different size)
|
27 |
MODEL_INPUT_SIZE = (640, 640) # (height, width)
|
28 |
FRAME_SKIP = 2 # Process every 2nd frame
|
29 |
MIN_DETECTIONS = 10 # Stop after 10 detections
|
|
|
31 |
|
32 |
# Load model
|
33 |
device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
|
34 |
+
model = attempt_load("yolov5s.pt") # Load yolov5s.pt instead of best.pt
|
35 |
model.to(device).eval() # Move model to device and set to evaluation mode
|
36 |
|
37 |
# Function to process video and detect ball
|