SimpleTrack Documentation

repository·main·Indexed 18 days ago

https://github.com/tusen-ai/simpletrack

A 3D Multi-Object Tracking (MOT) library implemented as the mot_3d library, designed for efficiency and simplicity. It provides tools to process object detections and generate consistent 3D tracks, with specific optimizations and preprocessing pipelines for the Waymo Open Dataset and nuScenes. The library features the MOTModel API, support for Kalman filter motion models, and configurable association metrics including IoU and Generalized IoU (GIoU).

Tokens
4.6K
Snippets
16
Records
22
Agent score
63%

What's inside SimpleTrack

  1. Understand the SimpleTrack output format

    main
    In the directory ${nuscenes_result_dir}/SimpleTrack/summary/, results are organized into sub-folders corresponding to each nuScenes object type. Inside each sub-folder, there are 150 .npz files (one for each sequence in the nuScenes validation set). For the specific schema of these .npz files, refer to the Output Format documentation.
  2. Preprocess nuScenes raw data

    main

    To extract data from nuScenes, use the nuscenes_preprocess.sh script. This script supports two extraction modes:

    1. 2Hz mode: Extracts only key frames to the specified data_dir_2hz.
    2. 20Hz mode: Extracts all data to the specified data_dir_20hz.

    Arguments:

    • ${raw_data_dir}: The directory containing the raw nuScenes data.
    • ${data_dir_2hz}: Target directory for 2Hz (key frame) data.
    • ${data_dir_20hz}: Target directory for 20Hz (all data) extraction.
    cd preprocessing/nuscenes_data
    bash nuscenes_preprocess.sh ${raw_data_dir} ${data_dir_2hz} ${data_dir_20hz}
  3. Decode Waymo Open Dataset ground truth information

    main

    To decode ground truth information from a Waymo .bin file, use gt_bin_decode.py. Note that you must provide your own .bin file downloaded from the Waymo Open Dataset due to licensing restrictions.

    Arguments:

    • --data_folder: The target location for the preprocessed data.
    • --file_path: The path to the ground truth .bin file.

    Processed ground truth is stored in ${data_folder}/detection/gt/dets/.

    cd preprocessing/waymo_data
    python gt_bin_decode.py --data_folder ${data_dir} --file_path ${bin_path}
  4. Run nuScenes inference at 2Hz (Key Frames)

    main

    To perform inference only on key frames (2Hz), use tools/main_nuscenes.py. Results are saved in ${nuscenes_result_dir}/SimpleTrack2Hz/summary, organized into subfolders by object type.

    Note: It is critical to use the provided configuration files (e.g., configs/nu_configs/giou.yaml) for correct results.

    python tools/main_nuscenes.py \
        --name SimpleTrack2Hz \
        --det_name ${det_name} \
        --config_path configs/nu_configs/giou.yaml \
        --result_folder ${nuscenes_result_dir} \
        --data_folder ${nuscenes2hz_data_dir} \
        --process ${proc_num}
  5. Convert SimpleTrack results to official nuScenes JSON format

    main

    To convert the internal .npz tracking results into the official nuScenes .json format, you must run a two-step process: first create the results, then merge the object types. The final .json files will be located in the results subfolder of your specified result directory.

    # For 2Hz (Key Frames) settings
    python tools/nuscenes_result_creation.py \
        --name SimpleTrack2Hz \
        --result_folder ${nuscenes_result_dir} \
        --data_folder ${nuscenes2hz_data_dir}
    
    python tools/nuscenes_type_merge.py \
        --name SimpleTrack2Hz \
        --result_folder ${nuscenes_result_dir}
    
    # For 10Hz settings
    python tools/nuscenes_result_creation_10hz.py \
        --name SimpleTrack10Hz \
        --result_folder ${nuscenes_result_dir} \
        --data_folder ${nuscenes20hz_data_dir}
    
    python tools/nuscenes_type_merge.py \
        --name SimpleTrack10Hz \
        --result_folder ${nuscenes_result_dir}
  6. Preprocess nuScenes detection files

    main

    To convert nuScenes JSON format detection files into .npz files for 3D MOT, use detection.py. You must specify the mode (2hz or 20hz) corresponding to your data extraction.

    Arguments:

    • --raw_data_folder: The directory containing the original nuScenes raw data.
    • --data_folder: The target directory for processed data (matches the mode used during raw preprocessing).
    • --det_name: A unique name for your detection set.
    • --file_path: The path to the JSON detection file.
    • --mode: Either 2hz or 20hz.
    • --velo: (Optional) Include this flag if you want to save velocity data contained in the detection file.
    cd preprocessing/nuscenes_data
    
    # for 2Hz detection file
    python detection.py --raw_data_folder ${raw_data_dir} --data_folder ${data_dir_2hz} --det_name ${name} --file_path ${file_path} --mode 2hz --velo
    
    # for 20Hz detection file
    python detection.py --raw_data_folder ${raw_data_dir} --data_folder ${data_dir_20hz} --det_name ${name} --file_path ${file_path} --mode 20hz --velo
  7. Configure SimpleTrack via YAML files

    main

    SimpleTrack behaviors are specified using a single .yaml configuration file. These files are typically located in the ./configs/ directory. You can define data preprocessing, association metrics, motion models, and association stages within this file to control the tracker's behavior.

    # Example structure of a SimpleTrack config
    running:
      score_threshold: 0.7
      asso: giou
    redundancy:
      mode: mm
    data_loader:
      nms: true
  8. Convert SimpleTrack results to Waymo .bin format

    main

    To use the official Waymo Open Dataset evaluation tools, convert the SimpleTrack .npz results into the official .bin format using tools/waymo_pred_bin.py.

    After execution, the converted files will be located in ${waymo_result_dir}/SimpleTrack/bin/ as follows:

    • prd.bin: All objects combined.
    • vehicle/pred.bin: Vehicles only.
    • pedestrian/pred.bin: Pedestrians only.
    • cyclist/pred.bin: Cyclists only.
    python tools/waymo_pred_bin.py \
        --name SimpleTrack \
        --result_folder ${waymo_result_dir} \
        --data_folder ${waymo_data_dir}
  9. Run nuScenes inference at 10Hz

    main

    To perform inference using the 10Hz settings proposed in the paper, use tools/main_nuscenes_10hz.py. Results are saved in ${nuscenes_result_dir}/SimpleTrack20Hz/summary.

    In experiments, a --process value of 150 is recommended, matching the number of sequences in the nuScenes validation set.

    python tools/main_nuscenes_10hz.py \
        --name SimpleTrack10Hz \
        --det_name ${det_name} \
        --config_path configs/nu_configs/giou.yaml \
        --result_folder ${nuscenes_result_dir} \
        --data_folder ${nuscenes20hz_data_dir} \
        --process ${proc_num}