levan92 / deep_sort_realtime

A really more real-time adaptation of deep sort
MIT License
166 stars 51 forks source link

Change Default Embedder #58

Open Hemilibeatriz opened 2 months ago

Hemilibeatriz commented 2 months ago

Hi! Thanks for this great repo!

Can you or anyone explain me how can i change the default embedder model in this code:

from deep_sort_realtime.deepsort_tracker import DeepSort
tracker = DeepSort(max_age=5, embedder='torchreid')
bbs = object_detector.detect(frame) 
tracks = tracker.update_tracks(bbs, frame=frame) # bbs expected to be a list of detections, each in tuples of ( [left,top,w,h], confidence, detection_class )
for track in tracks:
    if not track.is_confirmed():
        continue
    track_id = track.track_id
    ltrb = track.to_ltrb()

I made

embedder_model_name = "osnet_ain_x1_0"

# Inicializar o DeepSort com ReID usando TorchReID
tracker = DeepSort(max_age=5, embedder=embedder_model_name)

But i got

Traceback (most recent call last):
  File "C:/Users/hemil/Desktop/v5ds380/reid.py", line 14, in <module>
    tracker = DeepSort(max_age=5, embedder=embedder_model_name)
  File "C:\Users\hemil\Desktop\v5ds380\venv\lib\site-packages\deep_sort_realtime\deepsort_tracker.py", line 102, in __init__
    raise Exception(f"Embedder {embedder} is not a valid choice.")
Exception: Embedder osnet_ain_x1_0 is not a valid choice.

And i have this model installed

Woodthorne commented 1 month ago

The embedder argument for DeepSort is supposed to be a string chosen from 'mobilenet', 'torchreid', 'clip_RN50', 'clip_RN101', 'clip_RN50x4', 'clip_RN50x16', 'clip_ViT-B/32' and 'clip_ViT-B/16'. If you have your own embedder you wish to use you'll have to construct using DeepSort(..., embedder = None, ...) and then provide your own embeds to tracker.update_tracks().