download_images.py 文件源码

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

项目:garden.facelock 作者: kivy-garden 项目源码 文件源码
def find_uglies():
    '''image-net gives a default image when it's real one is not available,
        this is to remove them
    '''
    for file_type in ['neg']:
        for img in os.listdir(file_type):
            for ugly in os.listdir('uglies'):
                try:
                    current_image_path = str(file_type) + '/' + str(img)
                    ugly = cv2.imread('uglies/' + str(ugly))
                    question = cv2.imread(current_image_path)

                    if ugly.shape == question.shape and not (np.bitwise_xor(ugly, question).any()):
                        print "girl you ugly"
                        os.remove(current_image_path)
                except:
                    print "error"
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号