Open utsembedded opened 3 years ago
Hello, Assuming your object detection works, you can use this skeleton code to implement tracking on a live video:
import sort, cv2, numpy
def main():
cap = cv2.VideoCapture(0) # Open the webcam feed
tracker = sort.Sort(max_age=0.5, min_hits=0.5, iou_threshold=0.5)
# Load your object detector network here
while True:
img = cap.read()
# perform your detections + NMS here
# Store the detections in the Sort acceptable format. E.g. for Darknet,
# I get bounding boxes + confidence scores
# Here I am assuming detections is formatted as a numpy array of: [[x1, y1, x2, y2, confidence]].
tracks = tracker.update(detections)
# tracks gives you a 2D numpy array in the format [[x1, y1, x2, y2, tracked_id]]
# Add your display code here
cap.release()):
But are we making detections on every single frame? then what is the point of using tracker? How can we get updating bounding box locations using tracker without passing detections?
HI ,
How can i use this application to track objects using my camera with live feed .