當前位置: 首頁>>代碼示例>>Python>>正文


Python nn_matching.NearestNeighborDistanceMetric方法代碼示例

本文整理匯總了Python中deep_sort.nn_matching.NearestNeighborDistanceMetric方法的典型用法代碼示例。如果您正苦於以下問題:Python nn_matching.NearestNeighborDistanceMetric方法的具體用法?Python nn_matching.NearestNeighborDistanceMetric怎麽用?Python nn_matching.NearestNeighborDistanceMetric使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在deep_sort.nn_matching的用法示例。


在下文中一共展示了nn_matching.NearestNeighborDistanceMetric方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: __init__

# 需要導入模塊: from deep_sort import nn_matching [as 別名]
# 或者: from deep_sort.nn_matching import NearestNeighborDistanceMetric [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() 
開發者ID:Kestrong,項目名稱:capture_reid,代碼行數:25,代碼來源:main.py

示例2: __init__

# 需要導入模塊: from deep_sort import nn_matching [as 別名]
# 或者: from deep_sort.nn_matching import NearestNeighborDistanceMetric [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 
開發者ID:oulutan,項目名稱:ACAM_Demo,代碼行數:38,代碼來源:object_detector.py


注:本文中的deep_sort.nn_matching.NearestNeighborDistanceMetric方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。