File size: 585 Bytes
58da73e
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
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}")