Skip to content

Instantly share code, notes, and snippets.

@VedPDubey
Created July 9, 2021 06:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save VedPDubey/4a18ad907c8681520e5f1cc937eb4e02 to your computer and use it in GitHub Desktop.
Save VedPDubey/4a18ad907c8681520e5f1cc937eb4e02 to your computer and use it in GitHub Desktop.
def augment_add(images, seq, labels):
augmented_images, augmented_labels = [],[]
for idx,img in tqdm(enumerate(images)):
if labels[idx] == 1:
image_aug_1 = seq.augment_image(image=img)
image_aug_2 = seq.augment_image(image=img)
augmented_images.append(image_aug_1)
augmented_images.append(image_aug_2)
augmented_labels.append(labels[idx])
augmented_labels.append(labels[idx])
pass
augmented_images = np.array(augmented_images, dtype=np.float32)
augmented_labels = np.array(augmented_labels, dtype=np.float32)
return (augmented_images, augmented_labels)
pass
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment