报错only integer scalar arrays can be converted to a scalar index
color = colors[class_id]
修改为
color = np.array(colors)[class_id]
参考成功解决TypeError: only integer scalar arrays can be converted to a scalar index - 简书
报错Scalar value for argument 'color' is not numeric
颜色值不对
报错代码
cv2.rectangle(frame, (x, y), (x + w, y + h), color, 3)
修改:在使用前转换一下,添加一句
color = tuple([int(x) for x in color]) # 设置为整数
参考Scalar value for argument ‘color‘ is not numeric错误处理_superdont的技术博客_51CTO博客