本文整理汇总了Python中deep_sort.tracker.Tracker方法的典型用法代码示例。如果您正苦于以下问题:Python tracker.Tracker方法的具体用法?Python tracker.Tracker怎么用?Python tracker.Tracker使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类deep_sort.tracker
的用法示例。
在下文中一共展示了tracker.Tracker方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: from deep_sort import tracker [as 别名]
# 或者: from deep_sort.tracker import Tracker [as 别名]
def __init__(self, mode):
self.mode = mode
self.conf = capture_conf.env[mode]
self.init_sources(self.conf.source_paths)
self.detector = Predict.instance()
self.trackers = [Tracker(nn_matching.NearestNeighborDistanceMetric("cosine", self.conf.track_max_cosine_distance, self.conf.track_nn_budget),
max_iou_distance=self.conf.track_max_iou_distance,
max_age=self.conf.track_max_age,
n_init=self.conf.track_n_init)
for _ in self.sources_parsed]
self.track_pool = new_pools(self.conf.pool_size)
self.save_pool = new_pools(self.conf.pool_size)
self.frame_index = 0
self.video_state = False
if self.conf.video_on:
self.box_queue = queue.LifoQueue(100)
if self.conf.is_async:
submit(self.video_on)
self.debug = mode == 'dev'
if self.debug:
self.last_time = datetime.now()
self.fps = 0
self.pids = set()
示例2: __init__
# 需要导入模块: from deep_sort import tracker [as 别名]
# 或者: from deep_sort.tracker import Tracker [as 别名]
def __init__(self, timesteps=32):
self.active_actors = []
self.inactive_actors = []
self.actor_no = 0
self.frame_history = []
self.frame_no = 0
self.timesteps = timesteps
self.actor_infos = {}
# deep sort
self.encoder = create_box_encoder(MODEL_CKPT, batch_size=16)
metric = nn_matching.NearestNeighborDistanceMetric("cosine", 0.2, None) #, max_cosine_distance=0.2) #, nn_budget=None)
#self.tracker = ds_Tracker(metric, max_iou_distance=0.7, max_age=30, n_init=3)
#self.tracker = ds_Tracker(metric, max_iou_distance=0.7, max_age=200, n_init=1)
self.tracker = ds_Tracker(metric, max_iou_distance=0.7, max_age=200, n_init=5)
self.score_th = 0.40
#self.results = []
# def add_frame(self, frame):
# ''' Adds a new frame to the history.
# This is used when we dont want to run the obj detection and traking but want to keep the frames
# for action detection.
# '''
# H,W,C = frame.shape
# #initialize first
# if not self.frame_history:
# for _ in range(self.timesteps):
# self.frame_history.append(np.zeros([H,W,C], np.uint8))
# del self.frame_history[0]
# self.frame_history.append(frame)
# # if len(self.frame_history) == self.timesteps:
# # del self.frame_history[0]
# # self.frame_history.append(frame)
# # else:
# # self.frame_history.append(frame)
# self.frame_no += 1