dyhBUPT / StrongSORT

[TMM 2023] StrongSORT: Make DeepSORT Great Again
GNU General Public License v3.0
746 stars 75 forks source link

question about cascade levels match #100

Closed knowlessthanenough closed 9 months ago

knowlessthanenough commented 9 months ago

i base on deepSORT and add each of the changes, first NSA then EMA, MC, finally woC. before woC everything seem very well the performence increase. however when i add woC the profomence decrease a all, i can see the id switch even nothing block the object. i want to know if i make anything wrong ?

Here is the part of code i change for adding woC:

def matching_cascade(
        distance_metric, max_distance, cascade_depth, tracks, detections,
        track_indices=None, detection_indices=None):
    """Run matching cascade.

    Parameters
    ----------
    distance_metric : Callable[List[Track], List[Detection], List[int], List[int]) -> ndarray
        The distance metric is given a list of tracks and detections as well as
        a list of N track indices and M detection indices. The metric should
        return the NxM dimensional cost matrix, where element (i, j) is the
        association cost between the i-th track in the given track indices and
        the j-th detection in the given detection indices.
    max_distance : float
        Gating threshold. Associations with cost larger than this value are
        disregarded.
    cascade_depth: int
        The cascade depth, should be se to the maximum track age.
    tracks : List[track.Track]
        A list of predicted tracks at the current time step.
    detections : List[detection.Detection]
        A list of detections at the current time step.
    track_indices : Optional[List[int]]
        List of track indices that maps rows in `cost_matrix` to tracks in
        `tracks` (see description above). Defaults to all tracks.
    detection_indices : Optional[List[int]]
        List of detection indices that maps columns in `cost_matrix` to
        detections in `detections` (see description above). Defaults to all
        detections.

    Returns
    -------
    (List[(int, int)], List[int], List[int])
        Returns a tuple with the following three entries:
        * A list of matched track and detection indices.
        * A list of unmatched track indices.
        * A list of unmatched detection indices.

    """
    if track_indices is None:
        track_indices = list(range(len(tracks)))
    if detection_indices is None:
        detection_indices = list(range(len(detections)))

    unmatched_detections = detection_indices
    matches = []
    if opt.woC:
        track_indices_l = [
            k for k in track_indices
            # if tracks[k].time_since_update == 1 + level
        ]
        matches_l, _, unmatched_detections = \
            min_cost_matching(
                distance_metric, max_distance, tracks, detections,
                track_indices_l, unmatched_detections)
        matches += matches_l
    else:
        for level in range(cascade_depth):
            if len(unmatched_detections) == 0:  # No detections left
                break

            track_indices_l = [
                k for k in track_indices
                if tracks[k].time_since_update == 1 + level
            ]
            if len(track_indices_l) == 0:  # Nothing to match at this level
                continue

            matches_l, _, unmatched_detections = \
                min_cost_matching(
                    distance_metric, max_distance, tracks, detections,
                    track_indices_l, unmatched_detections)
            matches += matches_l
    unmatched_tracks = list(set(track_indices) - set(k for k, _ in matches))
    return matches, unmatched_tracks, unmatched_detections

i copy the woC part of code and replace the orginal one, i run on https://motchallenge.net/vis/MOT17-08-SDP video.

dyhBUPT commented 9 months ago

Hi, what detector and appearance feature extractor do you apply? And, could you please provide your experiment results (MOTA / IDF1 / HOTA / ... )?

knowlessthanenough commented 9 months ago

i am using yolov7-tiny and osnet as feature extractor, here is the link to the output video.https://hkuhk-my.sharepoint.com/:f:/g/personal/tsunchak_hku_hk/En_gtsKn-pFNgGi3rtoJ2p4BcPrdqor8ffszWqGm2gbQhg?e=bwCPaC

dyhBUPT commented 9 months ago

It is common that some tricks lose efficacy in specific settings and cases. If you want to figure out the reason why "woC" doesn't work, you should compare the two visualization results carefully. Best wishes.

knowlessthanenough commented 9 months ago

Thank you very much for respond .May I ask if I modify the correct part ? is this the only part that I have to modify?

dyhBUPT commented 9 months ago

I think you're right.