Spaces:
Runtime error
Runtime error
File size: 1,040 Bytes
f8ce4cf | 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 | import sys
from pathlib import Path
# 获取当前文件的绝对路径
file_path = Path(__file__).resolve()
print("file_path",file_path)
# 获取当前文件的父路径
root_path = file_path.parent
print("root_path",root_path)
# 获取总项目的根路径
model_root_path = root_path.parent
print("model_root_path",model_root_path)
# Add the root path to the sys.path list if it is not already there
if root_path not in sys.path:
sys.path.append(str(root_path))
# 获取settings文件对于当前工作目录的相对路径
ROOT = root_path.relative_to(Path.cwd())
print("Path.cwd()",Path.cwd())
print("ROOT",ROOT)# .
# Sources
IMAGE = 'Image'
RTSP = 'RTSP'
SOURCES_LIST = [IMAGE, RTSP]
# Images config
IMAGES_DIR = ROOT / 'images'
DEFAULT_IMAGE = IMAGES_DIR / 'office_4.jpg'
DEFAULT_DETECT_IMAGE = IMAGES_DIR / 'office_4_detected.jpg'
# ML Model config
MODEL_DIR = ROOT / 'weights'
DETECTION_MODEL = MODEL_DIR / 'yolov8n.pt'
SEGMENTATION_MODEL = MODEL_DIR / 'yolov8n-seg.pt'
SECURITY_MODEL = MODEL_DIR / 'yolov8n-sec.pt'
|