Skip to content

Commit

Permalink
feat: ReId 객체의 embedding dim을 faiss 초기화에 이용
Browse files Browse the repository at this point in the history
  • Loading branch information
guk98 committed Jul 30, 2023
1 parent 24fe523 commit 4958483
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions re_id/module/reid.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,15 +45,15 @@ def __init__(self, model, checkpoint, gallery_path=None, person_thr=0.6, cosine_
self.cluster = None

random_tensor = torch.randn(1, 3, 224, 224).to(self.device)
embedding_dim = self.model(random_tensor).shape[-1]
self.embedding_dim = self.model(random_tensor).shape[-1]

self.player_dict = dict()

self.person_thr = person_thr
self.cosine_thr = cosine_thr

res = faiss.StandardGpuResources()
self.faiss_index = faiss.GpuIndexFlatIP(res, embedding_dim)
self.faiss_index = faiss.GpuIndexFlatIP(res, self.embedding_dim)
self.faiss_index = faiss.IndexIDMap(self.faiss_index)

self.gallery_path = gallery_path
Expand Down Expand Up @@ -180,7 +180,7 @@ def init_gallery(self, frames):
frames (list): (3, W, H) * (person) * (frames num)
"""

accumulated_query_vector = np.empty((0, 1000), dtype=np.float32)
accumulated_query_vector = np.empty((0, self.embedding_dim), dtype=np.float32)

for frame in frames:
person_img_lst = []
Expand Down

0 comments on commit 4958483

Please sign in to comment.