Show sub label in debug view when available (#7567)

* Show sub label in debug view if available

* Ensure sub label is printable to be used
This commit is contained in:
Nicolas Mowen
2023-09-01 06:03:47 -06:00
committed by GitHub
parent bbdf5e1bee
commit 45f7db5cf1
2 changed files with 16 additions and 1 deletions

View File

@@ -4,6 +4,7 @@ import datetime
import logging
from abc import ABC, abstractmethod
from multiprocessing import shared_memory
from string import printable
from typing import AnyStr, Optional
import cv2
@@ -154,6 +155,11 @@ def draw_box_with_label(
)
def is_label_printable(label) -> bool:
"""Check if label is printable."""
return not bool(set(label) - set(printable))
def calculate_region(frame_shape, xmin, ymin, xmax, ymax, model_size, multiplier=2):
# size is the longest edge and divisible by 4
size = int((max(xmax - xmin, ymax - ymin) * multiplier) // 4 * 4)