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

+6 -1
View File
@@ -110,9 +110,14 @@ def is_pip():
return 'site-packages' in Path(__file__).absolute().parts
def is_ascii(str=''):
# Is string composed of all ASCII (no UTF) characters?
return len(str.encode().decode('ascii', 'ignore')) == len(str)
def emojis(str=''):
# Return platform-dependent emoji-safe version of string
return str.encode().decode(encoding='ascii', errors='ignore') if platform.system() == 'Windows' else str
return str.encode().decode('ascii', 'ignore') if platform.system() == 'Windows' else str
def file_size(file):