在caffe、py-faster-rcnn中,"scores"return一个大矩阵,为什么?
In caffe, py-faster-rcnn, "scores" return a large matrix, why?
我使用 py-faster-rcnn 演示用 20 类 进一步构建我的项目。
但是,我正在尝试获得 类.
的 softmax,最后一层概率
例如:
# Load the demo image
im_file = os.path.join(cfg.DATA_DIR, 'demo', image_name)
im = cv2.imread(im_file)
# Detect all object classes and regress object bounds
timer = Timer()
timer.tic()
scores, boxes = im_detect(net, im)
timer.toc()
print ('Detection took {:.3f}s for '
'{:d} object proposals').format(timer.total_time, boxes.shape[0])
# Visualize detections for each class
CONF_THRESH = 0.8
NMS_THRESH = 0.3
for cls_ind, cls in enumerate(CLASSES[1:]):
cls_ind += 1 # because we skipped background
cls_boxes = boxes[:, 4*cls_ind:4*(cls_ind + 1)]
cls_scores = scores[:, cls_ind]
dets = np.hstack((cls_boxes,
cls_scores[:, np.newaxis])).astype(np.float32)
keep = nms(dets, NMS_THRESH)
dets = dets[keep, :]
vis_detections(im, cls, dets, thresh=CONF_THRESH)
print scores
当我执行 print scores
时,它给了我一个非常大的矩阵输出,
而不是 1 x 20 。我不知道为什么,我怎样才能得到最后的概率矩阵?
谢谢
检测器的原始 scores
输出包括重叠检测和极低分数检测。
请注意,仅在使用 NMS_THRESH=0.3
应用非最大抑制(又名 "nms")后,函数 vis_detection
仅显示置信度大于 CONF_THRESH=0.8
.
的检测
因此,如果您想查看 "true" 个对象,则需要检查 vis_detection
内部并仅检查它在图像上呈现的检测。
我使用 py-faster-rcnn 演示用 20 类 进一步构建我的项目。 但是,我正在尝试获得 类.
的 softmax,最后一层概率例如:
# Load the demo image
im_file = os.path.join(cfg.DATA_DIR, 'demo', image_name)
im = cv2.imread(im_file)
# Detect all object classes and regress object bounds
timer = Timer()
timer.tic()
scores, boxes = im_detect(net, im)
timer.toc()
print ('Detection took {:.3f}s for '
'{:d} object proposals').format(timer.total_time, boxes.shape[0])
# Visualize detections for each class
CONF_THRESH = 0.8
NMS_THRESH = 0.3
for cls_ind, cls in enumerate(CLASSES[1:]):
cls_ind += 1 # because we skipped background
cls_boxes = boxes[:, 4*cls_ind:4*(cls_ind + 1)]
cls_scores = scores[:, cls_ind]
dets = np.hstack((cls_boxes,
cls_scores[:, np.newaxis])).astype(np.float32)
keep = nms(dets, NMS_THRESH)
dets = dets[keep, :]
vis_detections(im, cls, dets, thresh=CONF_THRESH)
print scores
当我执行 print scores
时,它给了我一个非常大的矩阵输出,
而不是 1 x 20 。我不知道为什么,我怎样才能得到最后的概率矩阵?
谢谢
检测器的原始 scores
输出包括重叠检测和极低分数检测。
请注意,仅在使用 NMS_THRESH=0.3
应用非最大抑制(又名 "nms")后,函数 vis_detection
仅显示置信度大于 CONF_THRESH=0.8
.
的检测
因此,如果您想查看 "true" 个对象,则需要检查 vis_detection
内部并仅检查它在图像上呈现的检测。