main-classifier_bak.py 文件源码

python
阅读 18 收藏 0 点赞 0 评论 0

项目:lantern-detection 作者: gongxijun 项目源码 文件源码
def get_similarIamgeRect(*args):
    """
    ????????.
    :param img:
    :param lefttop_x:
    :param lefttop_y:
    :return:
    """
    kargs = args[0][0]
    img = kargs[0];
    lefttop_x = kargs[1];
    lefttop_y = kargs[2];
    min_wdw_sz = kargs[3];
    downscale = kargs[4]
    scale = kargs[5];

    # Calculate the HOG features
    right_y = lefttop_y + min_wdw_sz[1];
    right_x = lefttop_x + min_wdw_sz[0];
    fd = hog(img[lefttop_y:right_y, lefttop_x:right_x],
             orientations,
             pixels_per_cell,
             cells_per_block,
             visualize,
             normalize)
    prod = clf.predict_proba([fd])[0][1]
    prod = round(prod, 3);
    # print '------------------'
    if prod >= 0.90:  ##???????0.5?????
        #mutex.acquire();
        detections.append((int(lefttop_x * (downscale ** scale)), int(lefttop_y * (downscale ** scale)), prod,
                           int(min_wdw_sz[0] * (downscale ** scale)),
                           int(min_wdw_sz[1] * (downscale ** scale))));
        print  _thread.current_thread(), "Detection:: Location -> ({}, {})".format(lefttop_x, lefttop_y)
        print _thread.current_thread(), "Scale ->  {} | Confidence Score {} \n".format(scale, prod)
        #mutex.release();
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号