当前位置: 首页>>代码示例>>Python>>正文


Python Util.nms方法代码示例

本文整理汇总了Python中util.Util.nms方法的典型用法代码示例。如果您正苦于以下问题:Python Util.nms方法的具体用法?Python Util.nms怎么用?Python Util.nms使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在util.Util的用法示例。


在下文中一共展示了Util.nms方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: main

# 需要导入模块: from util import Util [as 别名]
# 或者: from util.Util import nms [as 别名]
def main():
    iname = 'img/test/1226.jpg'
    nn12 = Cnnl('12-net').load_model('12-net_lasagne_.pickle')
    nn_calib12 =  Cnnl('12-calib_net').load_model('12-calib_net_lasagne_.pickle')
    nn24 = Cnnl(nn_name = '24-net',subnet=nn12).load_model('24-net_lasagne_.pickle')
    nn_calib24 =  Cnnl('24-calib_net').load_model('24-calib_net_lasagne_.pickle')
    nn48 = Cnnl(nn_name = '48-net',subnet=nn24).load_model('48-net_lasagne_.pickle')
    nn_calib48 =  Cnnl('48-calib_net').load_model('48-calib_net_lasagne_.pickle')
    image = fr.get_frame(iname)
    p = 16
    k = 1.18
    bb = apply_12_net(image = image,iname = iname,nn = nn12,p_level=p,k=k,debug=0)
    bb = apply_calib_net(image = image, iname = iname,bb=bb,nn=nn_calib12)
    bb = util.nms(bb,T=0.8)
    bb = apply_24_net(image = image, iname = iname, bb = bb,nn = nn24 )
    bb = apply_calib_net(image = image, iname = iname,bb = bb,nn=nn_calib24)
    bb = util.nms(bb,T=0.8)
    bb = apply_48_net(image = image, iname = iname, bb = bb,nn = nn48 )
    bb = util.nms(bb,T=0.3)
    bb = apply_calib_net(image = image, iname = iname,bb=bb,nn=nn_calib48)    
    draw_bboxes(iname,bb)
开发者ID:CCSUZJJ,项目名称:Cascade-CNN-Face-Detection,代码行数:23,代码来源:pipeline.py

示例2: main

# 需要导入模块: from util import Util [as 别名]
# 或者: from util.Util import nms [as 别名]
def main():
    iname = 'img/test/p1.jpg'
    nn12 = Cnnl('12-net').__load_model_old__('12-net_lasagne_.pickle')
    nn24 = Cnnl(nn_name = '24-net',subnet=nn12).__load_model_old__('24-net_lasagne_.pickle')
    nn48 = Cnnl(nn_name = '48-net',subnet=nn24).__load_model_old__('48-net_lasagne_.pickle')
    nn_calib12 =  Cnnl('12-calib_net').__load_model_old__('12-calib_net_lasagne_.pickle')
    nn_calib24 =  Cnnl('24-calib_net').__load_model_old__('24-calib_net_lasagne_.pickle')
    #nn_calib48 =  Cnnl('48-calib_net').__load_model_old__('48-calib_net_lasagne_.pickle')
    image = fr.get_frame(iname)
    p = 11
    k = 1.41
    t_level = 0
    gbb = []
    gp = []
    print('Start....')
    s = time()
    py = fr.get_frame_pyramid(image,scale=k,steps=p)
    for m,frame in enumerate(py):
        if m < t_level:
            continue
        
        bb,p = apply_12_net(image = image,frame=frame,iname = iname,nn = nn12,m=m,debug=0)
        keep = util.nms(bb,p,T=0.5)
        
        bb = bb[keep] if keep != [] else bb
        p = p[keep] if keep != [] else p 
        cnt_detect = len(bb)
        if cnt_detect  == 0:
            continue
        #draw_bboxes(iname,bb,c='#-r_12--' + str(m))
        for b in bb:
            gbb.append(b)
        for pp in p:
            gp.append(pp)

    gbb = sp.array(gbb)
    gp = sp.array(gp)
    #draw_bboxes(iname,gbb,c='0-r_12')
    
    bb = gbb
    p = gp
    bb = apply_calib_net(image = image, iname = iname,bb=bb,nn=nn_calib12)
    cnt_detect = len(bb)
    
    #draw_bboxes(iname,bb,c='1-r_calib_12')    
    
    keep = util.nms(bb,p,T=0.3)
    
    bb = bb[keep] if keep != [] else bb
    
    p = p[keep] if keep != [] else p
    
    #draw_bboxes(iname,bb,c='2-r_nms_12')
    
    bb,p = apply_24_48_net(image = image, iname = iname, bb = bb,nn = nn24,debug=0 )
    cnt_detect = len(bb)
    #draw_bboxes(iname,bb,c='3-r_24')
    
    bb = apply_calib_net(image = image, iname = iname,bb = bb,nn=nn_calib24)
   
    cnt_detect = len(bb)
    #draw_bboxes(iname,bb,c='4-r_calib_24')
    keep = util.nms(bb,p,T=0.3)

    bb = bb[keep] if keep != [] else bb
    p = p[keep] if keep != [] else p
    #draw_bboxes(iname,bb,c='5-r_nms_24')
    cnt_detect = len(bb)
    
    bb,p = apply_24_48_net(image = image, iname = iname, bb = bb,nn = nn48,debug=1)        
    cnt_detect = len(bb)
    draw_bboxes(iname,bb,c='6-r_48',debug=1)
    
    
#    bb = apply_calib_net(image = image,iname = iname,bb=bb,nn=nn_calib48)
#    draw_bboxes(iname,bb,c='6-r_calib_48')
#    
#    bb = util.nms(bb,T=0.2)
#    draw_bboxes(iname,bb,c='7-r_nms_48_final')
    print('Finish...',time()-s)
开发者ID:gogolgrind,项目名称:Cascade-CNN-Face-Detection,代码行数:82,代码来源:pipeline.py


注:本文中的util.Util.nms方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。