Closed thekoshkina closed 5 years ago
I am sorry, it my fault, the code I add in my another resiposity:
In mmdetection/mmdet/apis/inference.py .
def det_bboxes(
bboxes,
labels,
score_thr=0,
):
"""
return bboxes[N, 4]: x0, y1, x1, y1
scores [N, 1]
"""
assert bboxes.ndim == 2
assert labels.ndim == 1
assert bboxes.shape[0] == labels.shape[0]
assert bboxes.shape[1] == 4 or bboxes.shape[1] == 5
if score_thr > 0:
assert bboxes.shape[1] == 5
scores = bboxes[:, -1]
inds = scores > score_thr
bboxes = bboxes[inds, :]
labels = labels[inds]
human_inds = labels == 0
bboxes = bboxes[human_inds, :]
labels = labels[human_inds]
return bboxes[:, :4], bboxes[:, 4]
def re_result(result, dataset='coco', score_thr=0.5):
'''
返回human boxes and scores
'''
class_names = get_classes(dataset)
if isinstance(result, tuple):
bbox_result, segm_result = result
else:
bbox_result, segm_result = result, None
bboxes = np.vstack(bbox_result)
# bounding boxes
labels = [
np.full(bbox.shape[0], i, dtype=np.int32)
for i, bbox in enumerate(bbox_result)
]
labels = np.concatenate(labels)
# only for human class
re_bboxes, re_scores = det_bboxes(bboxes, labels, score_thr=score_thr)
return re_bboxes, re_scores
I will insert relevant code into this project soon after
thank you
Hi @lxy5513,
i'm trying to run the demo code
python pose_estimation/demo_mmd.py
I installed mmdet from github repo https://github.com/open-mmlab/mmdetection.git and got numpy version 1.16.0
after that i'm getting an error:
Traceback (most recent call last): File "/home//Code/hrnet/pose_estimation/demo_mmd.py", line 167, in
main()
File "/home//Code/hrnet/pose_estimation/demo_mmd.py", line 137, in main
from lib.detector.mmdetection.high_api import load_model
File "/home//Code/hrnet/lib/detector/mmdetection/high_api.py", line 8, in
from mmdet.apis import re_result
ImportError: cannot import name 're_result'