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 c0e5aa7d0a Fix ResNet BatchNorm parameter loading and enhance BN1 debugging. Corrected loading of BatchNorm running_mean, running_var, and num_batches_tracked parameters in C++ ResNet BottleneckImpl and ResNetImpl to use direct member assignment instead of named_buffers(). This resolved discrepancies with Python's BatchNorm behavior. Added detailed intermediate output saving for bn1 in both C++ ResNet and Python comparison script to facilitate debugging. Ensured Python comparison script correctly loads and compares these new ResNet intermediate tensors. This series of changes led to numerical equivalence for ResNet conv1, bn1, and subsequently layer1-4 outputs between Python and C++. 2 months ago
.idea a stable stage 2 months ago
bin Feat: Achieved perfect Conv1, good BN1/ReLU1/MaxPool similarity. README updated. 2 months ago
build Add DiMPTracker class shell and update CMakeLists 2 months ago
cimp Fix ResNet BatchNorm parameter loading and enhance BN1 debugging. Corrected loading of BatchNorm running_mean, running_var, and num_batches_tracked parameters in C++ ResNet BottleneckImpl and ResNetImpl to use direct member assignment instead of named_buffers(). This resolved discrepancies with Python's BatchNorm behavior. Added detailed intermediate output saving for bn1 in both C++ ResNet and Python comparison script to facilitate debugging. Ensured Python comparison script correctly loads and compares these new ResNet intermediate tensors. This series of changes led to numerical equivalence for ResNet conv1, bn1, and subsequently layer1-4 outputs between Python and C++. 2 months ago
cmake-build-debug Feat: Achieved perfect Conv1, good BN1/ReLU1/MaxPool similarity. README updated. 2 months ago
exported_weights Feat: Achieved perfect Conv1, good BN1/ReLU1/MaxPool similarity. README updated. 2 months ago
ltr Fix NameError in compare_models; Add ResNet BN1 debug prints; Prepare to address other modules 2 months ago
pytracking Fix NameError in compare_models; Add ResNet BN1 debug prints; Prepare to address other modules 2 months ago
test Fix ResNet BatchNorm parameter loading and enhance BN1 debugging. Corrected loading of BatchNorm running_mean, running_var, and num_batches_tracked parameters in C++ ResNet BottleneckImpl and ResNetImpl to use direct member assignment instead of named_buffers(). This resolved discrepancies with Python's BatchNorm behavior. Added detailed intermediate output saving for bn1 in both C++ ResNet and Python comparison script to facilitate debugging. Ensured Python comparison script correctly loads and compares these new ResNet intermediate tensors. This series of changes led to numerical equivalence for ResNet conv1, bn1, and subsequently layer1-4 outputs between Python and C++. 2 months 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
demo.py Intial commit 2 months 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
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.