Questions tagged [image-preprocessing]

285 questions
0
votes
1 answer

Type of input images for object detection in Detectron2

I´m using Detectron2 for train Faster R-CNN model for object detection and I want to train the model given by model zoo with inputs in the range [0 1] instead [0 255] so I used a Color transform which calls my function scale_transform def…
0
votes
0 answers

Neuroimaging 'nipype ' plugin not working

I was working on something an I this is actually my first time so things are not that clear for me yet, I ran this code : pip install nipype from nipype import Node, Workflow from nipype.interfaces.fsl import SliceTimer, MCFLIRT, Smooth slicetimer…
0
votes
1 answer

Image Net Preprocessing using torch transforms

I am trying to recreate the data preprocessing on the ImageNet data set done in the original publication "Deep Residual Learning for Image Recognition". As said in their paper in section 3.4: "Our implementation for ImageNet follows the practice in…
0
votes
0 answers

Crop 4D image to non zero values using python

I have an image file containing a 4d array of MR image in the shape (240,240,155,4) and I want to crop it to the non zero values. I tried this code: def crop_image_only_outside(img,tol=0): # tol is tolerance mask = img>tol mask =…
0
votes
1 answer

Why am I generating the same number using random.randint?

so I have this function to generate image augmentation for semantic segmentation, and I was hoping to get random image with corresponding image mask. i = 1 # variable to iterate till images_to_generate while i <= images_to_generate: number =…
0
votes
1 answer

How to pre-process image using tensorflow lite support library on Android?

I have following code in place which pass camera taken image as Bitmap to be feeded in to Machine learning model. CameraFragment.kt private lateinit var photo: Bitmap private fun takePhoto() { val imageCapture = imageCapture ?: return …
user158
  • 12,852
  • 7
  • 62
  • 94
0
votes
1 answer

Keras - Normalization by different mean and std for each channel

I need to add a layer of normalization to the image in the preprocess. It needs to be an additional layer to the model (and not seperate code in python), because I later transform the keras model to mlmodel. This is the normalization I mean: In…
jonb
  • 845
  • 1
  • 13
  • 36
0
votes
1 answer

Difference between size of input and output image for 2D-DCT

I am working on epilepsy seizure prediction classification. First, I preprocess my dataset using 2D-DCT, I apply 2D-DCT on each image of size(22,7680), I found that the output of 2D-DCT has the same size as the input image I wonder if that…
Eda
  • 565
  • 1
  • 7
  • 18
0
votes
1 answer

How can I normalize an image with the Keras ImageDataGenerator class?

I'm training a network from a paper which says the following: "We resize all the images to (256, 256) and normalize them by a mean and standard deviation of 0.5 across RGB channels before passing them through the respective networks." I'm using…
0
votes
1 answer

TF version : 2.4.1, TypeError: Input 'filename' of 'ReadFile' Op has type float32 that does not match expected type of string

I'm using this data http://weegee.vision.ucmerced.edu/datasets/landuse.html on a Google Colab. Trying to load the images as a dataframe using: # Download and unzip images !wget http://weegee.vision.ucmerced.edu/datasets/UCMerced_LandUse.zip !unzip…
Joudelbosc
  • 11
  • 3
0
votes
1 answer

Is there a way to build a keras preprocessing layer that randomly rotates at specified angles?

I'm working on an astronomical images classification project and I'm currently using keras to build CNNs. I'm trying to build a preprocessing pipeline to augment my dataset with keras/tensorflow layers. To keep things simple I would like to…
0
votes
2 answers

ValueError: cannot reshape array of size 784 into shape (16,16)

While read .mat format data with Python and show as plt: import scipy.io as spio import numpy as np import matplotlib.pyplot as plt digits = spio.loadmat('./data/digits.mat', squeeze_me=True) X = digits['X'] plt.imshow(np.reshape(X[5,:],(16,16)),…
ah bon
  • 9,293
  • 12
  • 65
  • 148
0
votes
1 answer

Problems with keras preprocessing

HI I'm preprocessing some image data to run in a simple FF network: I have two options that in my eyes are the same but one performs a lot better than the other: Option 1 I save the images in a directory with correspondent subdirectories and run…
lmglm
  • 3
  • 2
0
votes
1 answer

Shape problem of ImageDataGenerator when fitting the model

I would like to ask you how to solve this problem. I have two folders of pictures, one as train set and the other as validation. What i've done is to use ImageDataGenerator: train_datagen = ImageDataGenerator( rescale=1./255, …
0
votes
0 answers

Keras custom generator: Error when checking input: expected conv2d_1_input to have 4 dimensions, but got array with shape (256, 1)

I have a large dataset (30 000 images, 80kB each), and I'm trying to load it into my model in batches in order to not run of out memory on my GPU. My single image is a 200x200 numpy array, with values either 1 or 0, stored in csv file. So I don't…