kNN to predict LPR - python-3.x

I am doing a License Plate Recognition system using python. I browsed through the net and I found many people have done the recognition of characters in the license plate using kNN algorithm.
Can anyone explain how we predict the characters in the License Plate using kNN ?
Is there any other algorithm or method that can do the prediction better ?
I am referring to this Git repo https://github.com/MicrocontrollersAndMore/OpenCV_3_License_Plate_Recognition_Python

Well, I did this 5 years ago. I will suggest you that, maybe right now is so much better to do this using ML Classifier Models, but if you want to use OpenCV. OpenCV has a pretty cool way to make ANPR using an OCR.
When I did it, I used a RasberryPi for processing and capture images and with c++ run openCV in another computer. I recommend you check this repo and if you're interested look for the book reference there. I hope my answer helps you to find your solution.
https://github.com/MasteringOpenCV/code.

Related

Non-MNIST Digit Recognition Pytorch

I'm looking for examples of pytorch being used to classify non-MNIST digits. After hours of searching, it appears the algorithms are against me. Does anyone have a good example? Thanks.
I am posting this as answer since i do not have the rep to comment,
Please view the google street view dataset (SVHN). It is like MNIST but there is much more noise present in the data. Another option for you could be to use GANs and make more images which practically wouldn't have existed before. You could also try your hand at non - english mnist data-sets (though it moves away from your original goal).
Link to SVHN with pytorch: https://github.com/potterhsu/SVHNClassifier-PyTorch
Link to original SVHN: https://pytorch.org/docs/stable/torchvision/datasets.html#svhn
P.S. You could also try making a dataset on your own! This is quite fun to do.

Replicating Semantic Analysis Model in Demo

Good day, I am a student that is interested in NLP. I have come across the demo on AllenNLP's homepage, which stated that:
The model is a simple LSTM using GloVe embeddings that is trained on the binary classification setting of the Stanford Sentiment Treebank. It achieves about 87% accuracy on the test set.
Is there any reference to the sample code or any tutorial that I can follow to replicate this result, so that I can learn more about this subject? I am trying to obtain a Regression Output (Instead of classification).
I hope that someone can point me in the right direction.. Any help is much appreciated. Thank you!
AllenAI provides all code for examples and lib opensource on Git, including AllenNLP.
I found exactly how the example was run here: https://github.com/allenai/allennlp/blob/master/allennlp/tests/data/dataset_readers/stanford_sentiment_tree_bank_test.py
However, to make it a Regression task, you'll have to tweak directly on Pytorch, which is the underlying technology for AllenNLP.

Customizing the Inception V3 module

How to use the Inception V3 tensorflow module to train with our own requirement dataset images. Say for example I want to train the Inception V3 module with the different cool drinkcompany brands Pepsi, Sprite etc.. How it can be achieved..??
In the link https://github.com/tensorflow/models/tree/master/inception they have explained with the ImageNet. I am bit confused with that. Please explain the stuff.
I suggest you to check Transfer Learning. which consists in retrain only the last layers with new categories
How to Retrain Inception's Final Layer for New Categories
Baptiste's answer linking to the Tensorflow site is good. This is a very broad question and his link is a good start.
If you'd like something a little more step-by-step then the Tensorflow for Poets tutorial is basically the same but doesn't require the use of Bazel commands. It initially uses flowers but you can use whatever dataset you want.
There are many other examples and tutorials on the web. I found some more with a quick search including this page and this video.
Good Luck!

Entity Recognition and Sentiment Analysis using NLP

So, this question might be a little naive, but I thought asking the friendly people of Stackoverflow wouldn't hurt.
My current company has been using a third party API for NLP for a while now. We basically URL encode a string and send it over, and they extract certain entities for us (we have a list of entities that we're looking for) and return a json mapping of entity : sentiment. We've recently decided to bring this project in house instead.
I've been studying NLTK, Stanford NLP and lingpipe for the past 2 days now, and can't figure out if I'm basically reinventing the wheel doing this project.
We already have massive tables containing the original unstructured text and another table containing the extracted entities from that text and their sentiment. The entities are single words. For example:
Unstructured text : Now for the bed. It wasn't the best.
Entity : Bed
Sentiment : Negative
I believe that implies we have training data (unstructured text) as well as entity and sentiments. Now how I can go about using this training data on one of the NLP frameworks and getting what we want? No clue. I've sort of got the steps, but not sure:
Tokenize sentences
Tokenize words
Find the noun in the sentence (POS tagging)
Find the sentiment of that sentence.
But that should fail for the case I mentioned above since it talks about the bed in 2 different sentences?
So the question - Does any one know what the best framework would be for accomplishing the above tasks, and any tutorials on the same (Note: I'm not asking for a solution). If you've done this stuff before, is this task too large to take on? I've looked up some commercial APIs but they're absurdly expensive to use (we're a tiny startup).
Thanks stackoverflow!
OpenNLP may also library to look at. At least they have a small tutuorial to train the name finder and to use the document categorizer to do sentiment analysis. To trtain the name finder you have to prepare training data by taging the entities in your text with SGML tags.
http://opennlp.apache.org/documentation/1.5.3/manual/opennlp.html#tools.namefind.training
NLTK provides a naive NER tagger along with resources. But It doesnt fit into all cases (including finding dates.) But NLTK allows you to modify and customize the NER Tagger according to the requirement. This link might give you some ideas with basic examples on how to customize. Also if you are comfortable with scala and functional programming this is one tool you cannot afford to miss.
Cheers...!
I have discovered spaCy lately and it's just great ! In the link you can find comparative for performance in term of speed and accuracy compared to NLTK, CoreNLP and it does really well !
Though to solve your problem task is not a matter of a framework. You can have two different system, one for NER and one for Sentiment and they can be completely independent. The hype these days is to use neural network and if you are willing too, you can train a recurrent neural network (which has showed best performance for NLP tasks) with attention mechanism to find the entity and the sentiment too.
There are great demo everywhere on the internet, the last two I have read and found interesting are [1] and [2].
Similar to Spacy, TextBlob is another fast and easy package that can accomplish many of these tasks.
I use NLTK, Spacy, and Textblob frequently. If the corpus is simple, generic, and straightforward, Spacy and Textblob work well OOTB. If the corpus is highly customized, domain-specific, messy (incorrect spelling or grammar), etc. I'll use NLTK and spend more time customizing my NLP text processing pipeline with scrubbing, lemmatizing, etc.
NLTK Tutorial: http://www.nltk.org/book/
Spacy Quickstart: https://spacy.io/usage/
Textblob Quickstart: http://textblob.readthedocs.io/en/dev/quickstart.html

OpenCV 2.4.3 with Visual C++ express cascading classifiers images query

I am learning to implement a hand gesture recognition project. For this, I have gone through several tutorials where they use color information, background subtraction, various object segmentation techniques.
However, one that I would like to use is a method using cascading classifiers however I dont have much understanding in this approach. I have read several text and papers and I understand its theory however, I still dont understand what are good images to train the cascading classifer on. Is it better to train it on natural color images or images with hand gestures processed with canny edge detection or some other way.
Also, is there any method that uses online training and testing methods similar to openTLD but where the steps are explained. The openCV documentation for 2.3-2.4.3 are incomplete with respect to the machine learning and object recognition and tracking except for the code available at: http://docs.opencv.org/doc/tutorials/objdetect/cascade_classifier/cascade_classifier.html
I know this is a long question but I wanted to explain my problem thoroughly. It would help me to understand the concept better than just to use online code.
Sincere thanks in advance!
if you think about haar classifier, a good tutorial is here

Resources