This project utilizes OpenCV to perform object tracking and image classification in real-time using a pre-trained DenseNet-121 model and the CSRT tracking algorithm.
- Real-time object tracking with CSRT (Channel and Spatial Reliability Tracker)
- Image classification using DenseNet-121, a convolutional neural network model
- Automatic extraction and classification of objects within a user-defined region of interest
Before you run this project, you must have the following installed:
- Python 3.6 or higher
- opencv-python
- opencv-contrib-python
- NumPy
Clone this repository to your local machine using:
git clone https://github.com/chenyu-chang/object_traking_opencvEnsure you have the required packages:
pip install numpy opencv-python opencv-contrib-pythonRun the script using Python:
python object_tracker.pyUpon running the script, a video window will open. Use the mouse to select a region of interest (ROI) for tracking and classification. The tracker will then initialize and begin tracking the object, with its predicted class displayed on the screen.
The DenseNet-121 model requires two files:
DenseNet_121.prototxt: The architecture of the CNN.DenseNet_121.caffemodel: The pre-trained weights.
Make sure to download these files and place them in the densenet_121 directory before running the script. The synset_words.txt file containing class labels should also be in this directory. You can download by link: download
- The ROI selection window can be closed by pressing the 'Esc' key.
- Tracking and classification continue in real-time; to exit, press the 'Esc' key in the main tracking window.
- DenseNet-121 model creators and maintainers.
- OpenCV contributors and maintainers.
