# C++ Tracker Implementation This project implements a C++ version of the DiMP tracker, focusing on the bounding box regressor and classifier components. ## Overview The project consists of two main components: 1. **BBRegressor**: Implements the IoU (Intersection over Union) network for bounding box regression 2. **Classifier**: Implements the feature extraction for target classification ## Requirements - CMake (3.18 or higher) - C++17 compatible compiler - LibTorch (PyTorch C++ API) - **CUDA (required)** - This implementation requires CUDA and does not support CPU-only execution ## Building the Project ### Automatic Build The easiest way to build the project is to use the provided build script: ```bash chmod +x build.sh ./build.sh ``` This will: 1. Check for CUDA availability (and exit if not found) 2. Download LibTorch with CUDA support if not already installed 3. Configure the project with CMake 4. Build the project 5. Install the executable to the `bin/` directory ### Manual Build If you prefer to build manually: ```bash mkdir -p build cd build cmake .. -DCMAKE_BUILD_TYPE=Release cmake --build . --config Release ``` ## Running the Demo To run the demo application: ```bash # Make sure CUDA is properly set up in your environment ./run_demo.sh ``` The script will check for CUDA availability and set up the necessary environment variables before running the demo. ## Project Structure - `cimp/`: Main C++ implementation - `bb_regressor/`: Bounding box regressor implementation - `classifier/`: Feature extractor implementation - `demo.cpp`: Demo application - `exported_weights/`: Directory containing exported PyTorch weights - `backbone/`: Backbone network weights - `bb_regressor/`: Bounding box regressor weights - `classifier/`: Classifier weights - `ltr/`: Reference Python implementation - `bin/`: Built executables ## Implementation Notes - The PrRoIPooling implementation requires CUDA and has no CPU fallback - All tensor operations are performed on CUDA devices - The tracker is optimized for GPU execution only ## Comparing Python and C++ Implementations To compare the outputs between Python and C++ implementations: 1. Run the Python implementation to generate reference outputs: ```bash python demo.py ``` 2. Run the C++ implementation: ```bash ./run_demo.sh ``` 3. Compare the output statistics in the generated files: - `bb_regressor_stats.txt` - `classifier_stats.txt` ## License This project is licensed under the MIT License - see the LICENSE file for details.