我运行grounded_sam2_tracking_demo_with_continuous_id.py 报错:
propagate in video: 5%|████████▌ | 1/21 [00:00<00:01, 15.72it/s]
Traceback (most recent call last): | 0/21 [00:00<?, ?it/s]
File "/inspire/hdd/project/video-understanding/public/personal/xyhe/grounded_sam2_tracking_demo_with_continuous_id_test.py", line 211, in
for out_frame_idx, out_obj_ids, out_mask_logits in video_predictor.propagate_in_video(inference_state, max_frame_num_to_track=step, start_frame_idx=start_frame_idx):
File "/opt/conda/lib/python3.12/site-packages/torch/utils/_contextlib.py", line 57, in generator_context
response = gen.send(request)
^^^^^^^^^^^^^^^^^
File "/inspire/hdd/project/video-understanding/public/personal/xyhe/Grounded_SAM_2/sam2/sam2_video_predictor.py", line 733, in propagate_in_video
current_out, pred_masks = self._run_single_frame_inference(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/inspire/hdd/project/video-understanding/public/personal/xyhe/Grounded_SAM_2/sam2/sam2_video_predictor.py", line 1076, in _run_single_frame_inference
current_out = self.track_step(
^^^^^^^^^^^^^^^^
File "/inspire/hdd/project/video-understanding/public/personal/xyhe/Grounded_SAM_2/sam2/modeling/sam2_base.py", line 833, in track_step
current_out, sam_outputs, _, _ = self._track_step(
^^^^^^^^^^^^^^^^^
File "/inspire/hdd/project/video-understanding/public/personal/xyhe/Grounded_SAM_2/sam2/modeling/sam2_base.py", line 759, in _track_step
pix_feat = self._prepare_memory_conditioned_features(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/inspire/hdd/project/video-understanding/public/personal/xyhe/Grounded_SAM_2/sam2/modeling/sam2_base.py", line 665, in _prepare_memory_conditioned_features
pix_feat_with_mem = self.memory_attention(
^^^^^^^^^^^^^^^^^^^^^^
File "/opt/conda/lib/python3.12/site-packages/torch/nn/modules/module.py", line 1739, in _wrapped_call_impl
return self._call_impl(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/conda/lib/python3.12/site-packages/torch/nn/modules/module.py", line 1750, in _call_impl
return forward_call(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/inspire/hdd/project/video-understanding/public/personal/xyhe/Grounded_SAM_2/sam2/modeling/memory_attention.py", line 155, in forward
output = layer(
^^^^^^
File "/opt/conda/lib/python3.12/site-packages/torch/nn/modules/module.py", line 1739, in _wrapped_call_impl
return self._call_impl(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/conda/lib/python3.12/site-packages/torch/nn/modules/module.py", line 1750, in _call_impl
return forward_call(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/inspire/hdd/project/video-understanding/public/personal/xyhe/Grounded_SAM_2/sam2/modeling/memory_attention.py", line 94, in forward
tgt = self._forward_ca(tgt, memory, query_pos, pos, num_k_exclude_rope)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/inspire/hdd/project/video-understanding/public/personal/xyhe/Grounded_SAM_2/sam2/modeling/memory_attention.py", line 74, in _forward_ca
tgt2 = self.cross_attn_image(
^^^^^^^^^^^^^^^^^^^^^^
File "/opt/conda/lib/python3.12/site-packages/torch/nn/modules/module.py", line 1739, in _wrapped_call_impl
return self._call_impl(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/conda/lib/python3.12/site-packages/torch/nn/modules/module.py", line 1750, in call_impl
return forward_call(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/inspire/hdd/project/video-understanding/public/personal/xyhe/Grounded_SAM_2/sam2/modeling/sam/transformer.py", line 333, in forward
q, k[:, :, :num_k_rope] = apply_rotary_enc(
^^^^^^^^^^^^^^^^^
File "/inspire/hdd/project/video-understanding/public/personal/xyhe/Grounded_SAM_2/sam2/modeling/position_encoding.py", line 220, in apply_rotary_enc
xk_out = torch.view_as_real(xk * freqs_cis).flatten(3)
~~~~^~~~~~~~~~~
RuntimeError: The size of tensor a (4100) must match the size of tensor b (4096) at non-singleton dimension 2
这是什么原因呢?
我运行grounded_sam2_tracking_demo_with_continuous_id.py 报错:
propagate in video: 5%|████████▌ | 1/21 [00:00<00:01, 15.72it/s]
Traceback (most recent call last): | 0/21 [00:00<?, ?it/s]
File "/inspire/hdd/project/video-understanding/public/personal/xyhe/grounded_sam2_tracking_demo_with_continuous_id_test.py", line 211, in
for out_frame_idx, out_obj_ids, out_mask_logits in video_predictor.propagate_in_video(inference_state, max_frame_num_to_track=step, start_frame_idx=start_frame_idx):
File "/opt/conda/lib/python3.12/site-packages/torch/utils/_contextlib.py", line 57, in generator_context
response = gen.send(request)
^^^^^^^^^^^^^^^^^
File "/inspire/hdd/project/video-understanding/public/personal/xyhe/Grounded_SAM_2/sam2/sam2_video_predictor.py", line 733, in propagate_in_video
current_out, pred_masks = self._run_single_frame_inference(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/inspire/hdd/project/video-understanding/public/personal/xyhe/Grounded_SAM_2/sam2/sam2_video_predictor.py", line 1076, in _run_single_frame_inference
current_out = self.track_step(
^^^^^^^^^^^^^^^^
File "/inspire/hdd/project/video-understanding/public/personal/xyhe/Grounded_SAM_2/sam2/modeling/sam2_base.py", line 833, in track_step
current_out, sam_outputs, _, _ = self._track_step(
^^^^^^^^^^^^^^^^^
File "/inspire/hdd/project/video-understanding/public/personal/xyhe/Grounded_SAM_2/sam2/modeling/sam2_base.py", line 759, in _track_step
pix_feat = self._prepare_memory_conditioned_features(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/inspire/hdd/project/video-understanding/public/personal/xyhe/Grounded_SAM_2/sam2/modeling/sam2_base.py", line 665, in _prepare_memory_conditioned_features
pix_feat_with_mem = self.memory_attention(
^^^^^^^^^^^^^^^^^^^^^^
File "/opt/conda/lib/python3.12/site-packages/torch/nn/modules/module.py", line 1739, in _wrapped_call_impl
return self._call_impl(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/conda/lib/python3.12/site-packages/torch/nn/modules/module.py", line 1750, in _call_impl
return forward_call(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/inspire/hdd/project/video-understanding/public/personal/xyhe/Grounded_SAM_2/sam2/modeling/memory_attention.py", line 155, in forward
output = layer(
^^^^^^
File "/opt/conda/lib/python3.12/site-packages/torch/nn/modules/module.py", line 1739, in _wrapped_call_impl
return self._call_impl(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/conda/lib/python3.12/site-packages/torch/nn/modules/module.py", line 1750, in _call_impl
return forward_call(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/inspire/hdd/project/video-understanding/public/personal/xyhe/Grounded_SAM_2/sam2/modeling/memory_attention.py", line 94, in forward
tgt = self._forward_ca(tgt, memory, query_pos, pos, num_k_exclude_rope)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/inspire/hdd/project/video-understanding/public/personal/xyhe/Grounded_SAM_2/sam2/modeling/memory_attention.py", line 74, in _forward_ca
tgt2 = self.cross_attn_image(
^^^^^^^^^^^^^^^^^^^^^^
File "/opt/conda/lib/python3.12/site-packages/torch/nn/modules/module.py", line 1739, in _wrapped_call_impl
return self._call_impl(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/opt/conda/lib/python3.12/site-packages/torch/nn/modules/module.py", line 1750, in call_impl
return forward_call(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/inspire/hdd/project/video-understanding/public/personal/xyhe/Grounded_SAM_2/sam2/modeling/sam/transformer.py", line 333, in forward
q, k[:, :, :num_k_rope] = apply_rotary_enc(
^^^^^^^^^^^^^^^^^
File "/inspire/hdd/project/video-understanding/public/personal/xyhe/Grounded_SAM_2/sam2/modeling/position_encoding.py", line 220, in apply_rotary_enc
xk_out = torch.view_as_real(xk * freqs_cis).flatten(3)
~~~~^~~~~~~~~~~
RuntimeError: The size of tensor a (4100) must match the size of tensor b (4096) at non-singleton dimension 2
这是什么原因呢?