Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AttributeError: 'BOTSORT' object has no attribute 'plot_results' #1744

Open
1 task done
nadinator opened this issue Nov 18, 2024 · 5 comments
Open
1 task done

AttributeError: 'BOTSORT' object has no attribute 'plot_results' #1744

nadinator opened this issue Nov 18, 2024 · 5 comments
Labels
question Further information is requested

Comments

@nadinator
Copy link

nadinator commented Nov 18, 2024

Search before asking

  • I have searched the Yolo Tracking issues and found no similar bug report.

Question

Screenshot from 2024-11-18 10-42-51

I cloned the repository, installed all requirements, and thereafter ran python tracking/track.py and started running into the above error.

What's strange is that I'm not even using botsort, though it keeps reverting to that tracker even if I specify a different one, like I did in the screenshot by changing the setting of --tracking-method to "bytetrack".

OS: Ubuntu 20.04.6, python version 3.11.10, ultralytics version 8.3.32, boxmot installed from master with pip install -e .

@nadinator nadinator added the question Further information is requested label Nov 18, 2024
@nadinator
Copy link
Author

I found a workaround by adding the line to the yolo.track call specifying the tracker parameter, shown below. It turns out that ultralytics defaults to the botsort tracker if not otherwise specified. It does this via a callback that gets run right after the first prediction.

Screenshot from 2024-11-18 14-09-15

My workaround didn't solve the problem though. See below. Now it just tells me that BYTETracker has no plot_results method instead...

image

@mikel-brostrom
Copy link
Owner

Cannot reproduce

@AAleksandros
Copy link

I encountered a similar issue while using StrongSort as the tracking method. The error occurs when running track.py with the --show argument, and it outputs the following:

AttributeError: 'StrongSort' object has no attribute 'plot_results'

This seems consistent with the issue described here, except for a different tracker being used (StrongSort in my case instead of BOTSORT).

Steps to Reproduce:

  1. Clone the latest version of the boxmot repository.
  2. Install dependencies using Poetry as instructed.
  3. Run the following command in my tracking script (example):
    [
    "python", "boxmot/tracking/track.py",
    "--yolo-model", yolo_model,
    "--tracking-method", tracker,
    "--source", img1_path,
    "--device", "0",
    "--project", output_base_dir,
    "--name", output_name,
    "--exist-ok",
    "--save-txt",
    "--save",
    "--verbose",
    "--show"
    ]
  4. Observe the error mentioned above: AttributeError: 'StrongSort' object has no attribute 'plot_results'

Environment Details

Operating System: Ubuntu 24.04.1 LTS
Python Version: 3.12.3
PyTorch Version: 2.2.2+cu121
CUDA Version: 12.0
GPU: NVIDIA RTX 4090 with Driver Version 550.120
BoxMOT Version: 11.0.5
Dependency Manager: Poetry

Investigation & Fix:

I addressed this locally by adding a simple fallback check for plot_results using hasattr. Here's the relevant change in track.py:

    if hasattr(yolo.predictor.trackers[0], 'plot_results'):
        img = yolo.predictor.trackers[0].plot_results(r.orig_img, args.show_trajectories)
    else:
        print("Tracker does not support plot_results, skipping visualization.")
        img = r.orig_img  # Pass the original image without annotations

This fix resolves the issue for me without affecting trackers that already have the plot_results method implemented.

Running strongsort still doesn't show real-time bounding boxes with --show, but the output images are correct and without issue.

Let me know if this aligns with your observations or if further testing is needed. I'd be happy to contribute a pull request for this fix if it's helpful!

Thanks for your great work on this repository!

Copy link

github-actions bot commented Dec 9, 2024

👋 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!

@github-actions github-actions bot added the Stale label Dec 9, 2024
@AAleksandros
Copy link

Cannot reproduce

Please take a look at my comment above, thank you!

@github-actions github-actions bot removed the Stale label Dec 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

3 participants