mikel-brostrom / boxmot

BoxMOT: pluggable SOTA tracking modules for segmentation, object detection and pose estimation models
GNU Affero General Public License v3.0
6.79k stars 1.72k forks source link

Can't load the clip_vehicleid.pt weights #1155

Closed shreejalt closed 1 year ago

shreejalt commented 1 year ago

Search before asking

Question

Hi @mikel-brostrom , I wanted to run the vehicle ReID model using Boxmot and when I tried to initialize the model weights I get the following error. It will be very helpful if you can help me with this.

tracker = DeepOCSORT(model_weights=Path('clip_vehicleid.pt'),fp16=True, device='cuda:0')
Resized position embedding: %s to %s torch.Size([197, 768]) torch.Size([129, 768])
Position embedding resize to height:16 width: 8
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Users/shreejaltrivedi/miniforge3/envs/dl-env/lib/python3.8/site-packages/boxmot/trackers/deepocsort/deep_ocsort.py", line 349, in __init__
    self.model = ReIDDetectMultiBackend(weights=model_weights, device=device, fp16=fp16)
  File "/Users/shreejaltrivedi/miniforge3/envs/dl-env/lib/python3.8/site-packages/boxmot/appearance/reid_multibackend.py", line 85, in __init__
    load_pretrained_weights(self.model, w)
  File "/Users/shreejaltrivedi/miniforge3/envs/dl-env/lib/python3.8/site-packages/boxmot/appearance/reid_model_factory.py", line 176, in load_pretrained_weights
    model.load_param(str(weight_path))
  File "/Users/shreejaltrivedi/miniforge3/envs/dl-env/lib/python3.8/site-packages/boxmot/appearance/backbones/clip/make_model.py", line 129, in load_param
    self.state_dict()[i.replace('module.', '')].copy_(param_dict[i])
RuntimeError: The size of tensor a (129) must match the size of tensor b (257) at non-singleton dimension 0
shreejalt commented 1 year ago

Hi @mikel-brostrom If you can update me on this, it would be very helpful for my project

shreejalt commented 1 year ago

@mikel-brostrom

mikel-brostrom commented 1 year ago

Sorry for my late response. The link was wrong, it pointed to the VeRi model. This has now been fixed :rocket:. Let me know if it works for you :smile:

shreejalt commented 1 year ago

Hi @mikel-brostrom Thanks for your response. It still doesn't work whenever I try to load the vehicle based reid models.

Do we need to change anything in the config file? Beause the defaults.yml that you load has the test size of [256, 128] but in the original clip-reid repository the test size for vehicle based reid models is [256, 256]

shreejalt commented 1 year ago

This error is now coming

Resized position embedding: %s to %s torch.Size([197, 768]) torch.Size([129, 768])
Position embedding resize to height:16 width: 8
Traceback (most recent call last):
  File "test_tracker.py", line 6, in <module>
    tracker = DeepOCSORT(
  File "/Users/shreejaltrivedi/Documents/Repos/yolo_tracking/boxmot/trackers/deepocsort/deep_ocsort.py", line 349, in __init__
    self.model = ReIDDetectMultiBackend(weights=model_weights, device=device, fp16=fp16)
  File "/Users/shreejaltrivedi/Documents/Repos/yolo_tracking/boxmot/appearance/reid_multibackend.py", line 85, in __init__
    load_pretrained_weights(self.model, w)
  File "/Users/shreejaltrivedi/Documents/Repos/yolo_tracking/boxmot/appearance/reid_model_factory.py", line 176, in load_pretrained_weights
    model.load_param(str(weight_path))
  File "/Users/shreejaltrivedi/Documents/Repos/yolo_tracking/boxmot/appearance/backbones/clip/make_model.py", line 133, in load_param
    self.state_dict()[i.replace('module.', '')].copy_(param_dict[i])
RuntimeError: The size of tensor a (576) must match the size of tensor b (13164) at non-singleton dimension 0
mikel-brostrom commented 1 year ago

Now I believe that the model that is stored under that link is not correct. I cannot make it work. This reminded me why I never updated the link for this model :smile:.If you really need this for your project I recommend to check with the original authors of the repo: https://github.com/Syliz517/CLIP-ReID

github-actions[bot] commented 1 year ago

👋 Hello, this issue has been automatically marked as stale because it has not had recent activity. Please note it will be closed if no further activity occurs. Feel free to inform us of any other issues you discover or feature requests that come to mind in the future. Pull Requests (PRs) are also always welcomed!

shreejalt commented 1 year ago

Hi @mikel-brostrom DOes this repo support any other vehicle reid models? If the clip reid models are not working then its fine. But there are other models as well in fastreid framework related to vehicle id

github-actions[bot] commented 1 year ago

👋 Hello, this issue has been automatically marked as stale because it has not had recent activity. Please note it will be closed if no further activity occurs. Feel free to inform us of any other issues you discover or feature requests that come to mind in the future. Pull Requests (PRs) are also always welcomed!

dhanush-raj commented 8 months ago

@mikel-brostrom Is the issue now resolved? Because when I load the clip_vehicleid.pt it still shows the error. Or else if you have some other way to load any vehicle ReID can you point me to the right direction with some guide or links?

I have traffic videos (60fps) not able to count as with any tracker I run the ID switches happens frequently. So, please help me in this miserable situation.

ammarik commented 8 months ago

Hello, I have the same problem. Do you know if this can be solved somehow?

chensonglu commented 7 months ago

same problem