在yolov5中加入plot_one_box函数实现画图功能时,出现TypeError: 'Colors' object does not support indexing错误怎么办?

为了实现在视频流上显示内容,加入plot_one_box函数,但是运行时出现TypeError: 'Colors' object does not support indexing
错误,应该怎么解决呢?
在detect.py添加的plot_one_box

                    if save_img or view_img:  # Add bbox to image
                        label = '%s %.2f' % (names[int(cls)], conf)
                        plot_one_box(xyxy, im0, label=label, color=colors[int(cls)], line_thickness=3)


最后出现的错误结果:

Fusing layers... 
Model Summary: 213 layers, 7012822 parameters, 0 gradients
Traceback (most recent call last):
  File "D:/yolov5/detect.py", line 274, in <module>
    main(opt)
  File "D:/yolov5/detect.py", line 269, in main
    run(**vars(opt))
  File "D:\software\anaconda\envs\python330\lib\site-packages\torch\autograd\grad_mode.py", line 28, in decorate_context
    return func(*args, **kwargs)
  File "D:/yolov5/detect.py", line 190, in run
    plot_one_box(xyxy, im0, label=label, color=colors[int(cls)], line_thickness=3)
TypeError: 'Colors' object does not support indexing


将其改为color=colors(0, True)

Colors 你的代码里面有个大写的Colors,应该是小写的吧