I am trying to build a CNN classifier using keras to classify if the image is monkey or not. So I have two categories. One with monkey pictures. The other category is a random collection of pictures which is basically any picture that doesn't contain a monkey in it. Is appropriate to have a dataset with one class that is random and the other class with a specific label (rather than having 2 specific classes like cats and dogs)? will a CNN work for this kind of problem?
Thanks!
yes .. CNN will work either you have one label set or many . If you need more details refer this link. This will save your day ..
https://www.pyimagesearch.com/2017/12/11/image-classification-with-keras-and-deep-learning/
Related
I have 5 folders (which represent 5 classes, and each contain about 200 colored images), I want to use "Principal Component Analysis" for image classification.
previously I used Resnet to predict to which class each image belong. but now I want to use the PCA.
I am trying to apply that with code, any help please?
previously I used Resnet to predict to which class each image belong. but now I want to use the PCA.
PCA is not a method for classification. It is a dimensional reduction method that is sometimes used as a processing step.
Take a look at this CrossValidated post for some more explanation. It has an example.
(FYI, saw this because you pinged me via the MATLAB Answers forum.)
I have build a model using Keras. My main aim is to classify animals belonging to 10 different categories. The model is performing well. However, when I am testing the images with non animal images, the model is trying to fit the image between the 10 different categories. That is if I test the model with a non animal image I am getting an animal as output with a high confidence score. I know that to solve this issue I must use a threshold. But I have not found any resource on how to do this task. Can someone help please?
Let's say we have n images of cat and dog separately and we trained an image classification model to classify a new image with a probability score saying whether it's a cat or a dog.
Now, we are getting images that contains multiple cats and dogs in same image, how can we detect and localize objects(cats and dogs here)?
If it is possible, can we also depict the focus areas considered by model for prediction so that a bounding box could be drawn?
I think you have trouble understanding how a basic object detection works.
I will recommend you to read this paper first:
https://arxiv.org/pdf/1807.05511.pdf
It is possible. You can use Yolo like this example. There is a keras classification based solution.
I am trying to approach a multi label image classification problem,for which i have image data but i also have some other features like gender etc, but the issue is that i will get this information during testing, in other words during testing only the image information will be provided.
My question is how can i use these extra features to help my image model which is a convolution Neural Network even though i wont have this info during testing?
Any advice will be helpful.Thanks in advance.
This is a really open ended question. I can give you some general guidelines on how this can work.
keras model API supports multiple inputs as well as merge layers. For example you can have something like this:
from keras.layers import Input
from keras.models import Model
image = Input(...)
text = Input(...)
... # apply layers onto image and text
from keras.layers.merge import Concatenate
combined = Concatenate()([image, text])
... # apply layers onto combined
model = Model([image, text], [combined])
This way you can have a model that takes multiple inputs that can make use of all of your data sources. keras has tools to combine your different inputs to produce one output. The part where this becomes open ended is the architecture.
Right now you should probably pass image through a CNN, and then merge the output with text. You have to tweak the exact specifications, such as how you handle each input, your merge method, and how you handle the combined output.
A good example of merge being used is here, where a GAN is given latent noise in the form of an image but also a label to determine what kind of image it should generate. Both the discriminator and the generator make use of the multiply merge layer to combine their inputs.
Let start by saying that i have 2 pre-trained models (in hdf5 files):
The first model is a YOLO-based model, trained on dataset A, which is used to locate human in any images (note that: a trained images o this model may contain many people inside)
The second model is a CNN model which is used to detect gender of a person (male or female) based on the image which only contains 1 person.
Suppose that i only want to use these 2 models and do not want to re-train or modify anything on the dataset. How could i locate female person in a picture of Dataset A?
A possible solution that i think could work:
First use the first model to detect, that is to create bounding boxes around persons in the images.
Crop the bounding boxes into unique images. Feed those images to the second model to see if that person is Female/Male
However, this solution is slow in performance. So is there anyway that can festen this solution or perform this task in different ways?