-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #20 from naseemap47/tracker
Tracker
- Loading branch information
Showing
4 changed files
with
78 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,7 +9,6 @@ | |
import json | ||
import pandas as pd | ||
from model_utils import get_yolo, color_picker_fn, get_system_stat | ||
# from ultralytics import YOLO | ||
|
||
|
||
p_time = 0 | ||
|
@@ -52,7 +51,7 @@ | |
model = custom(path_or_model=path_model_file, gpu=True) | ||
|
||
# YOLOv8 Model | ||
if model_type == 'YOLOv8': | ||
elif model_type == 'YOLOv8': | ||
from ultralytics import YOLO | ||
model = YOLO(path_model_file) | ||
|
||
|
@@ -62,6 +61,8 @@ | |
# Inference Mode | ||
options = st.sidebar.radio( | ||
'Options:', ('Webcam', 'Image', 'Video', 'RTSP'), index=1) | ||
|
||
tracker = st.sidebar.selectbox("Choose Tracker", ("Tracker", "bytetrack", "botsort")) | ||
|
||
# Confidence | ||
confidence = st.sidebar.slider( | ||
|
@@ -91,7 +92,11 @@ | |
FRAME_WINDOW.image(img, channels='BGR') | ||
|
||
if pred: | ||
img, current_no_class = get_yolo(img, model_type, model, confidence, color_pick_list, class_labels, draw_thick) | ||
img, current_no_class = get_yolo( | ||
img, model_type, model, confidence, | ||
color_pick_list, class_labels, draw_thick, | ||
Tracker=tracker | ||
) | ||
FRAME_WINDOW.image(img, channels='BGR') | ||
|
||
# Current number of classes | ||
|
@@ -107,7 +112,7 @@ | |
st.dataframe(df_fq, use_container_width=True) | ||
|
||
# Video | ||
if options == 'Video': | ||
elif options == 'Video': | ||
upload_video_file = st.sidebar.file_uploader( | ||
'Upload Video', type=['mp4', 'avi', 'mkv']) | ||
if upload_video_file is not None: | ||
|
@@ -120,7 +125,7 @@ | |
|
||
|
||
# Web-cam | ||
if options == 'Webcam': | ||
elif options == 'Webcam': | ||
cam_options = st.sidebar.selectbox('Webcam Channel', | ||
('Select Channel', '0', '1', '2', '3')) | ||
|
||
|
@@ -130,7 +135,7 @@ | |
|
||
|
||
# RTSP | ||
if options == 'RTSP': | ||
elif options == 'RTSP': | ||
rtsp_url = st.sidebar.text_input( | ||
'RTSP URL:', | ||
'eg: rtsp://admin:[email protected]/cam/realmonitor?channel=0&subtype=0' | ||
|
@@ -152,7 +157,11 @@ | |
) | ||
break | ||
|
||
img, current_no_class = get_yolo(img, model_type, model, confidence, color_pick_list, class_labels, draw_thick) | ||
img, current_no_class = get_yolo( | ||
img, model_type, model, confidence, | ||
color_pick_list, class_labels, draw_thick, | ||
Tracker=tracker | ||
) | ||
FRAME_WINDOW.image(img, channels='BGR') | ||
|
||
# FPS | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
# Ultralytics YOLO 🚀, AGPL-3.0 license | ||
# Default YOLO tracker settings for BoT-SORT tracker https://github.com/NirAharon/BoT-SORT | ||
|
||
tracker_type: botsort # tracker type, ['botsort', 'bytetrack'] | ||
track_high_thresh: 0.5 # threshold for the first association | ||
track_low_thresh: 0.1 # threshold for the second association | ||
new_track_thresh: 0.6 # threshold for init new track if the detection does not match any tracks | ||
track_buffer: 30 # buffer to calculate the time when to remove tracks | ||
match_thresh: 0.8 # threshold for matching tracks | ||
fuse_score: True # Whether to fuse confidence scores with the iou distances before matching | ||
# min_box_area: 10 # threshold for min box areas(for tracker evaluation, not used for now) | ||
|
||
# BoT-SORT settings | ||
gmc_method: sparseOptFlow # method of global motion compensation | ||
# ReID model related thresh (not supported yet) | ||
proximity_thresh: 0.5 | ||
appearance_thresh: 0.25 | ||
with_reid: False |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
# Ultralytics YOLO 🚀, AGPL-3.0 license | ||
# Default YOLO tracker settings for ByteTrack tracker https://github.com/ifzhang/ByteTrack | ||
|
||
tracker_type: bytetrack # tracker type, ['botsort', 'bytetrack'] | ||
track_high_thresh: 0.5 # threshold for the first association | ||
track_low_thresh: 0.1 # threshold for the second association | ||
new_track_thresh: 0.6 # threshold for init new track if the detection does not match any tracks | ||
track_buffer: 30 # buffer to calculate the time when to remove tracks | ||
match_thresh: 0.8 # threshold for matching tracks | ||
fuse_score: True # Whether to fuse confidence scores with the iou distances before matching | ||
# min_box_area: 10 # threshold for min box areas(for tracker evaluation, not used for now) |