Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -19,11 +19,10 @@ from ultralytics import YOLO
|
|
19 |
|
20 |
# Constants
|
21 |
ASSETS_DIR = Path(__file__).parent / "assets"
|
22 |
-
#
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
YOLO11M_MODEL = MODELS_DIR / "yolo11m_results" / "best.pt"
|
27 |
|
28 |
DEMO_VIDEOS = {
|
29 |
"One Person": ASSETS_DIR / "one-by-one-person-detection.mp4",
|
@@ -465,9 +464,11 @@ class PeopleDetectionApp:
|
|
465 |
with st.sidebar:
|
466 |
st.header("Settings")
|
467 |
|
468 |
-
# Create a mapping for readable model names
|
469 |
model_options = {
|
470 |
"YOLOv8n (Nano)": "yolov8n.pt",
|
|
|
|
|
471 |
"YOLO11n (Custom)": str(YOLO11N_MODEL),
|
472 |
"YOLO11s (Custom)": str(YOLO11S_MODEL),
|
473 |
"YOLO11m (Custom)": str(YOLO11M_MODEL),
|
@@ -483,6 +484,10 @@ class PeopleDetectionApp:
|
|
483 |
# Get the actual model path from the display name
|
484 |
model_name = model_options[model_display_name]
|
485 |
|
|
|
|
|
|
|
|
|
486 |
# Detection threshold
|
487 |
detection_threshold = st.slider(
|
488 |
"Detection threshold",
|
|
|
19 |
|
20 |
# Constants
|
21 |
ASSETS_DIR = Path(__file__).parent / "assets"
|
22 |
+
# Custom model paths - locate them relative to the app.py file
|
23 |
+
YOLO11N_MODEL = Path(__file__).parent / "yolo11n_results" / "best.pt"
|
24 |
+
YOLO11S_MODEL = Path(__file__).parent / "yolo11s_results" / "best.pt"
|
25 |
+
YOLO11M_MODEL = Path(__file__).parent / "yolo11m_results" / "best.pt"
|
|
|
26 |
|
27 |
DEMO_VIDEOS = {
|
28 |
"One Person": ASSETS_DIR / "one-by-one-person-detection.mp4",
|
|
|
464 |
with st.sidebar:
|
465 |
st.header("Settings")
|
466 |
|
467 |
+
# Create a mapping for readable model names including custom models
|
468 |
model_options = {
|
469 |
"YOLOv8n (Nano)": "yolov8n.pt",
|
470 |
+
"YOLOv8s (Small)": "yolov8s.pt",
|
471 |
+
"YOLOv8m (Medium)": "yolov8m.pt",
|
472 |
"YOLO11n (Custom)": str(YOLO11N_MODEL),
|
473 |
"YOLO11s (Custom)": str(YOLO11S_MODEL),
|
474 |
"YOLO11m (Custom)": str(YOLO11M_MODEL),
|
|
|
484 |
# Get the actual model path from the display name
|
485 |
model_name = model_options[model_display_name]
|
486 |
|
487 |
+
# Log model path for debugging
|
488 |
+
st.write(f"Using model: {model_name}")
|
489 |
+
st.write(f"Model exists: {Path(model_name).exists()}")
|
490 |
+
|
491 |
# Detection threshold
|
492 |
detection_threshold = st.slider(
|
493 |
"Detection threshold",
|