Update tools/demo_api.py
Browse files- tools/demo_api.py +1 -19
tools/demo_api.py
CHANGED
@@ -101,26 +101,8 @@ class Predictor(object):
|
|
101 |
logger.info("Infer time: {:.4f}s".format(time.time() - t0))
|
102 |
return outputs, img_info, pad
|
103 |
|
104 |
-
def visual(self, output, img_info, cls_conf=0.35):
|
105 |
-
ratio = img_info["ratio"]
|
106 |
-
img = img_info["raw_img"]
|
107 |
-
if output is None:
|
108 |
-
return img
|
109 |
-
output = output.cpu()
|
110 |
-
|
111 |
-
bboxes = output[:, 0:4]
|
112 |
-
|
113 |
-
# preprocessing: resize
|
114 |
-
bboxes /= ratio
|
115 |
-
|
116 |
-
cls = output[:, 6]
|
117 |
-
scores = output[:, 4] * output[:, 5]
|
118 |
-
|
119 |
-
vis_res = vis(img, bboxes, scores, cls, cls_conf, self.cls_names)
|
120 |
-
return vis_res
|
121 |
-
|
122 |
def build_predictor(
|
123 |
-
exp_file, model_name, ckpt_path, device="cpu", fp16=False, fuse=False, trt=False, conf=0
|
124 |
):
|
125 |
# load experiment
|
126 |
exp = get_exp(exp_file, model_name)
|
|
|
101 |
logger.info("Infer time: {:.4f}s".format(time.time() - t0))
|
102 |
return outputs, img_info, pad
|
103 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
104 |
def build_predictor(
|
105 |
+
exp_file, model_name, ckpt_path, device="cpu", fp16=False, fuse=False, trt=False, conf=0, nms=0, tsize=None
|
106 |
):
|
107 |
# load experiment
|
108 |
exp = get_exp(exp_file, model_name)
|