Skip to content

Commit b6b5ff0

Browse files
Merge pull request #16 from 5sControl/dev
Dev
2 parents cdc33d8 + c00c0d3 commit b6b5ff0

File tree

5 files changed

+9
-17
lines changed

5 files changed

+9
-17
lines changed

idle_model/IdleObjectDetectionModel.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,11 @@
44
from yolor.utils.datasets import letterbox
55
from yolor.utils.general import non_max_suppression, scale_coords
66
import time
7+
from logging import Logger
78

89

910
class IdleObjectDetectionModel:
10-
def __init__(self, model_path: str, config_path: str, conf_thresh: float, iou_thresh: float, classes: list, logger) -> None:
11+
def __init__(self, model_path: str, config_path: str, conf_thresh: float, iou_thresh: float, classes: list, logger: Logger, **kwargs) -> None:
1112
self.model, self.device = get_model(model_path, config_path)
1213
self.conf_thresh = conf_thresh
1314
self.iou_thresh = iou_thresh

idle_model/app.py

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
from PIL import Image
22
from flask import Flask, jsonify, request
3-
from configs.load_configs import *
3+
from configs import configs
44
from IdleObjectDetectionModel import IdleObjectDetectionModel
55
import numpy as np
66
import io
@@ -25,12 +25,8 @@
2525

2626
app = Flask(__name__)
2727
model = IdleObjectDetectionModel(
28-
MODEL_PATH,
29-
CONF_PATH,
30-
CONF_THRES,
31-
IOU_THRES,
32-
CLASSES,
33-
logger
28+
**configs,
29+
logger=logger
3430
)
3531

3632
convert_bytes2image = lambda bytes: np.array(Image.open(io.BytesIO(bytes)), dtype=np.uint8)

idle_model/configs/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
from .load_configs import configs

idle_model/configs/confs.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22
"classes": [
33
67
44
],
5-
"iou_thres": 0.5,
6-
"conf_thres": 0.6,
5+
"iou_thresh": 0.5,
6+
"conf_thresh": 0.7,
77
"model_path": "weights/idle_v0.4.4.pt",
8-
"conf_path": "weights/yolor_csp_x.cfg",
8+
"config_path": "weights/yolor_csp_x.cfg",
99
"port": 5001
1010
}

idle_model/configs/load_configs.py

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,3 @@
33

44
with open("configs/confs.json", "r") as conf:
55
configs = json.load(conf)
6-
CONF_THRES = configs.get("conf_thres")
7-
CONF_PATH = configs.get("conf_path")
8-
IOU_THRES = configs.get("iou_thres")
9-
MODEL_PATH = configs.get("model_path")
10-
CLASSES = configs.get("classes")
11-
PORT = configs.get("port")

0 commit comments

Comments
 (0)