colorstr() updates (#1909)

* W&B ImportError message fix

* colorstr() updates

* colorstr() updates

* colorstr() default to 'blue', 'bold'

* train: magenta

* train: blue
This commit is contained in:
Glenn Jocher authored and GitHub committed 2021-01-12 10:33:15 -08:00
1 parent 1d1c0567a4
commit dd03b20ba5
6 files changed
+46 -45

No files matched your search

+2 -3
View File
@@ -118,7 +118,7 @@ def one_cycle(y1=0.0, y2=1.0, steps=100):
def colorstr(*input):
# Colors a string https://en.wikipedia.org/wiki/ANSI_escape_code, i.e. colorstr('blue', 'hello world')
*prefix, string = input # color arguments, string
*args, string = input if len(input) > 1 else ('blue', 'bold', input[0]) # color arguments, string
colors = {'black': '\033[30m', # basic colors
'red': '\033[31m',
'green': '\033[32m',
@@ -138,8 +138,7 @@ def colorstr(*input):
'end': '\033[0m', # misc
'bold': '\033[1m',
'underline': '\033[4m'}
return ''.join(colors[x] for x in prefix) + f'{string}' + colors['end']
return ''.join(colors[x] for x in args) + f'{string}' + colors['end']
def labels_to_class_weights(labels, nc=80):