问题遇到的现象和发生背景
在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