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"
评论列表
文章目录