LearningnRunning commited on
Commit
a8f267e
·
1 Parent(s): 9ca25f0

FIX model path

Browse files

상대경로 -> 절대경로

Files changed (2) hide show
  1. app.py +2 -1
  2. config/settings.py +6 -1
app.py CHANGED
@@ -18,10 +18,11 @@ from models.common import DetectMultiBackend
18
  from utils.general import (check_img_size, non_max_suppression, scale_boxes)
19
  from utils.plots import Annotator, colors
20
  from utils.torch_utils import select_device
 
21
 
22
  # YOLOv9 모델 로드
23
  device = select_device('')
24
- model = DetectMultiBackend('./weights/nsfw_detector_e_rok.pt', device=device, dnn=False, data=None, fp16=False)
25
  stride, names, pt = model.stride, model.names, model.pt
26
  imgsz = check_img_size((640, 640), s=stride) # check image size
27
 
 
18
  from utils.general import (check_img_size, non_max_suppression, scale_boxes)
19
  from utils.plots import Annotator, colors
20
  from utils.torch_utils import select_device
21
+ from config.settings import MODEL_PATH
22
 
23
  # YOLOv9 모델 로드
24
  device = select_device('')
25
+ model = DetectMultiBackend(MODEL_PATH, device=device, dnn=False, data=None, fp16=False)
26
  stride, names, pt = model.stride, model.names, model.pt
27
  imgsz = check_img_size((640, 640), s=stride) # check image size
28
 
config/settings.py CHANGED
@@ -1 +1,6 @@
1
- MODEL_PATH = './weights/yolov9_c_nsfw.pt'
 
 
 
 
 
 
1
+ import os
2
+ # 프로젝트 루트 디렉토리 경로 얻기
3
+ BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
4
+
5
+ # MODEL_PATH를 절대 경로로 설정
6
+ MODEL_PATH = os.path.join(BASE_DIR, 'weights', 'yolov9_c_nsfw.pt')