tryolabs / norfair

Lightweight Python library for adding real-time multi-object tracking to any detector.

Home Page:https://tryolabs.github.io/norfair/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

type object 'Color' has no attribute 'random'

MeriemSlimani opened this issue · comments

commented

Describe the bug
python demo.py <video> returns AttributeError : type object 'Color' has no attribute 'random'

To Reproduce
python demo.py <video>

Expected behavior
output video

Screenshots or videos
Traceback (most recent call last):
File "...\norfair\demos\3d_track\src\demo.py", line 95, in
frame = draw_3d_tracked_boxes(
File "...\norfair\norfair\demos\3d_track\src\utils.py", line 149, in draw_3d_tracked_boxes
color = Color.random(obj.id)
AttributeError: type object 'Color' has no attribute 'random'

Environment (please complete the following information):

  • OS: Windows 11[e.g. Ubuntu 20.04]
  • Python version: 3.9.15
  • Norfair version: 2.2.0

Hi @Myriam34, thanks for pointing out that bug. We recently redesigned Norfair's drawing, and we missed updating this demo. We'll work on the bug fix.

Meanwhile, you can replace the line where the problem occurs with the following (please see that you also need to import the Palette class):

from norfair import Palette

...

        if border_colors is None:
            color = Palette.choose_color(obj.id)