Machine Learning - Features design for Images - python

I just started learning about machine learning recently and have a project where I have to develop a program for QR code localization so that a QR code can be detected and read at any angle of rotation. Development will be done in Python.
The plan is to gather various images of the QR codes at different angles with different backgrounds. From this I would like to create a dataset for training with neural networks and then testing.
The issue that I'm having is that I can't seem to figure out a correct feature design for the dataset and how to identify the QR code from the images for feature processing. Would I use ground-truth images to isolate the QR code or edge magnitude maps? Feature design for images seems to confuse me.
Any help with this would be amazing? Thanks for your time.

You mention that you want to train neural networks. Instead of starting with your problem, start with a beginner example.
Start with MNIST example for deep learning.
Train your Neural Network on notMNIST dataset that is used in Udacity Deep Learning Course.
In these two examples, you will see that you do not design features but NN somehow founds correct features. Easiest solution would be to use same technique for QR codes in your dataset.

Related

Transfer learning for facial identification using classifiers

I wish to know whether I can use an Inception or ResNet model to identify faces. I want to know whether transfer learning and training is even considerable for my task.
I just want to be able to identify faces but I am also curious whether I can retrain/optimize a pre-trained model for my task.
Or have I been reading of things wrong; do I need to get a pre-trained model that was designed for faces?
I have tried poking around with Inception and VGG16 but I have not trained them for faces. I am working on it but I want to know whether this is even viable or simply a waste of time. If I use transfer learning with FaceNet I think I'll be better off.
Transfer learning for facial detection would be a great way to go ahead. Also, yes transfer learning with facenet is a great idea.
Also, for transfer learning to work it is not necessary that the model had to be initially pre-trained with only faces like using facenet. A model pre-trained with imagenet would also be pretty darn good! This is a very hot topic, so do not try to reinvent the wheel. There are many repositories that have already done this using transfer learning from imagenet dataset and using resnet50 with astonishingly good results.
Here is a link to one such repository:
https://github.com/loheden/face_recognition_with_siamese_network
Also note that siamese networks is a technique that is especially good in the facial recognition use case. The concept of siamese is really simple: take two images and compare the features of these two images. If the similarity in features are above a set threshold, then the two images are the same (the two faces are the same) else not the same (face not recognized).
Here is a research paper on siamese networks for facial recognition.
Also, here is a two-part tutorial on how to implement the siamese network for facial recognition using transfer learning:
http://www.loheden.com/2018/07/face-recognition-with-siamese-network.html
http://www.loheden.com/2018/07/face-recognition-with-siamese-network_29.html
The above tutorial's code is in the first Github link I shared at the beginning of this answer.

Recognition of nipple exposure in the image, and Automatically cover nipple area

I'd like to implement something like the title, but I wonder if it's technically possible.
I know that it is possible to recognize pictures with CNN,
but I don't know if can be automatically covered nipple area.
If have library information about any related information,
I would like to get some advice.
CNNs are able to detect whatever you train them for, to varying degree of accuracy. What you would need are a lot of training samples (ie. samples of ground truths with the original image, and the labeled image) with which to train your models, and then some new data which you can test the accuracy of your model on. The point is, CNNs are not biased to innately learn a task, you have to tell them what to learn!
I can recommend the machine learning library Keras (https://keras.io/) if you plan to do some machine learning using CNNs, as it's pretty simple and somewhat beginner-friendly. Take some of the tutorials for CNNs, which are quite good.
Essentially, you have what I can only assume is a pretty niche problem. The main issue will come down to how much data you have to train your model. CNNs need a lot of training data, especially for a problem like this which isn't simple. A way which would make this simpler would be to have a model which detects the ahem area of interest and denotes it as such on a per-pixel basis. Then a simple mask could be applied to the source image to censor it. This relates to image segmentation, and there are many academic papers on the topic.

How to recognize real scenes image using scikit-learn?

I am new in scikit-learn, I have a lot of images and images size not all same, A kind of are real scenes image like
cdn.mayike.com/emotion/img/attached/1/image/dt/20170920/12/20170920121356_795.png
cdn.mayike.com/emotion/img/attached/1/image/mainImg/20170916/15/20170916153205_512.png
, another are not real scenes image like
cdn.mayike.com/emotion/img/attached/1/image/dt/20170917/01/20170917011403_856.jpeg
cdn.mayike.com/emotion/img/attached/1/image/dt/20170917/14/20170917145613_197.png
.
I want to use scikit-learn recognizing which not real scenes image, I think it simlar to http://scikit-learn.org/stable/auto_examples/applications/plot_face_recognition.html#sphx-glr-auto-examples-applications-plot-face-recognition-py. I am totally no idea how to begin.How to creating dateset and extracting features from images? Can someone tell me what should I do?
This seems to not directly be a programming problem here and your questions are related to non-basic 'current' research.
It seems that you should read about Natural Scene (Statistics) and get yourself familiar with one of the current machine learning frameworks like TensorFlow, Caffe.
There are many tutorials out there to get started, for example you could begin with a binary classifier which outputs if the given image shows a natural scene or not.
Your database setup could have a structure like so:
-> Dataset
-> natural_scenes
-> artificial_images
Digits for example can use such a structure to create a dataset and is able to use models designed for Caffe and TensorFlow.
I would also recommend that you read about finetuning nerual networks, as you would need a lot of images in your database if you start training from scratch.
In Caffe you can finetune pretrained models like CaffeNet or GoogeNet.
I think those are some basic information which should get you started.
As of scikit-learn and face-detection: Face-Detection is more looking for local candidates or image patches which could possibly contain a face. Your problem on the other hand is more of a global problem as the whole image is concerned. That said I would start off with a neural network here which is able to extract local and global features for you.

Steps involved in classifying images?

I am very new to machine learning and have been implementing ML algorithms on the datasets.
But how do I go about classifying images using the Ml algorithms?
How do I feed the images to the learning models in the form of numpy arrays?
Can anyone brief me about the steps involved? I have been reading about feature extraction but I am not able to figure out how to do that.
Image classification is not much different, at its core, from any other sort of classification.
Your data are images, right? Well, we need to create some variables ("features") from those images in order to get a sense of what's in the images. Computers can understand matrices, not just straight-up images like humans do (although there are arguments that what humans are doing when they see images is deconstructing images into patterns of pixels, but let's keep it simple). Using OpenCV is a great way to turn image pixels into matrices.
Each matrix (i.e. each image) will have a corresponding tag or classification (e.g. "dog" or "cat"). You feed those matrices through your algorithm in order to classify each image.
That will get you started. There's so much that goes into machine learning related to images, but at its core, the problem is the same as elsewhere: take a matrix/set of data and use an algorithm to find patterns in the data and a function that maps the input to the output label. You might be served well by reading an intro to machine learning book or taking a course.

How can i programmatically generate descriptors for an arbitrary data set?

I am currently analyzing a set of pictures, that I want to classify.
Classification is done by a Artificial Neural Network in a supervised manner.
I have a test set that assigns to a each picture its class.
What I want to do now is generate a lot of descriptors and then do a PCA on these
and do a statistical analysis how much the descriptor is able to describe the
class of the picture.
How can i generate descriptors for these pictures programatically? This could help me in future classification problems too. Let us assume I have enough computation power (100 core cluster)
Are there libraries that incorporate a lot of descriptors for images?
You can basically follow two approaches to start:
Feature based, using methods such as SIFT or GIST followed by the so called Bag of Words approach. The vlfeat site contains an excellent demo of this.
Deploying deeplearning algorithms, such as the Sparse Autoencoder to learn basic features of your dataset which can then be further used for classification.

Categories

Resources