在github上使用了LBP提取特征分类,程序报错。
pos_file_path_list = map(lambda x: os.path.join(POS_IMAGE_DIR, x), os.listdir(POS_IMAGE_DIR))
neg_file_path_list = map(lambda x: os.path.join(NEG_IMAGE_DIR, x), os.listdir(NEG_IMAGE_DIR))
raise ValueError('y has 0 samples: %r' % y)
ValueError: y has 0 samples: array([], dtype=float64)
debug过程中发现pos_file_path_list和neg_file_path_list是空,只要将map变为list就行
pos_file_path_list = list(map(lambda x: os.path.join(RESIZE_POS_IMAGE_DIR, x), os.listdir(RESIZE_POS_IMAGE_DIR)))
neg_file_path_list = list(map(lambda x: os.path.join(RESIZE_NEG_IMAGE_DIR, x), os.listdir(RESIZE_NEG_IMAGE_DIR)))
最终Ok
给你找了一篇非常好的博客,你可以看看是否有帮助,链接:使用LBP特征进行图像分类