mirror of
https://github.com/PaddlePaddle/FastDeploy.git
synced 2025-10-06 09:07:10 +08:00
Evaluation support model containing nms (#51)
* Detection evaluation function * Add license * Fix python import problem * Modify requirement.txt * Add requirements.txt * Evaluation support model containing nms * Delete useless code Co-authored-by: Jason <jiangjiajun@baidu.com>
This commit is contained in:
@@ -22,14 +22,17 @@ import collections
|
|||||||
|
|
||||||
|
|
||||||
def eval_detection(model,
|
def eval_detection(model,
|
||||||
conf_threshold,
|
|
||||||
nms_iou_threshold,
|
|
||||||
data_dir,
|
data_dir,
|
||||||
ann_file,
|
ann_file,
|
||||||
|
conf_threshold=None,
|
||||||
|
nms_iou_threshold=None,
|
||||||
plot=False):
|
plot=False):
|
||||||
|
if conf_threshold is not None or nms_iou_threshold is not None:
|
||||||
|
assert conf_threshold is not None and nms_iou_threshold is not None, "The conf_threshold and nms_iou_threshold should be setted at the same time"
|
||||||
assert isinstance(conf_threshold, (
|
assert isinstance(conf_threshold, (
|
||||||
float, int
|
float,
|
||||||
)), "The conf_threshold:{} need to be int or float".format(conf_threshold)
|
int)), "The conf_threshold:{} need to be int or float".format(
|
||||||
|
conf_threshold)
|
||||||
assert isinstance(nms_iou_threshold, (
|
assert isinstance(nms_iou_threshold, (
|
||||||
float,
|
float,
|
||||||
int)), "The nms_iou_threshold:{} need to be int or float".format(
|
int)), "The nms_iou_threshold:{} need to be int or float".format(
|
||||||
@@ -49,6 +52,9 @@ def eval_detection(model,
|
|||||||
image_num, desc="Inference Progress")):
|
image_num, desc="Inference Progress")):
|
||||||
im = cv2.imread(image_info["image"])
|
im = cv2.imread(image_info["image"])
|
||||||
im_id = image_info["im_id"]
|
im_id = image_info["im_id"]
|
||||||
|
if conf_threshold is None and nms_iou_threshold is None:
|
||||||
|
result = model.predict(im)
|
||||||
|
else:
|
||||||
result = model.predict(im, conf_threshold, nms_iou_threshold)
|
result = model.predict(im, conf_threshold, nms_iou_threshold)
|
||||||
pred = {
|
pred = {
|
||||||
'bbox':
|
'bbox':
|
||||||
|
Reference in New Issue
Block a user