Questions tagged [image-preprocessing]

285 questions
1
vote
0 answers

How to Get the Average Color of a UIImage Excluding the Transparent Parts

How do I get the average color of the non-transparent parts of an image? I get that you can get the average color of an image using the block of code below, but it also factors in the transparent parts to the calculation. var averageColor: UIColor?…
1
vote
1 answer

Data API Error : Cannot convert a symbolic Tensor (truediv:0) to a numpy array

I have 45000 images of size 224*224, stored as a numpy array. This array, called source_arr has shape 45000,224,224 and it fits in the memory. I want to divide this array into train, test and validate array and pre-process (normalize and convert…
1
vote
2 answers

How to auto adjust contrast and brightness of a scanned Image with opencv python

I want to auto adjust the brightness and contrast of a color image taken from phone under different lighting conditions. Please help me I am new to OpenCV. Source: Input Image Result: result What I am looking for is more of a localized…
1
vote
1 answer

How to use keras.preprocessing.ImageDataGenerator.flow_from_dataframe() method when the column contains target labels in form of vectors? (Keras)

I am training a CNN model. I am using a dataframe which contains one column for the image path. The other columns(bbox, category,attributes) contains target labels stored as encoded list. The snippet of the dataframe is given here: The dataframe…
1
vote
0 answers

Unexpected outputs from model.predict when using rescaling

First off: I'm aware of this post, but it doesn't provide an answer. I am building my model like this: from keras.models import Sequential from keras.layers import Conv2D, MaxPooling2D, Dense, Flatten, Dropout from keras.preprocessing.image import…
1
vote
1 answer

Is there a better way to resize an image that is in the form of a numpy array?

I'm new to neural networks, and have been practicing image preprocessing. I am trying to resize images that are in the form of numpy arrays, and this is my current method: # using tensorflow, resize the image im = tf.image.resize(img_as_array,…
sine_nomine
  • 109
  • 1
  • 1
  • 7
1
vote
0 answers

ImageDataGenerator is not saving the actual output to the disk

I have a training set of images with structure like this: path = /aug-dir/img_dir 1.jpg 2.jpg ...jpg I am trying to augment the images and save them to disk for future use. I want to implement the below…
Rao208
  • 147
  • 1
  • 3
  • 15
1
vote
1 answer

How to implement rescaling in custom DataGenerator?

I created a custom DataGeneratorby using tf.keras.utils.Sequence:(https://www.tensorflow.org/api_docs/python/tf/keras/utils/Sequence). This is the customized DataGenerator: # Here, `x_set` is list of path to the images # and `y_set` are the…
Tobitor
  • 1,388
  • 1
  • 23
  • 58
1
vote
2 answers

Is it possible to apply image pre-processing techniques on test data

In the case of a deep CNN task, I do understand that sometimes image pre-processing techniques such as gaussian filtering and cropping can be helpful for deep CNN modeling. I wonder if it is also acceptable to be applied to testing data as well.…
1
vote
1 answer

Many values in the dataset

I have some questions about how to deal with 0 value in 2d array. I am planning to work on regression 1d CNN, but most of the data is made of 0. I would like to replace this 0 to other small values such as 0.000001 simply because, if I put 0,…
1
vote
0 answers

Trying to run a python script where i mainly use opencv on my gpu

So I've tried everything, I've tried to work on ubuntu, on windows, tried every solution online but I don't get it; I'm missing something. I have this code and I'm trying to run it on my gpu, i'm using windows mainly; I have also acess to ubuntu…
1
vote
1 answer

Correct pre-processing pipeline for inference from tensorflow lite model

The question is related to inferencing from a tflite model converted from standard keras-tensorflow Mobilenetv2 model. tf version: 2.2.0 The model has been trained using 0-1 normalization as provided in documentation/example: here After…
1
vote
1 answer

I faced some problems to enhance on multiple images using Python, It shows some error

Here, I want to change the default sharpness of the image dataset. It works fine for a single image, but when I apply on multiple images, it shows me an error like AttributeError: 'numpy.ndarray' object has no attribute 'filter'. What should I do to…
Jacob
  • 27
  • 1
  • 7
1
vote
1 answer

Read multiple images from specific directory, prepossessed and save them another directory using python and opencv

I'm a beginner in Python and OpenCV. I want to read multiple images from a specific directory and preprocess them using CLAHE(Contrast Limited Adaptive histogram equalization) and finally save them (Preprocessed images) to another directory. I tried…
Jacob
  • 27
  • 1
  • 7
1
vote
3 answers

What does the Backslash Operator do in Python and More?

In this link, I found the following line of code: image = Image.open("testOCR3.png")\ .convert('L').resize([3 * _ for _ in image.size], Image.BICUBIC)\ .point(lambda p: p > 75 and p + 100) Unfortunately, I just don't understand it…
user11978420