Object detection using python - computer-vision

I am working on my college project and for that I have to recognize different hand gestures, so can any one tell me that how can I learn this image recognization quickly using python?

If you're using Python, I think you would better use Tensorflow.
Check https://github.com/tensorflow/models/tree/master/object_detection.
It is easy to follow instructions and they provide convenient script for retraining a detection model.
If you need to train a model with custom data, you have to prepared images dataset annotated with bounding boxes.

Related

PyTorch model to C++

I have trained the detection algorithm and saved my best model. Now I want to convert my model (pretrained) to C++ and use it in my app. I wanted to know what are the possible ways to convert a pyTorch model to c++?
Thanks!
You can use TorchScript intermediate representation of a PyTorch model, through tracing and scripting, that can be run in C++ environment. For this, you'll probably have to modify the model itself in order for it to be traced or scripted.
You can use ONNX (Open Neural Network Exchange), through which you can export your model and load it in another C++ framework such as Caffe. It comes with its own implications though.
The easiest is to try Embedding Python, through which you can run your python (pytorch) model in C++ environment. Note that the model will still run in python, but only through C++, so there won't be any speed gains that you might be expecting in C++.
Also, with the release of torchvision 0.5, all models in torchvision have native support for TorchScript and ONNX.

Is there possible to train own module using TensorFlow and then use it in OpenCV for detection?

I want to ask, can we train our own module (images) of some specific objects (maybe 2~3 objects), and then by using OpenCV DNN module detect those objects?
I have already tried a pre-trained simple with ssd_mobilenet_v1_coco_11_06_2017 in OpenCV, which works and is able to detect objects.
But now I want to train my own module with specific objects images, and as above using OpenCV detect those objects. I have searched a lot, but there is no a good tutorial to show how we can use TensorFlow train own module.
Thanks in advance!
Yes! Of course you can train your own, and in fact if you look at the source for the sample you were using they provide a guide on how to train your own:
https://github.com/datitran/object_detector_app/blob/master/object_detection/g3doc/defining_your_own_model.md
In this section, we discuss some of the abstractions that we use for defining detection models. If you would like to define a new model architecture for detection and use it in the Tensorflow Detection API, then this section should also serve as a high level guide to the files that you will need to edit to get your new model working.

OpenCV training output

So I am creating my own classifiers using the OpenCV Machine Learning module for age estimation. I can train my classifiers but the training takes a long time so I would like to see some output (status classifier, iterations done etc.). Is this possible? I'm using ml::Boost, ml::LogisticalRegression and ml::RTrees all inheriting cv::StatModel. Just to be clear i'm not using the given application for recognizing objects in images (opencv_createsamples and opencv_traincascade). The documentation is very limited so it's very hard to find something in it.
Thanks
Looks like there's an open feature request for a "progress bar" to provide some rudimentary feedback... See https://github.com/Itseez/opencv/issues/4881. Personally, I gave up on using the OpenCV ML a while back. There are several high-quality tools available to build machine learning models. I've personally used Google's Tensorflow, but I've heard good things about Theano and Caffe as well.

Implementation help on database video matching in OpenCV

I'm trying to develop a program to match query videos to videos in a database. So something like google image search but for videoclips. I'm using OpenCV for this implementation.
I can succesfully generate feature descriptors for selected frames in de video (which tbh isn't that hard).
I have no clue how I should implement the database part. I was wondering if somebody could give me pointers to what already exists in OpenCV to ease my implementation: What classes to extend, how to structure it, any existing implementations/examples,...?
Basically I would have a set of descriptors from a query clip which I want to compare to a (large) database of precomputed descriptors, and then have some voting algorithm to return a best match.
So i'm not asking for which algorithms to use, I just want to know about the best practices in OpenCV to implement such a thing i'm describing.
I am using OpenCV 2.4.8 C++ on a Mac in Xcode, if that somehow matters
EDIT
Let me make my question a little bit more specific.
If I use SIFT of SURF detector/descriptor I get a lot of features. Doing this for a bunch of frames of a bunch of videos will result a lot of data.
If I use FlannMatcher (or something in the likes) I have to have everything in memory... but this seems very unreasonable... So somehow there should be a way to implement this using a database. So I'm looking for any hints on how to do this, what kind of database to use...
thanks
You may cluster the features into fewer classes, and store/search class id before comparing actual features

Using Blender for physics simulations

I've been looking at different ways of creating a certain physics simulation. What I am trying to do is to 3D model the motion of a body under the effects of various forces over time. I was originally looking at coding something in c++ using a physics engine (Bullet) and a 3d engine (Irrlicht). However, I noticed that Blender already allows one to do physical simulations since Bullet is integrated with it (correct me if I'm wrong). This seems like it would make it much easier to design the simulation exactly how I want it (with Blender's extensive GUI).
My issue is that I would like to use the results from the simulation (basically x,y,z,pitch,roll,yaw of the body at each timestep) for input into c/c++ code (or another language if its much easier for this). Can this be done with Blender? Is there a better software package for this that I am overlooking? Thanks, any advice is appreciated.
I would use a Python script for that task, as Blender has a nice interface getting/setting the objects and their properties programmatically through .py files.
So after you are done with your animation you can call a script to walk through the frames and save the required data into a file.
A getting started doc can be found here: http://wiki.blender.org/index.php/Doc:Manual/Extensions/Python or here: http://wiki.blender.org/index.php/Dev:2.5/Py/API/Intro
There is a huge list of scripts worth browsing for similar routines you need. http://wiki.blender.org/index.php/Extensions:2.5/Py/Scripts
As mentioned before, it would be very easy to use python for this. For more specific use if using Blender, perhaps you should consult the main Blender forum www.blenderartists.org
Blenderartists python support: http://blenderartists.org/forum/forumdisplay.php?11-Python-Support
Blender 2.5 code snippets (Introduction to scripting for Blender 2.5): http://blenderartists.org/forum/showthread.php?193908-Code-snippets.-Introduction-to-Python-scripting-in-Blender-2.5x