# Watrix Gait Person Detection And Tracking Demo

This package detects and tracks people in a local video, then writes one gait sequence directory for each person track.

The detector now loads an external ONNX model file:

- Python: `python/gait_detect.onnx`
- C++: `cpp/gait_detect.onnx`
- C++ ONNX Runtime CPU dependency: `cpp/third_party/onnxruntime-linux-x64/`

The model input is BGR, 0-255, NCHW, `float32[1,3,352,640]`. Detection post-processing keeps the previous semantics: score threshold, NMS threshold, topK, coordinate restoration, NMS, and sequence tracking logic stay aligned.

## Python

```bash
cd python
python3 -m pip install -r requirements.txt
python3 run_detect_track.py /path/to/video.mp4 --output ./output
```

## C++

The C++ demo uses CPU-only ONNX Runtime. CUDA, cuDNN, and TensorRT are not required.

```bash
cd cpp
sudo apt-get install -y cmake g++ libopencv-dev
./build.sh
./build/local_video_sequence_extractor /path/to/video.mp4
```

The output directory contains:

```text
output/
  video_gait_sequences/
    video_seq000001_track000001/
      frame_000001.jpg
      frame_000003.jpg
      meta.txt
```

These sequence image directories can be used as input for the gait feature extraction API.

## Replacing The Model

To replace the detector later, replace `gait_detect.onnx` in the download directory and rebuild the zip package. Users need to download the new zip. The server API does not need a restart.
