Questions tagged [image-classification]

579 questions
7
votes
2 answers

Is there a way to ensemble two keras (h5) models trained for same classes

I have trained two keras models with different datasets for same class labels. How could I ensemble the models keras_model.h5 and keras_model2.h5 together and make another keras model say keras_ensemble.h5. I have tried referring various internet…
7
votes
0 answers

Passing in training labels to tf.keras.preprocessing.image_dataset_from_directory doesn't work

I'm trying to load data into a Colab notebook, where the (flat) directory contains a bunch of jpg images, and the label classes are contained in a separate csv file, using tf.keras.preprocessing.image_dataset_from_directory. According to the…
jlyh
  • 681
  • 9
  • 32
6
votes
4 answers

PIL.UnidentifiedImageError: cannot identify image file <_io.BytesIO object

I am trying to train my model (Image classification) using Tensorflow. I keep getting an error when I try to run the following cell: hist = model.fit( train_generator, epochs=100, verbose=1, …
EverydayDeveloper
  • 1,110
  • 4
  • 11
  • 34
4
votes
0 answers

Stratified train/val/test split in Pytorch

I have an image classification dataset with 6 categories that I'm loading using the torchvision ImageFolder class. I have written the below to split the dataset into 3 sets in a stratified manner: from torch.utils.data import Subset from…
3
votes
1 answer

Use CustomCallback() Class to achieve freezing layers while training

I am trying to train a custom CNN model in TensorFlow. I want somehow to freeze some layers of the model in specific epochs while the training is still running. I have achieved freezing the layers but i had to train the model for some epochs, then…
3
votes
1 answer

How to classify images with Variational Autoencoder

I have trained an autoencoder in both labeled images (1200) and unlabeled images (4000) and I have both models saved separately (vae_fake_img and vae_real_img). So I was wondering what to do next. I know Variational Autoencoders are not useful for a…
3
votes
1 answer

How to obtain vector of statistics from high dimensional 3d-array?

I'm working in a project of images defects clustering. Each image is associated to a specific defect type ( And a 3d array of pixels using readJPEG ). An example of images is the following : https://i.stack.imgur.com/pO9XY.jpg library(jpeg) im <-…
Tou Mou
  • 1,270
  • 5
  • 16
3
votes
1 answer

Accuracy is not increasing in images classification when using TensorFlow model

At my job Interview yesterday, I was asked to build a neural network using TesnorFlow in python to classify images from the flowers images dataset. But even though it should've worked theoretically, for some reason I couldn't increase the accuracy…
3
votes
1 answer

The Number of Classes in Pytorch Pretrained Model

I want to use the pre-trained models in Pytorch to do image classification in my own datasets, but how should I change the number of classes while freezing the parameters of the feature extraction layer? These are the models I want to…
3
votes
2 answers

Chess Piece Color Image Classification with Keras

I am trying to build an image classification neural network using Keras to identify if a picture of a square on a chessboard contains either a black piece or a white piece. I created 256 pictures with size 45 x 45 of all chess pieces of a single…
Vincent
  • 65
  • 7
3
votes
1 answer

fastai show_batch and show_results does nothing

I build a model on fastai v2.3.1. When I try to call functions show_batch and show_results it does not show anything. Here is the problematic code: from fastai.vision.all import * from fastai.data.all import * import fastai.vision import zipfile as…
3
votes
1 answer

Can you combine two NNs in TensorFlow?

I have a collection of images, for example, cats and dogs. I also have a CSV accompanying this. The CSV has metadata for the images like the weight of the animal. I have made a classifier for the cats VS dogs images. How can I use the CSV with the…
Null Pointer
  • 111
  • 1
  • 7
3
votes
3 answers

Imbalanced Image Dataset (Tensorflow2)

I'm trying to do a binary image classification problem, but the two classes (~590 and ~5900 instances, for class 1 and 2, respectively) are heavily skewed, but still quite distinct. Is there any way I can fix this, I want to try SMOTE/random…
3
votes
1 answer

Invalid number of channels in input image error using OpenCV

cv2.error: OpenCV(4.2.0) c:\projects\opencv python\opencv\modules\imgproc\src\color.simd_helpers.hpp:92: error: (-2:Unspecified error) in function '__cdecl cv::impl::`anonymous- namespace'::CvtHelper
3
votes
2 answers

How do I register a dataset to use with detectron2? We have images and their annotations in COCO JSON format

I am trying to train a model using Detectron2. I am using Grocery image data and I have annotations in COCO format. I am having a problem with model loading. Model is not taking annotations. I am referring to this blog…
1
2 3
38 39