Questions tagged [image-preprocessing]

285 questions
23
votes
13 answers

HOW TO FIX IT? AttributeError: module 'keras.preprocessing.image' has no attribute 'load_img'

import numpy as np from keras.preprocessing import image import matplotlib.pyplot as plt import matplotlib.image as mpimg import matplotlib.pyplot as plt import matplotlib.image as mpimg %matplotlib inline …
23
votes
4 answers

Error while resizing image: "error: (-215:Assertion failed) func != 0 in function 'resize'"

I'm trying to preprocess images dataset, represented in numpy array with images of shape (28, 28) by rescaling them to (10, 10). I wrote a function for that: import cv2 as cv def resize_dataset(images): resized_images = [] for img in…
zeyger
  • 1,320
  • 1
  • 12
  • 18
18
votes
4 answers

Numpy:zero mean data and standardization

I saw in tutorial (there were no further explanation) that we can process data to zero mean with x -= np.mean(x, axis=0) and normalize data with x /= np.std(x, axis=0). Can anyone elaborate on these two pieces on code, only thing I got from…
econ
  • 495
  • 3
  • 6
  • 16
14
votes
1 answer

How to use repeat() function when building data in Keras?

I am training a binary classifier on a dataset of cats and dogs: Total Dataset: 10000 images Training Dataset: 8000 images Validation/Test Dataset: 2000 images The Jupyter notebook code: # Part 2 - Fitting the CNN to the images train_datagen =…
13
votes
3 answers

Keras VGG16 preprocess_input modes

I'm using the Keras VGG16 model. I've seen it there is a preprocess_input method to use in conjunction with the VGG16 model. This method appears to call the preprocess_input method in imagenet_utils.py which (depending on the case) calls…
user3731622
  • 4,844
  • 8
  • 45
  • 84
13
votes
5 answers

How to implement ZCA Whitening? Python

Im trying to implement ZCA whitening and found some articles to do it, but they are a bit confusing.. can someone shine a light for me? Any tip or help is appreciated! Here is the articles i read…
user2136049
11
votes
3 answers

Keras image_dataset_from_directory not finding images

I want to load the data from the directory where I have around 5000 images (type 'png'). But it returns me an error saying that there are no images when obviusly there are images. This code: width=int(wb-wa) height=int(hb-ha) directory =…
7
votes
1 answer

Image Preprocessing for OCR - Tessaract

Obviously this image is pretty tough as it is low clarity and is not a real word. However, with this code, I'm detecting nothing close: import pytesseract from PIL import Image, ImageEnhance, ImageFilter image_name = 'NedNoodleArms.jpg' im =…
7
votes
1 answer

Keras image augmentation: How to choose "steps per epoch" parameter and include specific augmentations during training?

I am training an image classification CNN using Keras. Using the ImageDataGenerator function, I apply some random transformations to the training images (e.g. rotation, shearing, zooming). My understanding is, that these transformations are applied…
7
votes
3 answers

Is this the correct way of whitening an image in python?

I am trying to zero-center and whiten CIFAR10 dataset, but the result I get looks like random noise! Cifar10 dataset contains 60,000 color images of size 32x32. The training set contains 50,000 and test set contains 10,000 images respectively. The…
Hossein
  • 24,202
  • 35
  • 119
  • 224
6
votes
3 answers

remove small whits dots from binary image using opencv python

i have a binary image and I want to remove small white dots from the image using opencv python.You can refer to my problem here enter link description here My original image is i want the output image as:
Krupali Mistry
  • 624
  • 1
  • 9
  • 23
5
votes
2 answers

Programmatically divide scanned images into separate images

In order to improve OCR quality, I need to preprocess my scanned images. Sometimes I need to OCR the image with few pictures (components on the page and they are at different angles - for example, a few paper documents scanned at one time), for…
alexanoid
  • 24,051
  • 54
  • 210
  • 410
4
votes
0 answers

How to make vector graphics image using python

I am trying to make a project to convert an image to a vector graphic image, how can I do this?
Farid Chowdhury
  • 2,766
  • 1
  • 26
  • 21
4
votes
1 answer

How should image preprocessing and data augmentation be for semantic segmentation?

I have an imbalanced and small dataset which contains 4116 224x224x3 (RGB) aerial images. It's very likely that I will encounter the overfitting problem since the dataset is not big enough. Image preprocessing and data augmentation help to tackle…
saki
  • 117
  • 3
  • 8
4
votes
2 answers

Writing your custom function for image preprocessing in Keras

I am a beginner training an image dataset on diabetic retinopathy, using the keras_flow_from_dataframe class. But my model has been underfitting. So I tried preprocessing, by writing a custom preprocessing function to be passed in my image data…
1
2 3
18 19