日韩av黄I国产麻豆传媒I国产91av视频在线观看I日韩一区二区三区在线看I美女国产在线I麻豆视频国产在线观看I成人黄色短片

歡迎訪問 生活随笔!

生活随笔

當(dāng)前位置: 首頁 >

matlab rootdir,Python cfg.ROOT_DIR属性代码示例

發(fā)布時間:2023/12/10 42 豆豆
生活随笔 收集整理的這篇文章主要介紹了 matlab rootdir,Python cfg.ROOT_DIR属性代码示例 小編覺得挺不錯的,現(xiàn)在分享給大家,幫大家做個參考.

# 需要導(dǎo)入模塊: from fast_rcnn.config import cfg [as 別名]

# 或者: from fast_rcnn.config.cfg import ROOT_DIR [as 別名]

def demo(net, image_name, classes):

"""Detect object classes in an image using pre-computed object proposals."""

# Load pre-computed Selected Search object proposals

box_file = os.path.join(cfg.ROOT_DIR, 'data', 'demo',

image_name + '_boxes.mat')

obj_proposals = sio.loadmat(box_file)['boxes']

# Load the demo image

im_file = os.path.join(cfg.ROOT_DIR, 'data', 'demo', image_name + '.jpg')

im = cv2.imread(im_file)

# Detect all object classes and regress object bounds

timer = Timer()

timer.tic()

scores, boxes = im_detect(net, im, obj_proposals, len(classes))

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 in classes:

cls_ind = CLASSES.index(cls)

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, :]

print 'All {} detections with p({} | box) >= {:.1f}'.format(cls, cls,

CONF_THRESH)

vis_detections(im, cls, dets, thresh=CONF_THRESH)

總結(jié)

以上是生活随笔為你收集整理的matlab rootdir,Python cfg.ROOT_DIR属性代码示例的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網(wǎng)站內(nèi)容還不錯,歡迎將生活随笔推薦給好友。