mikel-brostrom / boxmot

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

'DeepOCSort' object has no attribute 'reset' #1182

Closed ohj666 closed 1 year ago

ohj666 commented 1 year ago

Search before asking

Yolo Tracking Component

Tracking

Bug

Why i git clone this code.and run is AttributeError: 'DeepOCSort' object has no attribute 'reset'. my ultralytics==8.0.203 other is requestment.txt

Environment

python 3.9.18 cuda 1.11.0+cu113' 4060Ti cuda:0

Minimal Reproducible Example

None

mikel-brostrom commented 1 year ago

Your error is most certainly due to a wrong version of Ultralytics... Uninstall it and run track.py so that you get the right version automatically installed

ohj666 commented 1 year ago

Your error is most certainly due to a wrong version of Ultralytics... Uninstall it and run track.py so that you get the right version automatically installed

can you tell me your Ultralytics version? i try some Ultralytics all is same wrong.thank

luke110 commented 1 year ago

Your error is most certainly due to a wrong version of Ultralytics... Uninstall it and run track.py so that you get the right version automatically installed

can you tell me your Ultralytics version? i try some Ultralytics all is same wrong.thank

Is your problem solved?

chenke225 commented 1 year ago

If you want to use the latest version of Ultralytics, you can comment out the following two lines in ultralytics/trackers/track.py within the on_predict_postprocess_end(predictor, persist=False) function:

# Comment out these lines
# if not persist and predictor.vid_path[i] != str(predictor.save_dir / Path(path[i]).name):  # new video
#    predictor.trackers[i].reset()

In addition, change the line det = predictor.results[i].boxes.cpu().numpy() to:

det = predictor.results[i].boxes.data.cpu().numpy()

such that

def on_predict_postprocess_end(predictor, persist=False):
    """Postprocess detected boxes and update with object tracking."""
    bs = predictor.dataset.bs
    path, im0s = predictor.batch[:2]

    for i in range(bs):
        #if not persist and predictor.vid_path[i] != str(predictor.save_dir / Path(path[i]).name):  # new video
        #    predictor.trackers[i].reset()                         
        det = predictor.results[i].boxes.data.cpu().numpy()  
        if len(det) == 0:
            continue
        tracks = predictor.trackers[i].update(det, im0s[i])  
        if len(tracks) == 0:
            continue
        idx = tracks[:, -1].astype(int)
        predictor.results[i] = predictor.results[i][idx]
        predictor.results[i].update(boxes=torch.as_tensor(tracks[:, :-1]))
LuoFengQAQ commented 10 months ago

uninstall Ultralytics and run track.py directly.It will install the right version.