VietCat Amp commited on
Commit
7963d0f
·
1 Parent(s): 46ed9eb

Lower confidence threshold to 0.25 and add debug logging for traffic sign detection

Browse files

Amp-Thread-ID: https://ampcode.com/threads/T-e84964c4-a177-48da-a362-022c1ebc3a1f
Co-authored-by: Amp <amp@ampcode.com>

Files changed (2) hide show
  1. config.yaml +1 -1
  2. test_model.py +22 -0
config.yaml CHANGED
@@ -1,6 +1,6 @@
1
  model:
2
  path: 'VietCat/GTSRB-Model/models/GTSRB.pt' # Path to the YOLO model on Hugging Face Hub (will be downloaded automatically)
3
- confidence_threshold: 0.5 # Minimum confidence for detections
4
 
5
  inference:
6
  box_color: (128, 0, 128) # Purple color for bounding boxes (BGR format)
 
1
  model:
2
  path: 'VietCat/GTSRB-Model/models/GTSRB.pt' # Path to the YOLO model on Hugging Face Hub (will be downloaded automatically)
3
+ confidence_threshold: 0.25 # Minimum confidence for detections
4
 
5
  inference:
6
  box_color: (128, 0, 128) # Purple color for bounding boxes (BGR format)
test_model.py ADDED
@@ -0,0 +1,22 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import cv2
2
+ import numpy as np
3
+ from model import TrafficSignDetector
4
+
5
+ # Load detector
6
+ detector = TrafficSignDetector('config.yaml')
7
+
8
+ # Test with a sample image (you can replace with your image path)
9
+ # For now, create a dummy image or load from file
10
+ # Assuming you have an image file, e.g., 'sample.jpg'
11
+ image_path = 'sample.jpg' # Replace with actual path
12
+ image = cv2.imread(image_path)
13
+ if image is None:
14
+ print("Image not found. Creating a dummy image.")
15
+ image = np.zeros((456, 427, 3), dtype=np.uint8)
16
+
17
+ print(f"Test image shape: {image.shape}")
18
+
19
+ # Perform detection
20
+ result = detector.detect(image.copy()) # Copy to avoid modifying original
21
+
22
+ print("Detection completed.")