data-augmentation

Keras iterator with augmented images and other features

淺唱寂寞╮ 提交于 2020-07-08 05:06:01
问题 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

Keras iterator with augmented images and other features

拜拜、爱过 提交于 2020-07-08 05:05:45
问题 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

Keras iterator with augmented images and other features

寵の児 提交于 2020-07-08 05:05:11
问题 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

Keras data augmentaion changes pixel values for masks (segmentation)

十年热恋 提交于 2020-06-16 07:48:11
问题 Iam using runtime data augmentation using generators in keras for segmentation problem.. Here is my data generator data_gen_args = dict( width_shift_range=0.1, height_shift_range=0.1, zoom_range=0.2, horizontal_flip=True, validation_split=0.2 ) image_datagen = ImageDataGenerator(**data_gen_args) def generate_data_generator(generator, Xi, Yi): genXi = generator.flow(Xi, seed=7, batch_size=32) genYi = generator.flow(Yi, seed=7,batch_size=32) while True: Xi = genXi.next() Yi = genYi.next() print

How to apply data augmentation in TensorFlow 2.0 after tfds.load()

旧城冷巷雨未停 提交于 2020-05-23 08:25:29
问题 I'm following this guide. It shows how to download datasets from the new TensorFlow Datasets using tfds.load() method: import tensorflow_datasets as tfds SPLIT_WEIGHTS = (8, 1, 1) splits = tfds.Split.TRAIN.subsplit(weighted=SPLIT_WEIGHTS) (raw_train, raw_validation, raw_test), metadata = tfds.load( 'cats_vs_dogs', split=list(splits), with_info=True, as_supervised=True) The next steps shows how to apply a function to each item in the dataset using map method: def format_example(image, label):

Keras fit_generator gives a dimension mismatch error

僤鯓⒐⒋嵵緔 提交于 2020-04-30 06:49:07
问题 I am working on MNIST dataset, in which X_train = (42000,28,28,1) is the training set. y_train = (42000,10) is the corresponding label set. Now I create an iterator from the image generator using Keras as follows; iter=datagen.flow(X_train,y_train,batch_size=32) which works fine. Then I train the model using; model.fit_generator(iter,steps_per_epoch=len(X_train)/32,epochs=1) Here it gives the following error; ValueError: Error when checking input: expected dense_9_input to have 2 dimensions,

Python Google Translate API error : How to translate a large amount of data

只谈情不闲聊 提交于 2020-04-13 05:48:47
问题 My problem I would like to use a kind of data-augmentation method for NLP consisting of back-translating dataset. Basically, I have a large dataset (SNLI), consisting of 1 100 000 english sentences. What I need to do is : translate these sentences in a language, and translate it back to English. I may have to do this for several language. So I have a lot of translations to do. I need a free solution. What I did so far I tried several python module for translation, but due to recent changes in

How to use different data augmentation for Subsets in PyTorch

大城市里の小女人 提交于 2020-01-24 17:04:29
问题 How to use different data augmentation (transforms) for different Subset s in PyTorch? For instance: train, test = torch.utils.data.random_split(dataset, [80000, 2000]) train and test will have the same transforms as dataset . How to use custom transforms for these subsets? 回答1: My current solution is not very elegant, but works: from copy import copy train_dataset, test_dataset = random_split(full_dataset, [train_size, test_size]) train_dataset.dataset = copy(full_dataset) test_dataset

Data Augmentation hurts accuracy Keras

北战南征 提交于 2019-12-13 03:57:55
问题 I'm trying to adapt Deep Learning with Python section 5.3 Feature extraction with Data Augmentation to a 3-class problem with resnet50 (imagenet weights). Full code at https://github.com/morenoh149/plantdisease from keras import models from keras import layers from keras.applications.resnet50 import ResNet50 from keras import optimizers from keras.preprocessing.image import ImageDataGenerator input_shape = (224, 224, 3) target_size = (224, 224) batch_size = 20 conv_base = ResNet50(weights=

What are some good data augmentation techniques for document images?

自闭症网瘾萝莉.ら 提交于 2019-12-11 16:36:22
问题 I have 1000 resume in png format and I am implementing MaskRcnn for object detection. What data augmentation techniques can I use to improve the mask Rcnn performance? 回答1: I don't think MaskRCNN or other semantic segmentation or object detection tools are appropriate for this task. Look into OCR libraries such as Tesseract. 来源: https://stackoverflow.com/questions/58748719/what-are-some-good-data-augmentation-techniques-for-document-images