Questions tagged [data-augmentation]

Data augmentation

Data augmentation is the technique of increasing the size of data used for training a model. It also helps in preventing overfitting.

Some of the most common data augmentation techniques for images include:

  • Scaling
  • Cropping
  • Flipping
  • Rotation
  • Color jittering
465 questions
1
vote
1 answer

Image Augmentation - TypeError: only size-1 arrays can be converted to Python scalars

I have a dataset of 279 images and i wish to perform augmentations with batch size of 4. Following is the code sample that i have written import numpy as np from skimage import io import os from PIL import Image from keras.preprocessing.image import…
1
vote
0 answers

Customized sklearn Transformer to increase rows of X & Y (for text Augmentation)

Is it possible to create a customized sklearn Transformer that increase the # of rows of X & Ys. Basically what I would like to do is to augment the text (X, which is a 1D list of strings) based on NLP data augmentation method like translations,…
Y Li
  • 21
  • 1
  • 1
1
vote
0 answers

How to add augmented images to original dataset with TensorFlow?

I understand the function of tf.image augmentations, but I want to not only have the augmented images in my dataset, but also keep the original images as well. That way I will have the original, and many augmented versions, thus expanding the…
JakeGehri
  • 65
  • 3
1
vote
1 answer

Tensorflow: Custom data augmentation

I'm trying to define a custom data augmentation layer. My goal is to call the existing tf.keras.layers.RandomZoom, with a probability. This is what I did: class random_zoom_layer(tf.keras.layers.Layer): def __init__(self, probability=0.5,…
Klinsmann
  • 33
  • 4
1
vote
1 answer

Is it possible to iterate through Tensor in graph mode?

I am trying to implement Aleju's Imgaug to TFOD API. Noticed that you can not iterate through Tensors in the graph mode . I looked up for the solution and tried many suggestions but neither of them worked for my case. Do you know any work…
1
vote
0 answers

How to augment image data that is more than just pixels (using keras' ImageDataGenerator)?

I am currently working on a convolutional neural network to classify images using Python 3.9, tensorflow 2.7 as well as its keras API. These images, however, not only consist of pixel data but also have one 'pmt-count'-value that is to be…
ABF
  • 57
  • 9
1
vote
1 answer

Error with keras model data augmented dimensions in First epoch

So I have done data augmentation in a keras model. I am using Fashin_Mnist dataset. Everything goes okay but when it finished the first epoch it throws an error. The error: ValueError: Shapes (32, 1) and (32, 10) are incompatible My data: img_rows…
1
vote
1 answer

How to apply mutliple rotate values for one image in imgaug? (Not randomly)

from imgaug import augmenters as iaa from imgaug import parameters as iap import cv2 aug=iaa.Affine(rotate=iap.DeterministicList([90,180,270])) imglist = [] img = cv2.imread('i/1.jpg') imglist.append(img) images_aug =…
1
vote
0 answers

Is there a Tensorflow equivalent for np.random.choice to randomly sample from a discrete set?

I am trying to implement an image augmentation strategy similar to RandAugment in TensorFlow. From the RandAugment paper, the following code shows how N augmentations are randomly selected to be applied to images. transforms = [’Identity’,…
Christiaan Louw
  • 107
  • 2
  • 11
1
vote
0 answers

Conditional Torchvision transforms

I have a dataset 1000 of images and corresponding segmentation masks from dermatologists. The images come in different sizes (as low as 400x600 and as large as 4Kx4K). 95% of image pixels are not targets. 5% of pixels are labeled as targets falling…
sixtytrees
  • 1,156
  • 1
  • 10
  • 25
1
vote
0 answers

How to use transformations of my choice during inference with Test Time Augmentation in fastai?

I am using Test Time Augmentation during inference, like so- file_path = '/path/to/file.jpg' dl = learn_.dls.test_dl([file_path]) pred, _ = learn_.tta(dl=dl, n=N_IMAGES) When I try to add additional transformations of my choice, I am unable to do…
1
vote
1 answer

Data augmentation is not generated İmages

I am working on image classification (12 classes of image data) by applying CNN Model. As a result, İ have been facing overfitting therefore İ applied Data Augmentation. Although it works pretty well, however, İ have faced an error i.e. Found 0…
1
vote
1 answer

TypeError: slice indices must be integers or None or have an __index__ method (Albumentations/NumPy)

Hi everyone can you please help me i'm getting this bug with random crop augmentation. TypeError: slice indices must be integers or None or have an index method Code is below. !conda install -c conda-forge gdcm -y import os import numpy as…
1
vote
2 answers

How to specify augmentation in TensorFlow Lite Model Maker?

I'm trying to make an image classifier with the help of TensorFlow Lite Model Maker following this tutorial: https://www.tensorflow.org/lite/tutorials/model_maker_image_classification . Everything works fine when I use the default values. What I'm…
1
vote
2 answers

Facing problems when training a Convolutional Neural Network (CNN) using TPU when using ImageDataGenerator class for Data Augmentation of Images?

Recently I have been training a CNN i.e. AlexNet for classifying Brain MRI images into four classes but when I am training it on CPU or GPUs on my Google Colab Runtime it is taking a lot of time i.e. approximately around 5 hrs. I thought to migrate…
strikersps
  • 338
  • 3
  • 16