def data_augmentation(self, image_paths, labels, mode='train',
resize=False, jitter=0.2, flip=False, whiten=False):
new_images, new_labels = [], []
for image_path, label in zip(image_paths, labels):
image = cv2.imread(image_path)
# ??????
if resize:
image, label = self.image_resize(
image, label, jitter=jitter, mode=mode)
# ????
if flip:
image, label = self.image_flip(image, label, mode=mode)
# ????
if whiten:
image = self.image_whitening(image)
new_images.append(image)
new_labels.append(label)
new_images = numpy.array(new_images, dtype='uint8')
new_labels = numpy.array(new_labels, dtype='float32')
return new_images, new_labels
评论列表
文章目录