MCPcopy
hub / github.com/ultralytics/yolov5 / colorstr

Function colorstr

utils/general.py:686–709  ·  view source on GitHub ↗
(*input)

Source from the content-addressed store, hash-verified

684
685
686def colorstr(*input):
687 # Colors a string https://en.wikipedia.org/wiki/ANSI_escape_code, i.e. colorstr('blue', 'hello world')
688 *args, string = input if len(input) > 1 else ('blue', 'bold', input[0]) # color arguments, string
689 colors = {
690 'black': '\033[30m', # basic colors
691 'red': '\033[31m',
692 'green': '\033[32m',
693 'yellow': '\033[33m',
694 'blue': '\033[34m',
695 'magenta': '\033[35m',
696 'cyan': '\033[36m',
697 'white': '\033[37m',
698 'bright_black': '\033[90m', # bright colors
699 'bright_red': '\033[91m',
700 'bright_green': '\033[92m',
701 'bright_yellow': '\033[93m',
702 'bright_blue': '\033[94m',
703 'bright_magenta': '\033[95m',
704 'bright_cyan': '\033[96m',
705 'bright_white': '\033[97m',
706 'end': '\033[0m', # misc
707 'bold': '\033[1m',
708 'underline': '\033[4m'}
709 return ''.join(colors[x] for x in args) + f'{string}' + colors['end']
710
711
712def labels_to_class_weights(labels, nc=80):

Callers 15

runFunction · 0.90
trainFunction · 0.90
mainFunction · 0.90
export_torchscriptFunction · 0.90
export_onnxFunction · 0.90
export_openvinoFunction · 0.90
export_paddleFunction · 0.90
export_coremlFunction · 0.90
export_engineFunction · 0.90
export_saved_modelFunction · 0.90
export_pbFunction · 0.90
export_tfliteFunction · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected