How do I train CNN using unlabelled images? - machine-learning

I am trying to train image classificator using CNN GoogleNet Inception. I have some labeled images(cca 1000 per category) and much more unlabeled images. So far have I used just labeled images and I got good accuracy. I am just not sure if it is possible to use somehow unlabeled images.
The only information about them is, that there are always some images(1-10) in one directory. And images in one directory belong to same class.
Thank You

Have a look at Keras ImageDataGenerator. Its a convenience function that reads images from subdirectories that correspondend to classes.
Even if you don´t use Keras for training you could do a dummy run to generate labels for your unlabeled images and then use these in your neural network architecture.
You can also look into pseudo labelling for images for which you don´t have any information regarding the content.

Related

Affinity Propagation for Image Clustering

The link here describes a method for image classification using affinity propagation. I'm confused as to how they got the feature vectors, i.e, the data structure of the images, e.g, arrays?
Additionally, how would I accomplish this given that I can't use Places365 as it's custom data (audio spectrograms)?
Finally, how would I plot the images as they've done in the diagram?
The images are passed through a neural network. The activations of neural network layer for an image is the feature vector. See https://keras.io/applications/ for examples.
Spectrograms can be treated like images.
Sometimes even when domain is very different, the neural network features can extract useful information that can help you with clustering/classification tasks.

Classifying image documents using Machine learning

I want to classify image documents(like Passport, Driving Licence etc) using Machine Learning.
Does anybody has any link or documents where I can get idea to do this task.
What I am thinking is of first converting the document to text format and then fro Text file extract the information.But this I can do with one file at a time.
I want to know how can I perform this in millions of document.
You don't need to convert documents to text, you can do this with images directly.
To do image classification you can build basic CNNs with Keras library.
https://towardsdatascience.com/building-a-convolutional-neural-network-cnn-in-keras-329fbbadc5f5
This basic CNN will be enough for you to train an image classifier. But you want to get state of the art accuracy, I recommend get a pretrained resnet50 and train it to build an image classifier. Other than accuracy, there is another major advantage of using pre trained network, you'll need less data to train a robust image classifier.
https://engmrk.com/kerasapplication-pre-trained-model/?utm_campaign=News&utm_medium=Community&utm_source=DataCamp.com
The only thing that you'll need to change is number of output classes from 1000 to the number of classes you want.

It's possible to do object detection (one-class) in images retraining Inception model?

There is a way to do object detection, retraining Inception model provided by Google in Tensorflow? The goal is to predict wheter an image contains a defined category of objects (e.g. balls) or not. I can think about it as a one-class classification or multi-class with only two categories (ball and not-ball images). However, in the latter I think that it's very difficult to create a good training set (how many and which kind of not-ball images I need?).
Yes, there is a way to tell if something is a ball. However, it is better to use Google's Tensorflow Object Detection API for Tensorflow. Instead of saying "ball/no ball," it will tell you it thinks something is a ball with XX% accuracy.
To answer your other questions: with object detection, you don't need non-ball images for training. You should gather about 400-500 ball images (more is almost always better), split them into a training and an eval group, and label them with this. Then you should convert your labels and images into a .record file according to this. After that, you should set up Tensorflow and train.
This entire process is not easy. It took me a good couple of weeks with an iOS background to successfully train a single object detector. But it is worth it in the end, because now I can rapidly switch out images to train a different object detector whenever an app needs it.
Bonus: use this to convert your new TF model into a .mlmodel usable by iOS/Android.

Neural network image architecture

I've got a set of 16000 images. I've got one sample images, I need to find one of 16000 images on it. I've already tried OpenCV's ORB + FLANN approach, but it is too slow. I hope once trained network will be faster than it. I don't know NN theory well, I've read some articles & websites and I've got a bunch of questions:
Should I use 16k output neurons to classificate input image?
How can I train my NN if I have only one train image per class?
What architecture should I use?
Maybe I should increase training dataset by randomly distorting input images?
Sorry in advance for my bad English:)
I'm not an expert, but I think that this kind of problem is not the perfect suit for neural networks. Probably feature extraction, interest points and descriptors, all avaliable in openCV, are the best option. Anyway, let's try this. With the infos received, I think you could try this:
SOM network - Create a Self Organizing Maps network with 16.000 classes for output. Never saw a example with that many classes and just one sample per class, but it should work. Maybe you can try to use PCA to reduce the images dimensionality. Keep training the network with your images (or PCA features). Start with, I don't know, 1.000 epochs. Keep raising this value until you have good results.
Here you can read a bit more about SOM

HOG Feature Extraction of Arabic Line Images

I am doing a project on Writer Identification. I want to extract HOG features from Line Images of Arabic Handwriting. And than use Gaussian Mixture Model for Classification.
The link to the database containing the line Images is : http://khatt.ideas2serve.net/
So my questions are as follows;
There are three folders namely Test, Train and Validate. So, from which folder do I need to extract the features. And for what purpose should we use each of the folders.
Do we need to extract the features from individual images and merge them or is there any method to extract features of all the images together.
Test, Train and Validate
Read this stats SE question: What is the difference between test set and validation set?
This is basic machine learning, so you should probably go back and review your course literature, since it seems like you're missing some pretty important machine learning concepts.
Do we need to extract the features from individual images and merge them or is there any method to extract features of all the images together.
It seems, again, like you're missing basic concepts here. Histogram of oriented gradients subdivides the image and finds the oriented gradient. See this SO question for examples of hos this looks.
The traditional way of using HoG is: for each image in your training set, you extract the HoG, use these to train a SVM, validate the training with the validation set, then actually use the trained SVM on the test set.
You need to extract the HOG features from each image separately. Furthermore, you have to resize all images to be of the same size, otherwise all your HOG vectors will be of different length.
You can use the extractHOGFeatures function in MATLAB. See this example.

Resources