how to find similar images by using CNN model - python

The requirement of my task is to find the similar output image with the input image in the CNN. There are about half millions images need to be handled with
, it would not realistic to label each image. Beyond that, the images are candlestick charts about all stocks, so it is also very hard to classify all images.
My basic idea is that exporting the key features of images in CNN and comparing these features by using Hashing algorithm to get the similar one. But the idea was not compeleted, and how to done it in the python is also a big challenge. Therefor, is there anyone can help me with this issue,Thank you very much!!. If possible could you give me any relative articles or codes?

Mind reading this
https://towardsdatascience.com/find-similar-images-using-autoencoders-315f374029ea
This uses autoencoders to find similar images.
Please do post the final output code that you will apply so that i have better understand also.

Related

Take image input and get 3 float outputs with Machine Learning

I have an image that consists of only black and white pixels. 500x233px. I want to use this image as an input, or maybe all the pixels in the image as individual inputs, and then receive 3 floating point values as output using machine learning.
I have spent all day on this and have come up with nothing. The best I can find is some image classification libraries, but I am not trying to classify an image. I’m trying to get 3 values that range from -180.0 to 180.0.
I just want to know where to start. Tensorflow seems like it could probably do what I want, but I have no idea where to start with it.
I think my main issue is that I don’t have one output for each input. I’ve been trying to use each pixel’s value (0 or 1) as an input, but my output doesn’t apply to each pixel, only to the image as a whole. I’ve tried creating a string of each pixel’s value and using that as one input, but that didn’t seem to work either.
Should I be using neural networks? Or genetic algorithms? Or something else? Or would I be better off with only receiving one of the three outputs I need, and just training three different models for each output? Even then, I’m not sure how to get a floating point value out of these things. Maybe machine learning isn’t even the correct approach.
Any help is greatly appreciated!

How would I go about image labeling/Classification?

Let's say I have a set of images of passports. I am working on a project where I have to identify the name on each passport and eventually transform that object into text.
For the very first part of labeling (or classification (I think. beginner here)) where the name is on each passport, how would I go about that?
What techniques / software can I use to accomplish this?
in great detail or any links would be great. I'm trying to figure out how this is done exactly so I can began coding
I know training a model is involved possibly but I'm just not sure
I'm using Python if that matters.
thanks
There's two routes you can take, one where you have labeled data (or you want to label data yourseld), and one where you don't have that.
Let's start with the latter. Say you have an image of a passport. You want to detect where the text in the image is, and what that text says. You can achieve this using a library called pytessaract. It's an AI that does exactly this for you. It works well because it has been trained on a lot of other images, so it's good in detecting text in any image.
If you have labels you might be able to improve your model you could make with pytessaract, but this is a lot harder. If you want to learn it anyway, I would recommend with learning ŧensorflow, and use "transfer learning" to improve your model.

Deep learning model to clean documents

I am trying to build a Convolutional Autoencoder which can remove pen marks such as circles, underlines, etc from official documents.
I have the original, clean soft copy of the document and the xeroxed copy with the pen marks.
The xeroxed copy would obviously not completely match up with the original doc and it would be slightly skewed or shifted, etc while scanning.
Additionally, since the doc size is huge (2360, 1650), I had to split the image into 4 halves of size (587, 412) to input into my model.
What I would like to know is would the above issues cause any problems while training and is there any way to rectify it?
Any help would be highly appreciated.
Thanks
EDIT:
As you can see (hopefully!!), the noisy image is slightly different because of skewness or translation while xeroxing.
I don't think it will cause any problems. But, if it does, you can always load the image, resize it to a desired shape and then input it into the model.

How to identify three types of objects in a image?

I want to identify three different objects from a satellite wind image. The problem is three of them are somewhat similar. I tried to identify using templete matching but it didn't work. Three objects are as follows.
Here the direction of the object is not important but the type of the head in the line is important. Can you suggest a way to proceed?
Assuming your image consists of only pure black and pure white pixels,
You can find contours and its bounding rectangle or minAreaRect for each of them.
https://docs.opencv.org/2.4/modules/imgproc/doc/structural_analysis_and_shape_descriptors.html?highlight=minarearect#minarearect
Then iterate over the contours considering there rectangles as separate images. Now you do classification of these images. You may use template matching too.
Good luck!
Have you thought about machine learning?
for example a small cnn that is used for digits recognition could be "retrained" using a small set of your images, Keras also has an data augmentation feature to help ensure a robust classifier is trained.
There is a very good blog post by
Yash Katariya found # https://yashk2810.github.io/Applying-Convolutional-Neural-Network-on-the-MNIST-dataset/, in which the MNIST data set is loaded in and the network is trained, it goes through all of the stages you'd need to in order to use ML for your problem.
You mention you've tried template matching, however you also mention that the rotation is not important, which to me implies that an object could be rotated, that would cause failures for TM.
You could look into LBP (Local Binary Patterns), or maybe OpenCV's Haar Classifier (however it's sensitive to rotation).
Other than the items I have suggested there is a great tutorial found # https://gogul09.github.io/software/image-classification-python which uses features and machine learning you may benefit from looking at to apply to this problem.
I hope while not actually giving you an answer to your question directly, I have given you a set of tools you can use that will solve it with some time invested and some reading.

Tensor Flow Image Object Location

This is a fairly straightforward question, but I am new to the field. Using this tutorial I have a great way of detecting certain patterns or features. However, the images I'm testing are large and often the feature I'm looking for only occupies a small fraction of the image. When I run it on the entire picture the classification is bad, though when zoomed it and cropped the classification is good.
I've considered writing a script that breaks an image into many different images and runs the test on all (time isn't a huge concern). However, this still seems inefficient and unideal. I'm wondering about suggestions for the best, but also easiest to implement, solution for this.
I'm using Python.
This may seem to be a simple question, which it is, but the answer is not so simple. Localisation is a difficult task and requires much more leg work than classifying an entire image. There are a number of different tools and models that people have experimented with. Some models include R-CNN which looks at many regions in a manner not too dissimilar to what you suggested. Alternatively you could look at a model such as YOLO or TensorBox.
There is no one answer to this, and this gets asked a lot! For example: Does Convolutional Neural Network possess localization abilities on images?
The term you want to be looking for in research papers is "Localization". If you are looking for a dirty solution (that's not time sensitive) then sliding windows is definitely a first step. I hope that this gets you going in your project and you can progress from there.

Categories