def get_all_weights(weights_path="./weights/detect"): | |
from pathlib import Path | |
# 获取文件夹下所有文件(不包括文件夹) | |
all_weights = [ | |
str(f.stem) | |
for f in Path(weights_path).iterdir() | |
if Path(f).is_file() and Path(f).suffix == ".pth" | |
] | |
# print_info(all_weights) | |
return all_weights | |
def now_time(): | |
from datetime import datetime | |
return datetime.now().strftime(r"%Y-%m-%dT%H%M%S") | |
def print_info(text: str): | |
BEGIN_COLOR = "\033[32m" | |
END_COLOR = "\033[0m" | |
print(f"{BEGIN_COLOR}{text}{END_COLOR}") | |