data-augmentation

How to balance images in folder by doing augmentation such that number of images in this folder are equal to number of images in other folder?

淺唱寂寞╮ 提交于 2021-02-08 09:23:54
问题 I have 5 folders named as class_i each folder has the i class images. the images are with .jpg format. How can I balance the images in each folder by doing augmentation such that number of images in this folder will be equal to the number of images in the folder with highest number of images? Also, could you please help in plotting a curve shows number of images in each folder before and after balancing? 回答1: Just extended my other answer with algorithm that does exactly what you want in this

How to get Class label from Mosaic augmentation in Object Detection Dataloader?

旧巷老猫 提交于 2021-02-07 19:56:36
问题 NOTE: I couldn't think any better Title name, you're most welcome to edit or suggestion. Update Direct Colab Link. Just grab the given dummy data set and load it to colab. I'm trying to train an object detection model for a multi-class problem. In my training, I am using the Mosaic augmentation, Paper, for this task. In my training mechanism, I'm a bit stuck to properly retrieve the class labels of each category, as the augmentation mechanism randomly picks the sub-portion of a sample.

How to get Class label from Mosaic augmentation in Object Detection Dataloader?

社会主义新天地 提交于 2021-02-07 19:52:35
问题 NOTE: I couldn't think any better Title name, you're most welcome to edit or suggestion. Update Direct Colab Link. Just grab the given dummy data set and load it to colab. I'm trying to train an object detection model for a multi-class problem. In my training, I am using the Mosaic augmentation, Paper, for this task. In my training mechanism, I'm a bit stuck to properly retrieve the class labels of each category, as the augmentation mechanism randomly picks the sub-portion of a sample.

Apply different data augmentation to part of the train set based on the category

微笑、不失礼 提交于 2021-01-29 09:46:03
问题 I'm working on a machine learning process to classify images. My problem is that my dataset is imbalanced, and in my 5 categories of images, I have about 400 images in of one class, and about 20 images of each of the other classes. I would like to balance my train set by applying data augmentation only to certain classes of my train set. Here's the code I'm using for creating the train an validation sets: # Import data data_dir = pathlib.Path(r"C:\Train set") # Define train and validation

How to read (decode) .tfrecords file, see the images inside and do augmentation?

孤人 提交于 2021-01-29 02:40:22
问题 I have a .tfrecords file and I want to extract, see the images in the file and augment them. I am using https://colab.research.google.com TensorFlow version: 2.3.0 And for the following code raw_dataset = tf.data.TFRecordDataset("*path.tfrecords") for raw_record in raw_dataset.take(1): example = tf.train.Example() example.ParseFromString(raw_record.numpy()) print(example) I am facing the following output: features { feature { key: "depth" value { int64_list { value: 3 } } } feature { key:

keras ImageDataGenerator interpolates binary mask

你离开我真会死。 提交于 2021-01-27 06:34:13
问题 I am training a neural network to predict a binary mask on mouse brain images. For this I am augmenting my data with the ImageDataGenerator from keras. But I have realized that the Data Generator is interpolating the data when applying spatial transformations. This is fine for the image, but I certainly do not want my mask to contain non-binary values. Is there any way to choose something like a nearest neighbor interpolation when applying the transformations? I have found no such option in

Keras `ImageDataGenerator` image and mask augments differently

允我心安 提交于 2021-01-02 08:10:12
问题 I'm training a semantic segmentation model using Keras with TensorFlow backend. I adopted ImageDataGenerator to do the image augmentation, including rotation, flip and shift. By following the documentation, I created a dictionary maskgen_args and used it as arguments to instantiate two ImageDataGenerator instances. maskgen_args = dict( rotation_range=90, validation_split=VALIDATION_SPLIT ) image_datagen = ImageDataGenerator(**maskgen_args) mask_datagen = ImageDataGenerator(**maskgen_args) The

Keras iterator with augmented images and other features

微笑、不失礼 提交于 2020-07-08 05:06:34
问题 Say you have a dataset that has images and some data in a .csv for each image. Your goal is to create a NN that has a convolution branch and an other one (in my case an MLP). Now, there are plenty of guides (one here, another one) on how to create the network, that's not the problem. The issue here is how do I create an iterator in the form of [[convolution_input, other_features], target] when the convolution_input is from a Keras ImageDataGenerator flow that adds augmented images. More