Keep production startup independent of benchmarks
This commit is contained in:
@@ -157,7 +157,8 @@ def inference_worker(loop: asyncio.AbstractEventLoop) -> None:
|
|||||||
threshold = float(os.getenv("DETECTION_THRESHOLD", ".35")); max_people = int(os.getenv("MAX_PEOPLE", "4"))
|
threshold = float(os.getenv("DETECTION_THRESHOLD", ".35")); max_people = int(os.getenv("MAX_PEOPLE", "4"))
|
||||||
try:
|
try:
|
||||||
models.load()
|
models.load()
|
||||||
run_offline_benchmark(models, threshold, max_people)
|
if os.getenv("RUN_STARTUP_BENCHMARK", "false").lower() == "true":
|
||||||
|
run_offline_benchmark(models, threshold, max_people)
|
||||||
state.models_ready = True; LOG.info("official detector and pose checkpoints loaded")
|
state.models_ready = True; LOG.info("official detector and pose checkpoints loaded")
|
||||||
except Exception as exc:
|
except Exception as exc:
|
||||||
state.inference_fault = True; state.error_code = "MODEL_LOAD_FAILED"
|
state.inference_fault = True; state.error_code = "MODEL_LOAD_FAILED"
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ from typing import Any
|
|||||||
|
|
||||||
import numpy as np
|
import numpy as np
|
||||||
import torch
|
import torch
|
||||||
|
import cv2
|
||||||
|
|
||||||
from .core import normalize_bbox, normalize_keypoints
|
from .core import normalize_bbox, normalize_keypoints
|
||||||
|
|
||||||
@@ -45,6 +46,7 @@ class Models:
|
|||||||
return digest.hexdigest()
|
return digest.hexdigest()
|
||||||
|
|
||||||
def load(self) -> None:
|
def load(self) -> None:
|
||||||
|
cv2.setNumThreads(int(os.getenv("CV2_NUM_THREADS", "2")))
|
||||||
torch.backends.cudnn.benchmark = True
|
torch.backends.cudnn.benchmark = True
|
||||||
torch.backends.cuda.matmul.allow_tf32 = True
|
torch.backends.cuda.matmul.allow_tf32 = True
|
||||||
torch.backends.cudnn.allow_tf32 = True
|
torch.backends.cudnn.allow_tf32 = True
|
||||||
|
|||||||
@@ -111,6 +111,11 @@ services:
|
|||||||
SAVE_FRAMES: "false"
|
SAVE_FRAMES: "false"
|
||||||
SAVE_CROPS: "false"
|
SAVE_CROPS: "false"
|
||||||
LOG_COORDINATES: "false"
|
LOG_COORDINATES: "false"
|
||||||
|
RUN_STARTUP_BENCHMARK: "false"
|
||||||
|
OMP_NUM_THREADS: "2"
|
||||||
|
MKL_NUM_THREADS: "2"
|
||||||
|
OPENBLAS_NUM_THREADS: "2"
|
||||||
|
CV2_NUM_THREADS: "2"
|
||||||
CUDA_VISIBLE_DEVICES: "1"
|
CUDA_VISIBLE_DEVICES: "1"
|
||||||
DETECTOR_NAME: yolox-m-humanart-coco-640x640
|
DETECTOR_NAME: yolox-m-humanart-coco-640x640
|
||||||
DET_CONFIG: ""
|
DET_CONFIG: ""
|
||||||
|
|||||||
Reference in New Issue
Block a user