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

DeepOCSORT: missing 2 required positional arguments: 'w' and 'h when using 'centroid' as associate function #1372

Closed grassjelly closed 7 months ago

grassjelly commented 8 months ago

Search before asking

Yolo Tracking Component

Tracking

Bug

I'm using DeepOCSort as a tracker with an external object detector. The tracking works for a few seconds but hits an error after a while. I think it's when no objects are detected on the frame.

Error: File "/usr/local/lib/python3.8/dist-packages/boxmot/trackers/deepocsort/deep_ocsort.py", line 462, in update object-tracker | [tracked_bbox_publisher.py-1] iou_left = self.asso_func(left_dets, left_trks) object-tracker | [tracked_bbox_publisher.py-1] TypeError: centroid_batch() missing 2 required positional arguments: 'w' and 'h

Environment

Minimal Reproducible Example

This is my update function

def update(self, detections, img) :
    tracked_objects = []
    if len(detections) == 0:
        detections = np.empty((0, 6))
    else:
        detections = np.array(detections)

    tracks = self._tracker.update(detections, img)
    if tracks.shape[0] != 0:
        xyxys = tracks[:, 0:4].astype('int') # float64 to int
        ids = tracks[:, 4].astype('int') # float64 to int
        confs = tracks[:, 5]
        clss = tracks[:, 6].astype('int') # float64 to int

        for xyxy, id, conf, cls in zip(xyxys, ids, confs, clss):
            tracked_objects.append([
                xyxy[0],
                xyxy[1],
                xyxy[2],
                xyxy[3],
                id,
                cls,
                conf
            ])

    return tracked_objects

and here's my config:

DEEP_OC_SORT:
  reid_weights: 'RESNET'
  device_id: 0                # Cuda GPU ID
  fp16: True                  # Enable FP16
  max_age: 1200
  per_class: True
  det_thresh: 0.3
  max_age: 30
  min_hits: 3
  iou_threshold: 0.3
  delta_t: 3
  asso_func: "centroid" #https://github.com/mikel-brostrom/yolo_tracking/issues/1246
  inertia: 0.2
  w_association_emb: 0.5
  alpha_fixed_emb: 0.95
  aw_param: 0.5
  embedding_off: False
  cmc_off: False
  aw_off: False
  new_kf_off: False
grassjelly commented 8 months ago

Just checked the code, should this line https://github.com/mikel-brostrom/yolo_tracking/blob/master/boxmot/trackers/deepocsort/deep_ocsort.py#L466 be using run_asso_func to prevent this from breaking similar to this https://github.com/mikel-brostrom/yolo_tracking/blob/master/boxmot/utils/association.py#L146 call?

something like:

iou_left = run_asso_func(self.asso_func, left_dets, left_trks, img.shape[1], img.shape[0])

userkw commented 8 months ago

@grassjelly can i ask you when i use this cmd line : python tracking/track.py --tracking-method deepocsort I changed the parameter value, like min_hit, from 1 to 3 in the file deepocsort.yaml, but it doesn't seem to consider it. It's like I didn't change anything. Any help?

github-actions[bot] commented 8 months 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!