Merge PIL and OpenCV in plot_one_box(use_pil=False) (#4416)

* Merge PIL and OpenCV box plotting functions

* Add ASCII check to plot_one_box

* Cleanup

* Cleanup2
This commit is contained in:
Glenn Jocher authored and GitHub committed 2021-08-14 17:44:15 +02:00
1 parent 63e09fdc48
commit 2da4e7acf7
4 files changed
+34 -31

No files matched your search

+1 -1
View File
@@ -156,7 +156,7 @@ def run(weights='yolov5s.pt', # model.pt path(s)
if save_img or save_crop or view_img: # Add bbox to image
c = int(cls) # integer class
label = None if hide_labels else (names[c] if hide_conf else f'{names[c]} {conf:.2f}')
plot_one_box(xyxy, im0, label=label, color=colors(c, True), line_thickness=line_thickness)
im0 = plot_one_box(xyxy, im0, label=label, color=colors(c, True), line_width=line_thickness)
if save_crop:
save_one_box(xyxy, imc, file=save_dir / 'crops' / names[c] / f'{p.stem}.jpg', BGR=True)