Compare different methods of tracking
This software is published for academic and non-commerical use only.
Opencv 3.0+, Tensorflow 1.0+ Python 3.5
This code has been tested on Windows 8.1, Windows 10, macOS Sierra
- Meanshift and Camshift Algorithms
- Histograms
- Grabcut Algorithm
- Convolutional Neural network to predict four corners for the rectangle (CNN based Bounding Box regressor model)
- Linear regression loss function to train the network.
- It is used to create a dataset on your own in a small scale to test your model.
- The training images must be present in same directory where all the training images are kept.
- Then in that directory run
python box_find.py.
- Then you will get images one by one, where you should use your mouse to draw boxes on the image.
- Then press 'm' to go to next image.
- The image name , along with the coordinates of the box is written in the text file dataset.txt
- The dataset created in the above process is used in training the model.
- Input image is resized to 256x256x3
Type | Dimensions | Comments |
---|---|---|
Convolutional Layer 1 | 3 filters, each 5x5x3 | Layer output dimension is 128x128x3 |
Convolutional Layer 2 | 3 filters, each 5x5x3 | Layer output dimension is 64x64x3 |
Feed Forward layer 1 | 12288 Neurons | |
Feed Forward layer 2 | 4 Neurons | Output layer |
- Then run
python bounding_box_regression.py
- The dataset created is trained along with a pre-trained vgg16 model.
- Weights for the model can be found here
- This algorithm is used in a hope to classify each pixel to each object.
- To run this code firstly you must change the image you want to read, by changing this line of code.
cv2.imread("abc.jpg")
- The run
python grabcut.py
- Then draw a box around the object and wait for the program to highlight the object separately, drawing a contour around it.