You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 
mht 92c44519b1 Refactor: Move BB regressor debug tensor comparison to model_comparison/bbreg_comparison.py; modularize test/compare_models.py 3 weeks ago
.idea a stable stage 2 months ago
backbone_pure_tensors Fix model weight paths, unify tensor loading (plain/JIT), and enable robust C++/Python comparison for all model components 3 weeks ago
bin Feat: Achieved perfect Conv1, good BN1/ReLU1/MaxPool similarity. README updated. 2 months ago
build Fix model weight paths, unify tensor loading (plain/JIT), and enable robust C++/Python comparison for all model components 3 weeks ago
cimp Fix: Use absolute backbone weights path for C++ tests; add BBRegressor debug tensor saves and logging; sync Python debug saves 3 weeks ago
cmake-build-debug Feat: Achieved perfect Conv1, good BN1/ReLU1/MaxPool similarity. README updated. 2 months ago
exported_weights Fix model weight paths, unify tensor loading (plain/JIT), and enable robust C++/Python comparison for all model components 3 weeks ago
ltr Fix: Use absolute backbone weights path for C++ tests; add BBRegressor debug tensor saves and logging; sync Python debug saves 3 weeks ago
pytracking Fix model weight paths, unify tensor loading (plain/JIT), and enable robust C++/Python comparison for all model components 3 weeks ago
test Refactor: Move BB regressor debug tensor comparison to model_comparison/bbreg_comparison.py; modularize test/compare_models.py 3 weeks ago
vcpkg@8f54ef5453 Intial commit 2 months ago
.gitignore Fix: CUDA setup, demo script errors, weight paths & .gitignore 2 months ago
CMakeLists.txt Add DiMPTracker class shell and update CMakeLists 2 months ago
README.md Feat: Achieved perfect Conv1, good BN1/ReLU1/MaxPool similarity. README updated. 2 months ago
bb_regressor_stats.txt a stable stage 2 months ago
build.sh Feat: Achieved perfect Conv1, good BN1/ReLU1/MaxPool similarity. README updated. 2 months ago
classifier_stats.txt a stable stage 2 months ago
compare_preprocessed_inputs_debug.py Fix model weight paths, unify tensor loading (plain/JIT), and enable robust C++/Python comparison for all model components 3 weeks ago
compare_resnet_outputs_debug.py Fix model weight paths, unify tensor loading (plain/JIT), and enable robust C++/Python comparison for all model components 3 weeks ago
demo.py Intial commit 2 months ago
export_and_verify_backbone_tensors.py Fix model weight paths, unify tensor loading (plain/JIT), and enable robust C++/Python comparison for all model components 3 weeks ago
export_backbone_from_python_tracker.py Fix model weight paths, unify tensor loading (plain/JIT), and enable robust C++/Python comparison for all model components 3 weeks ago
export_resnet_individual_tensors.py Feat: Achieved perfect Conv1, good BN1/ReLU1/MaxPool similarity. README updated. 2 months ago
export_resnet_raw.py Feat: Achieved perfect Conv1, good BN1/ReLU1/MaxPool similarity. README updated. 2 months ago
run_demo.sh Feat: Achieved perfect Conv1, good BN1/ReLU1/MaxPool similarity. README updated. 2 months ago
test_tensor.pt Fix model weight paths, unify tensor loading (plain/JIT), and enable robust C++/Python comparison for all model components 3 weeks ago
vcpkg-toolchain.cmake Intial commit 2 months ago
vcpkg.json Feat: Achieved perfect Conv1, good BN1/ReLU1/MaxPool similarity. README updated. 2 months ago
wget-log Feat: Achieved perfect Conv1, good BN1/ReLU1/MaxPool similarity. README updated. 2 months ago

README.md

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) - Currently targeting 1.8.0+cu111.
  • CUDA (required) - This implementation requires CUDA. The build.sh script targets CUDA 11.1 for compatibility with LibTorch 1.8.0+cu111. If CUDA 11.1 is not found at /usr/local/cuda-11.1, the script will warn and use a fallback (e.g., /usr/local/cuda-11.8 or an existing CUDA_HOME), which might lead to compilation or runtime issues if there's a significant mismatch.

Building the Project

Automatic Build

The easiest way to build the project is to use the provided build script:

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:

mkdir -p build
cd build
cmake .. -DCMAKE_BUILD_TYPE=Release
cmake --build . --config Release

Running the Demo

To run the demo application:

# 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:
python demo.py
  1. Run the C++ implementation:
./run_demo.sh
  1. 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.

C++ Implementation Details

The C++ version in the cimp/ directory aims to replicate the core components of the Python tracker.

Key C++ modules:

  • BBRegressor: Bounding Box Regressor (based on AtomIoUNet).
  • Classifier: Target Classifier (based on DiMP DIMPNet classifier part).
  • ResNet: ResNet-50 backbone for feature extraction.
  • Demo Application: A simple executable in bin/tracking_demo to test components.
  • Test Models: An executable in bin/test_models for running comparisons and tests.