def create_dataset(file_paths, label_set, with_denoising=False):
data_x = []
data_y = []
for path in file_paths:
single_x = np.asarray(PIL.Image.open(path)).flatten()
# Denoise image with help of OpenCV (increase time of computing).
if with_denoising:
single_x = cv2.fastNlMeansDenoising(single_x).flatten()
data_x.append(single_x)
for l in label_set:
l_to_num = char_to_num(l)
data_y.append(l_to_num)
np_data_x = np.array(data_x)
np_data_y = np.array(data_y)
return np_data_x, np_data_y
# Use the Keras data generator to augment data.
helpers.py 文件源码
python
阅读 29
收藏 0
点赞 0
评论 0
评论列表
文章目录