HAAR cascade weak filters - opencv

I am reading haar cascade algorithm and trying to use the opencv version of creating custom haar cascade, but what I really want is to look at the filters (weak filters) in the cascade and use them separately, but I did not succeed in doing it till now, does anybody has any idea how to do it?
I created a cusotm HAAR cascade file (xml file) and wanted to get the weak filters and use them separately in contrast to opencv API which uses all of them.
also I wanted to decide on the number of weak filters for haar cascade (upon creation)

Related

How to extract weights from trained tensorflow object detection api model

I am using the Tensorflow Object Detection API to train a couple of models (with SSD and Faster RCNN) in a custom dataset. Everything works well, but I want to know how to extract the convolutional and classification model weights, in order to load those weights in an external (for instance keras) convolutional and full connected corresponding model. I've read about the meta architectures (SSDMetaArch and FasterRCNNMetaArch) and restoring checkpoint, but I am not sure yet how to do it for my purpose.
The above because I want to use something like CAM or GradCAM to visually check what the model learns for every class in my dataset.
Thank you

Image features for object classification

Let's assume that I have 10 different objects and for each object I have 100 corresponding images. I want to run any machine learning algorithm to classify whether an object is type 0, type 1 etc.
Assuming that each object type is different from each other (EX: object 1: Cat, object 2: Motorcycle, object 3: Trees) what are the possible features for these images to extract to be able to do some classification on them?
Since, you have limited training data, I would suggest you to use bag of words approach along with K- means for clustering.
As far as features are concerned, you can extract SIFT features or SURF features or you could even take the filter responses of Laplacian of Gaussian filter for some random pixels.
If you used a fully connected Deep Neural Network then you would't really have to specify features. The input would just be the pixels. If you wanted to use a SVM then maybe extract a histogram from each image or something, but that probably wouldn't be as effective.

OpenCV: what is the difference between these 2 haar cascade data sets?

I have seen there are 2 different Haar Cascade datasets in OpenCV. For an example, take a look at haarcascade_upperbody.xml and haarcascade_mcs_upperbody.xml. what is this new mcs thing? The only difference I can monitor is that haarcascade_mcs_upperbody.xml is providing a way better results than the other one.
So, can someone please explain me the difference between these 2 types? When training my own datasets, how can I select between these 2?
I think this web site have the answer : OpenCV
The diference is eepending on there train data, so that, if you want to select a suit classifier, I prefer you try both two to find a better result.

Basic understanding of the Adaboost algorithm

I'm a machine learning newbie trying to understand how Adaboost works.
I've read many articles explaining how Adaboost makes use of set of weak *classifiers* to create a strong classifier.
However, I seem to have problem understanding the statement that "Adaboost creates a Strong Classifier".
When I looked at implementations of Adaboost, I've realized that it doesn't "actually" create a Strong Classifier but somehow in the TESTING PHASE figures out on "how to use set of Weak Classifiers to get more accurate results" which in turn acts like a strong classifier "Collectively".
So technically there is NO SINGLE STRONG CLASSIFIER created (but set of weak classifiers collectively act as a strong classifier).
Please correct me if I'm wrong. It would be nice if someone can throw in some comments regarding this.
A classifier is a black box that receives an input (feature vectors) and returns an output (labeled vectors). So to call something a classifier, you only care about what it does, and not how it does it. AdaBoost's classifier can be seen as such black box, so it's indeed a single classifier, even if it uses internally several weak classifiers to produce such output.

Training sets for AdaBoost algorithm

How do you find the negative and positive training data sets of Haar features for the AdaBoost algorithm? So say you have a certain type of blob that you want to locate in an image and there are several of them in your entire array - how do you go about training it? I'd appreciate a nontechnical explanation as much as possible. I'm new to this. Thanks.
First, AdaBoost does not necessarily have anything to do with Haar features. AdaBoost is a learning algorithm that combines weak learners to form a strong learner. Haar features are just a type of data on which an AdaBoost algorithm can learn.
Second, the best way to get them is to prearrange your data. So, if you want to do facial recognition a la Viola and Jones, you'll want to mark the faces in your images in a mask/overlay image. When you're training, you select samples from the image, as well as whether the sample you select is positive or negative. That positivity/negativity comes from your previous marking of the face (or whatever) in the image.
You'll have to make the actual implementation yourself, but you can use existing projects to either guide you, or you can modify their projects.

Resources