e1250 commited on
Commit
83180e3
·
1 Parent(s): ab1bbb0

fix: load models from hf and not local

Browse files
Files changed (3) hide show
  1. api/routers/camera_stream.py +1 -1
  2. config/config.yaml +4 -4
  3. main.py +5 -3
api/routers/camera_stream.py CHANGED
@@ -67,7 +67,7 @@ async def websocket_detect(
67
  pass
68
 
69
  await frame_queue.put(frame_bytes)
70
- except WebScoketDisconnect:
71
  raise
72
 
73
  async def process_frames():
 
67
  pass
68
 
69
  await frame_queue.put(frame_bytes)
70
+ except WebSocketDisconnect:
71
  raise
72
 
73
  async def process_frames():
config/config.yaml CHANGED
@@ -17,11 +17,11 @@ prometheus_port: 9091
17
  paths:
18
  # project_dir: &proj_dir G:\MyComputer\Workspace\Projects\gp-tracking-dashboard\tracking_dashboard
19
  project_dir: &proj_dir .
20
- models_dir: &models_dir !join [*proj_dir, ai, dl_models]
21
  # logs_dir: !join [*proj_dir, backend, config, logs, logs]
22
 
23
  yolo:
24
- model_path: !join [*models_dir, yolo26s.pt]
25
  classes:
26
  - person
27
  batch_size: 16
@@ -31,11 +31,11 @@ yolo:
31
  data_path: ""
32
 
33
  security_detector:
34
- model_path: !join [*models_dir, "yolo_smoke_fire.pt"]
35
  classes:
36
  - fire
37
  - smoke
38
 
39
  depth:
40
- model_path: !join [*models_dir, depth_anything_v2_vits.pth]
41
  encoder: "vits"
 
17
  paths:
18
  # project_dir: &proj_dir G:\MyComputer\Workspace\Projects\gp-tracking-dashboard\tracking_dashboard
19
  project_dir: &proj_dir .
20
+ # models_dir: &models_dir !join [*proj_dir, ai, dl_models]
21
  # logs_dir: !join [*proj_dir, backend, config, logs, logs]
22
 
23
  yolo:
24
+ # model_path: !join [*models_dir, yolo26s.pt]
25
  classes:
26
  - person
27
  batch_size: 16
 
31
  data_path: ""
32
 
33
  security_detector:
34
+ # model_path: !join [*models_dir, "yolo_smoke_fire.pt"]
35
  classes:
36
  - fire
37
  - smoke
38
 
39
  depth:
40
+ # model_path: !join [*models_dir, depth_anything_v2_vits.pth]
41
  encoder: "vits"
main.py CHANGED
@@ -30,11 +30,13 @@ async def lifespan(app: FastAPI):
30
  asyncio.create_task(log_system_metrics(logger, logger_interval_sec=settings.intervals.system_metrics_seconds))
31
 
32
  # Using this way to can store data. it is acts as a dict which holds instances
33
- app.state.detection_model = YOLO_Detector(settings.yolo.model_path)
 
 
34
  app.state.depth_model = DepthAnything(encoder=settings.depth.encoder, depth_model_path=settings.depth.model_path, DEVICE="cuda")
35
 
36
- # safety_detection_path = hf_hub_download(repo_id="e1250/safety_detection", filename="yolo_smoke_fire.pt")
37
- app.state.safety_detection_model = YOLO_Detector(settings.security_detector.model_path)
38
 
39
  app.state.logger = logger
40
  app.state.settings = settings
 
30
  asyncio.create_task(log_system_metrics(logger, logger_interval_sec=settings.intervals.system_metrics_seconds))
31
 
32
  # Using this way to can store data. it is acts as a dict which holds instances
33
+ app.state.detection_model = YOLO_Detector()
34
+
35
+ safety_detection_path = hf_hub_download(repo_id="depth-anything/Depth-Anything-V2-Small", filename="depth_anything_v2_vits.pth")
36
  app.state.depth_model = DepthAnything(encoder=settings.depth.encoder, depth_model_path=settings.depth.model_path, DEVICE="cuda")
37
 
38
+ safety_detection_path = hf_hub_download(repo_id="e1250/safety_detection", filename="yolo_smoke_fire.pt")
39
+ app.state.safety_detection_model = YOLO_Detector(safety_detection_path)
40
 
41
  app.state.logger = logger
42
  app.state.settings = settings