This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def input_parser(obj_type=None, min_value=None, max_value=None, clip=False): | |
if obj_type in (int, float) and min_value is not None and max_value is not None and min_value > max_value: | |
raise ValueError("Minimum value (" + str(min_value) + ") is greater than maximum value (" + str(max_value) + ")") | |
def input_parser_value(value): | |
if obj_type is not None: | |
value = obj_type(value) | |
if obj_type in (int, float): | |
if min_value is not None and value < min_value: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
Python function to simulate Windows timeout command | |
NOTE: It may not work on Linux due to mvscrt library | |
""" | |
from msvcrt import getch, kbhit | |
from time import sleep | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"""Auto commands line generator from parameteres dictionary. | |
Example: | |
>>> params_dict = { | |
"--model_path": ["model1.hdf5", "model2.hdf5"], | |
"--debug": True, | |
"--score": [0.1, 0.2], | |
"--iou": [0.3, 0.4] | |
} |