-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.py
More file actions
57 lines (43 loc) · 1.71 KB
/
Copy pathmain.py
File metadata and controls
57 lines (43 loc) · 1.71 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
# Main coordinator for Viet_Celeb_ReID_Tool
import json
import os
from google.oauth2 import service_account
from googleapiclient.discovery import build
from modules.check_sharpness import check_sharpness
CONFIG_PATH = "config.json"
SCOPES = ["https://www.googleapis.com/auth/drive.readonly"]
def load_config(path: str) -> dict:
if not os.path.exists(path):
raise FileNotFoundError(f"Không tìm thấy file config: {path}")
with open(path, "r", encoding="utf-8") as f:
return json.load(f)
def build_drive_service(credentials_path: str):
creds = service_account.Credentials.from_service_account_file(
credentials_path, scopes=SCOPES
)
return build("drive", "v3", credentials=creds, cache_discovery=False)
def main():
print("Viet Celeb ReID Tool is starting...")
# 1. Load config
config = load_config(CONFIG_PATH)
folder_id = config["folder_id"]
creds_path = config["credentials_path"]
cal_k = config.get("calibration_k", 1.0)
sample_limit= config.get("sample_limit", None)
# 2. Build Drive service
service = build_drive_service(creds_path)
# 3. Chạy các module kiểm tra
print("\n── check_sharpness ──────────────────────────")
sharpness_results = check_sharpness(
service=service,
folder_id=folder_id,
calibration_k=cal_k,
sample_limit=sample_limit,
verbose=True,
)
# 4. (Sau này thêm các module khác vào đây)
# naming_results = check_naming(service, folder_id)
# count_results = check_counts(service, folder_id)
# quality_results= check_quality(service, folder_id)
if __name__ == "__main__":
main()