kadirnar / strongsort-pip

StrongSort-Pip: Packaged version of StrongSort
MIT License
13 stars 2 forks source link

documentation about usage #4

Open ghost opened 1 year ago

ghost commented 1 year ago
from strong_sort import StrongSORT

tracker = StrongSORT(model_weights='model.pth', device='cuda')
pred = model(img)
for i, det in enumerate(pred):
    det[i] = tracker[i].update(detection, im0s)

in examples. 1)how add new tracker, because it's list,? 2)what is detection? 3)what is im0s? is it previous images or first image

kadirnar commented 1 year ago

Thank you for your interest. You can use the Torchyolo library. tracker = https://github.com/kadirnar/torchyolo/blob/main/torchyolo/modelhub/yolov5.py#L52-L57 detection = [[x,y,w,h,cls_id, score]] im0s = frame

Yolov5: https://github.com/kadirnar/torchyolo/blob/main/torchyolo/modelhub/yolov5.py Yolov6: https://github.com/kadirnar/torchyolo/blob/main/torchyolo/modelhub/yolov6.py Yolov7: https://github.com/kadirnar/torchyolo/blob/main/torchyolo/modelhub/yolov7.py Yolov8: https://github.com/kadirnar/torchyolo/blob/main/torchyolo/modelhub/yolov8.py

Hugging Face Demo: https://huggingface.co/spaces/kadirnar/torchyolo

ghost commented 1 year ago

i am trying to implement Strong Sort in my Code self.face_tracker = StrongSORT(max_age=100, model_weights="./models/osnet_x0_25_imagenet.pth", device='cpu', fp16=False) but i am getting error like this image

Error : Traceback (most recent call last): File "main.py", line 39, in main() File "main.py", line 32, in main cam_obj = Camera( pincode=pincode, File "/app/camera.py", line 43, in init self.face_tracker = StrongSORT(max_age=100, model_weights="./models/resnet50_market_xent.pt", device='cpu', File "/usr/local/lib/python3.8/site-packages/strongsort/strong_sort.py", line 33, in init self.model = ReIDDetectMultiBackend(weights=model_weights, device=device, fp16=fp16) File "/usr/local/lib/python3.8/site-packages/strongsort/reid_multibackend.py", line 88, in init model_name = get_model_name(w) File "/usr/local/lib/python3.8/site-packages/strongsort/deep/reid_model_factory.py", line 83, in get_model_name if x in model.name: AttributeError: 'str' object has no attribute 'name'

And when we arr trying to download weights it's coming in .pth bt script does not support for it

ghost commented 1 year ago

i am trying to implement Strong Sort in my Code self.face_tracker = StrongSORT(max_age=100, model_weights="./models/osnet_x0_25_imagenet.pth", device='cpu', fp16=False) but i am getting error like this image

Error : Traceback (most recent call last): File "main.py", line 39, in main() File "main.py", line 32, in main cam_obj = Camera( pincode=pincode, File "/app/camera.py", line 43, in init self.face_tracker = StrongSORT(max_age=100, model_weights="./models/resnet50_market_xent.pt", device='cpu', File "/usr/local/lib/python3.8/site-packages/strongsort/strong_sort.py", line 33, in init self.model = ReIDDetectMultiBackend(weights=model_weights, device=device, fp16=fp16) File "/usr/local/lib/python3.8/site-packages/strongsort/reid_multibackend.py", line 88, in init model_name = get_model_name(w) File "/usr/local/lib/python3.8/site-packages/strongsort/deep/reid_model_factory.py", line 83, in get_model_name if x in model.name: AttributeError: 'str' object has no attribute 'name'

And when we arr trying to download weights it's coming in .pth bt script does not support for it

I already descrive all such problems. https://github.com/kadirnar/strongsort-pip/issues/5 for name you should make StrongSORT(model_weights=Path('resnet50_fc512_dukemtmcreid.pt'), device='cuda', fp16=False) also don't forget to import Path

kadirnar commented 1 year ago

Kodumda Güçlü Sıralama uygulamaya çalışıyorum self.face_tracker = StrongSORT(max_age=100, model_weights="./models/osnet_x0_25_imagenet.pth", device='cpu', fp16=False) ama böyle bir hata alıyorum görüntü

Hata: Geri izleme (en son yapılan arama): Main () dosyasında "main.py" dosyası , satır 39 .py", satır 43, init self.face_tracker = StrongSORT(max_age=100, model_weights="./models/resnet50_market_xent.pt", device='cpu', Dosya "/usr/local/lib/python3.8/ site-packages/strongsort/strong_sort.py", satır 33, init self.model = ReIDDetectMultiBackend(weights=model_weights, device=device, fp16=fp16) Dosya "/usr/local/lib/python3.8/site-packages /strongsort/reid_multibackend.py", satır 88, init içinde model_adı = get_model_name(w)**** model.name'de x varsa get_model_name içindeki "/usr/local/lib/python3.8/site-packages/strongsort/deep/reid_model_factory.py" dosyası, satır 83 : AttributeError: 'str' nesnesinin 'name' özniteliği yok

Ve ağırlıkları indirmeye çalıştığımızda .pth olarak geliyor bt betiği bunu desteklemiyor

Could you try .pt instead of .pth?

ghost commented 1 year ago

Kodumda Güçlü Sıralama uygulamaya çalışıyorum self.face_tracker = StrongSORT(max_age=100, model_weights="./models/osnet_x0_25_imagenet.pth", device='cpu', fp16=False) ama böyle bir hata alıyorum görüntü Hata: Geri izleme (en son yapılan arama): Main () dosyasında "main.py" dosyası , satır 39 .py", satır 43, init self.face_tracker = StrongSORT(max_age=100, model_weights="./models/resnet50_market_xent.pt", device='cpu', Dosya "/usr/local/lib/python3.8/ site-packages/strongsort/strong_sort.py", satır 33, init self.model = ReIDDetectMultiBackend(weights=model_weights, device=device, fp16=fp16) Dosya "/usr/local/lib/python3.8/site-packages /strongsort/reid_multibackend.py", satır 88, init içinde model_adı = get_model_name(w)**** model.name'de x varsa get_model_name içindeki "/usr/local/lib/python3.8/site-packages/strongsort/deep/reid_model_factory.py" dosyası, satır 83 : AttributeError: 'str' nesnesinin 'name' özniteliği yok Ve ağırlıkları indirmeye çalıştığımızda .pth olarak geliyor bt betiği bunu desteklemiyor

Could you try .pt instead of .pth?

no ,the problem is not file extension,it's incorrect type of variable in code i wrote in another issue. You code expect Path type, but in description of def you wrote that it should be string

ghost commented 1 year ago

Thank you bro it' s working now

ghost commented 1 year ago

Thank you bro it' s working now

I must disappoint you, you just got the code working, but the tracker is not working, after studying the code, I found that many things that are in the original work strongSORT are not implemented here, so you need to take the code from the official repository, otherwise the quality of the result will be worse than in simple SORT