def draw_bboxes(img, bboxes, classes, colors=None, show_classes=None, bbox_format='yolo', class_name=False, line_thickness=1):
    image = img.copy()
    show_classes = (classes if (show_classes is None) else show_classes)
    colors = ((0, 255, 0) if (colors is None) else colors)
    if (bbox_format == 'yolo'):
        for idx in range(len(bboxes)):
            bbox = bboxes[idx]
            cls = classes[idx]
            color = colors[idx]
            if (cls in show_classes):
                x1 = round((float(bbox[0]) * image.shape[1]))
                y1 = round((float(bbox[1]) * image.shape[0]))
                w = round(((float(bbox[2]) * image.shape[1]) / 2))
                h = round(((float(bbox[3]) * image.shape[0]) / 2))
                voc_bbox = ((x1 - w), (y1 - h), (x1 + w), (y1 + h))
                plot_one_box(voc_bbox, image, color=color, label=(cls if class_name else str(get_label(cls))), line_thickness=line_thickness)
    elif (bbox_format == 'coco'):
        for idx in range(len(bboxes)):
            bbox = bboxes[idx]
            cls = classes[idx]
            color = colors[idx]
            if (cls in show_classes):
                x1 = int(round(bbox[0]))
                y1 = int(round(bbox[1]))
                w = int(round(bbox[2]))
                h = int(round(bbox[3]))
                voc_bbox = (x1, y1, (x1 + w), (y1 + h))
                plot_one_box(voc_bbox, image, color=color, label=cls, line_thickness=line_thickness)
    elif (bbox_format == 'voc_pascal'):
        for idx in range(len(bboxes)):
            bbox = bboxes[idx]
            cls = classes[idx]
            cls_id = class_ids[idx]
            color = (colors[cls_id] if (type(colors) is list) else colors)
            if (cls in show_classes):
                x1 = int(round(bbox[0]))
                y1 = int(round(bbox[1]))
                x2 = int(round(bbox[2]))
                y2 = int(round(bbox[3]))
                voc_bbox = (x1, y1, x2, y2)
                plot_one_box(voc_bbox, image, color=color, label=(cls if class_name else str(cls_id)), line_thickness=line_thickness)
    else:
        raise ValueError('wrong bbox format')
    return image
def draw_bboxes(img, bboxes, classes, colors=None, show_classes=None, bbox_format='yolo', class_name=False, line_thickness=1):
    image = img.copy()
    show_classes = (classes if (show_classes is None) else show_classes)
    colors = ((0, 255, 0) if (colors is None) else colors)
    if (bbox_format == 'yolo'):
        for idx in range(len(bboxes)):
            bbox = bboxes[idx]
            cls = classes[idx]
            color = colors[idx]
            if (cls in show_classes):
                x1 = round((float(bbox[0]) * image.shape[1]))
                y1 = round((float(bbox[1]) * image.shape[0]))
                w = round(((float(bbox[2]) * image.shape[1]) / 2))
                h = round(((float(bbox[3]) * image.shape[0]) / 2))
                voc_bbox = ((x1 - w), (y1 - h), (x1 + w), (y1 + h))
                plot_one_box(voc_bbox, image, color=color, label=(cls if class_name else str(get_label(cls))), line_thickness=line_thickness)
    elif (bbox_format == 'coco'):
        for idx in range(len(bboxes)):
            bbox = bboxes[idx]
            cls = classes[idx]
            color = colors[idx]
            if (cls in show_classes):
                x1 = int(round(bbox[0]))
                y1 = int(round(bbox[1]))
                w = int(round(bbox[2]))
                h = int(round(bbox[3]))
                voc_bbox = (x1, y1, (x1 + w), (y1 + h))
                plot_one_box(voc_bbox, image, color=color, label=cls, line_thickness=line_thickness)
    elif (bbox_format == 'voc_pascal'):
        for idx in range(len(bboxes)):
            bbox = bboxes[idx]
            cls = classes[idx]
            cls_id = class_ids[idx]
            color = (colors[cls_id] if (type(colors) is list) else colors)
            if (cls in show_classes):
                x1 = int(round(bbox[0]))
                y1 = int(round(bbox[1]))
                x2 = int(round(bbox[2]))
                y2 = int(round(bbox[3]))
                voc_bbox = (x1, y1, x2, y2)
                plot_one_box(voc_bbox, image, color=color, label=(cls if class_name else str(cls_id)), line_thickness=line_thickness)
    else:
        raise ValueError('wrong bbox format')
    return image