use a random string in the object id instead of the index

This commit is contained in:
Blake Blackshear 2020-07-26 07:22:45 -05:00
parent a8c0fadf95
commit 918386bdc1

View File

@ -5,6 +5,8 @@ import cv2
import itertools
import copy
import numpy as np
import random
import string
import multiprocessing as mp
from collections import defaultdict
from scipy.spatial import distance as dist
@ -17,7 +19,8 @@ class ObjectTracker():
self.max_disappeared = max_disappeared
def register(self, index, obj):
id = f"{obj['frame_time']}-{index}"
rand_id = ''.join(random.choices(string.ascii_lowercase + string.digits, k=6))
id = f"{obj['frame_time']}-{rand_id}"
obj['id'] = id
obj['start_time'] = obj['frame_time']
obj['top_score'] = obj['score']