Auto-UTF handling (#4594)
This commit is contained in:
1 parent
de44376d1b
commit
e5e5ebc799
3 files changed
+10
-8
No files matched your search
@@ -21,9 +21,9 @@ sys.path.append(FILE.parents[0].as_posix()) # add yolov5/ to path
|
||||
|
||||
from models.experimental import attempt_load
|
||||
from utils.datasets import LoadStreams, LoadImages
|
||||
from utils.general import check_img_size, check_requirements, check_imshow, colorstr, non_max_suppression, \
|
||||
from utils.general import check_img_size, check_requirements, check_imshow, colorstr, is_ascii, non_max_suppression, \
|
||||
apply_classifier, scale_coords, xyxy2xywh, strip_optimizer, set_logging, increment_path, save_one_box
|
||||
from utils.plots import colors, Annotator
|
||||
from utils.plots import Annotator, colors
|
||||
from utils.torch_utils import select_device, load_classifier, time_sync
|
||||
|
||||
|
||||
@@ -105,6 +105,7 @@ def run(weights='yolov5s.pt', # model.pt path(s)
|
||||
output_details = interpreter.get_output_details() # outputs
|
||||
int8 = input_details[0]['dtype'] == np.uint8 # is TFLite quantized uint8 model
|
||||
imgsz = check_img_size(imgsz, s=stride) # check image size
|
||||
ascii = is_ascii(names) # names are ascii (use PIL for UTF-8)
|
||||
|
||||
# Dataloader
|
||||
if webcam:
|
||||
@@ -181,7 +182,7 @@ def run(weights='yolov5s.pt', # model.pt path(s)
|
||||
s += '%gx%g ' % img.shape[2:] # print string
|
||||
gn = torch.tensor(im0.shape)[[1, 0, 1, 0]] # normalization gain whwh
|
||||
imc = im0.copy() if save_crop else im0 # for save_crop
|
||||
annotator = Annotator(im0, line_width=line_thickness, pil=False)
|
||||
annotator = Annotator(im0, line_width=line_thickness, pil=not ascii)
|
||||
if len(det):
|
||||
# Rescale boxes from img_size to im0 size
|
||||
det[:, :4] = scale_coords(img.shape[2:], det[:, :4], im0.shape).round()
|
||||
|
||||
Reference in new issue
Block a user