Spaces:
Sleeping
Sleeping
Commit ·
d7d1de6
1
Parent(s): 0c064df
Create settings.py
Browse files- settings.py +52 -0
settings.py
ADDED
|
@@ -0,0 +1,52 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
from pathlib import Path
|
| 2 |
+
import sys
|
| 3 |
+
|
| 4 |
+
# Get the absolute path of the current file
|
| 5 |
+
file_path = Path(__file__).resolve()
|
| 6 |
+
|
| 7 |
+
# Get the parent directory of the current file
|
| 8 |
+
root_path = file_path.parent
|
| 9 |
+
|
| 10 |
+
# Add the root path to the sys.path list if it is not already there
|
| 11 |
+
if root_path not in sys.path:
|
| 12 |
+
sys.path.append(str(root_path))
|
| 13 |
+
|
| 14 |
+
# Get the relative path of the root directory with respect to the current working directory
|
| 15 |
+
ROOT = root_path.relative_to(Path.cwd())
|
| 16 |
+
|
| 17 |
+
# Sources
|
| 18 |
+
IMAGE = 'Image'
|
| 19 |
+
VIDEO = 'Video'
|
| 20 |
+
WEBCAM = 'Webcam'
|
| 21 |
+
RTSP = 'RTSP'
|
| 22 |
+
YOUTUBE = 'YouTube'
|
| 23 |
+
|
| 24 |
+
SOURCES_LIST = [IMAGE, VIDEO, WEBCAM, RTSP, YOUTUBE]
|
| 25 |
+
|
| 26 |
+
# Images config
|
| 27 |
+
IMAGES_DIR = ROOT / 'images'
|
| 28 |
+
DEFAULT_IMAGE = IMAGES_DIR / 'office_4.jpg'
|
| 29 |
+
DEFAULT_DETECT_IMAGE = IMAGES_DIR / 'office_4_detected.jpg'
|
| 30 |
+
|
| 31 |
+
# Videos config
|
| 32 |
+
VIDEO_DIR = ROOT / 'videos'
|
| 33 |
+
VIDEO_1_PATH = VIDEO_DIR / 'video_1.mp4'
|
| 34 |
+
VIDEO_2_PATH = VIDEO_DIR / 'video_2.mp4'
|
| 35 |
+
VIDEO_3_PATH = VIDEO_DIR / 'video_3.mp4'
|
| 36 |
+
VIDEO_4_PATH = VIDEO_DIR / 'video_4.mp4'
|
| 37 |
+
VIDEO_5_PATH = VIDEO_DIR / 'video_5.mp4'
|
| 38 |
+
VIDEOS_DICT = {
|
| 39 |
+
'video_1': VIDEO_1_PATH,
|
| 40 |
+
'video_2': VIDEO_2_PATH,
|
| 41 |
+
'video_3': VIDEO_3_PATH,
|
| 42 |
+
'video_4': VIDEO_4_PATH,
|
| 43 |
+
'video_5': VIDEO_5_PATH,
|
| 44 |
+
}
|
| 45 |
+
|
| 46 |
+
# ML Model config
|
| 47 |
+
MODEL_DIR = ROOT / 'weights'
|
| 48 |
+
DETECTION_MODEL = MODEL_DIR / 'yolov8n.pt'
|
| 49 |
+
SEGMENTATION_MODEL = MODEL_DIR / 'yolov8n-seg.pt'
|
| 50 |
+
|
| 51 |
+
# Webcam
|
| 52 |
+
WEBCAM_PATH = 0
|