### Install ByteTrack on Host Machine Source: https://github.com/foundationvision/bytetrack/blob/main/README.md Clone the repository, install dependencies, and set up ByteTrack for development. ```shell git clone https://github.com/ifzhang/ByteTrack.git cd ByteTrack pip3 install -r requirements.txt python3 setup.py develop ``` -------------------------------- ### Run BYTE Tracker Example Source: https://github.com/foundationvision/bytetrack/blob/main/tutorials/cstrack/README.md Execute the BYTE tracker example script with specified configuration and model paths. Ensure you replace 'your/data/path' with the actual path to your data. ```bash cd tracking python3 test_cstrack.py --val_mot17 True --val_hf 2 --weights ../weights/mix_mot17_half_cstrack.pt --conf_thres 0.6 --data_cfg ../src/lib/cfg/mot17_hf.json --data_dir your/data/path ``` -------------------------------- ### Install cython_bbox Source: https://github.com/foundationvision/bytetrack/blob/main/README.md Install the cython_bbox package. ```shell pip3 install cython_bbox ``` -------------------------------- ### Install Eigen Library Source: https://github.com/foundationvision/bytetrack/blob/main/deploy/TensorRT/cpp/README.md Steps to download, unzip, and install the Eigen library for C++ projects. ```shell unzip eigen-3.3.9.zip cd eigen-3.3.9 mkdir build cd build cmake .. sudo make install ``` -------------------------------- ### Include and Link Directories Setup Source: https://github.com/foundationvision/bytetrack/blob/main/deploy/TensorRT/cpp/CMakeLists.txt Specifies include and link directories for project sources, Eigen, CUDA, cuDNN, and TensorRT. Adapt paths if your installations differ. ```cmake include_directories(${PROJECT_SOURCE_DIR}/include) include_directories(/usr/local/include/eigen3) link_directories(${PROJECT_SOURCE_DIR}/include) # include and link dirs of cuda and tensorrt, you need adapt them if yours are different # cuda include_directories(/usr/local/cuda/include) link_directories(/usr/local/cuda/lib64) # cudnn include_directories(/data/cuda/cuda-10.2/cudnn/v8.0.4/include) link_directories(/data/cuda/cuda-10.2/cudnn/v8.0.4/lib64) # tensorrt include_directories(/opt/tiger/demo/TensorRT-7.2.3.4/include) link_directories(/opt/tiger/demo/TensorRT-7.2.3.4/lib) ``` -------------------------------- ### CMake Project Setup Source: https://github.com/foundationvision/bytetrack/blob/main/deploy/DeepStream/CMakeLists.txt Configures the CMake module path, minimum version, CUDA compiler, C++ standard, and library output directory. ```cmake set(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake) cmake_minimum_required(VERSION 3.16) set(CMAKE_CUDA_COMPILER /usr/local/cuda/bin/nvcc) set(CMAKE_CXX_STANDARD 14) set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_SOURCE_DIR}/lib) ``` -------------------------------- ### Configure OpenCV and Build Examples Source: https://github.com/foundationvision/bytetrack/blob/main/deploy/ncnn/cpp/CMakeLists.txt Configures OpenCV finding and builds ncnn examples if OpenCV is found or NCNN_SIMPLEOCV is enabled. It sets C++ standard and includes necessary directories. ```cmake if(NCNN_PIXEL) find_package(OpenCV QUIET COMPONENTS opencv_world) # for opencv 2.4 on ubuntu 16.04, there is no opencv_world but OpenCV_FOUND will be TRUE if("${OpenCV_LIBS}" STREQUAL "") set(OpenCV_FOUND FALSE) endif() if(NOT OpenCV_FOUND) find_package(OpenCV QUIET COMPONENTS core highgui imgproc imgcodecs videoio) endif() if(NOT OpenCV_FOUND) find_package(OpenCV QUIET COMPONENTS core highgui imgproc) endif() if(OpenCV_FOUND OR NCNN_SIMPLEOCV) if(OpenCV_FOUND) message(STATUS "OpenCV library: ${OpenCV_INSTALL_PATH}") message(STATUS " version: ${OpenCV_VERSION}") message(STATUS " libraries: ${OpenCV_LIBS}") message(STATUS " include path: ${OpenCV_INCLUDE_DIRS}") if(${OpenCV_VERSION_MAJOR} GREATER 3) set(CMAKE_CXX_STANDARD 11) endif() endif() include_directories(${CMAKE_CURRENT_SOURCE_DIR}/../src) include_directories(${CMAKE_CURRENT_BINARY_DIR}/../src) include_directories(include) include_directories(/usr/local/include/eigen3) ncnn_add_example(squeezenet) ncnn_add_example(squeezenet_c_api) ncnn_add_example(fasterrcnn) ncnn_add_example(rfcn) ncnn_add_example(yolov2) ncnn_add_example(yolov3) if(OpenCV_FOUND) ncnn_add_example(yolov4) endif() ncnn_add_example(yolov5) ncnn_add_example(yolox) ncnn_add_example(mobilenetv2ssdlite) ncnn_add_example(mobilenetssd) ncnn_add_example(squeezenetssd) ncnn_add_example(shufflenetv2) ncnn_add_example(peleenetssd_seg) ncnn_add_example(simplepose) ncnn_add_example(retinaface) ncnn_add_example(yolact) ncnn_add_example(nanodet) ncnn_add_example(scrfd) ncnn_add_example(scrfd_crowdhuman) ncnn_add_example(rvm) file(GLOB My_Source_Files src/*.cpp) add_executable(bytetrack ${My_Source_Files}) if(OpenCV_FOUND) target_include_directories(bytetrack PRIVATE ${OpenCV_INCLUDE_DIRS}) target_link_libraries(bytetrack PRIVATE ncnn ${OpenCV_LIBS}) elseif(NCNN_SIMPLEOCV) target_compile_definitions(bytetrack PUBLIC USE_NCNN_SIMPLEOCV) target_link_libraries(bytetrack PRIVATE ncnn) endif() # add test to a virtual project group set_property(TARGET bytetrack PROPERTY FOLDER "examples") else() message(WARNING "OpenCV not found and NCNN_SIMPLEOCV disabled, examples won't be built") endif() else() message(WARNING "NCNN_PIXEL not enabled, examples won't be built") endif() ``` -------------------------------- ### Install pycocotools Source: https://github.com/foundationvision/bytetrack/blob/main/README.md Install the pycocotools library, which is a dependency for some datasets. ```shell pip3 install cython; pip3 install 'git+https://github.com/cocodataset/cocoapi.git#subdirectory=PythonAPI' ``` -------------------------------- ### Run ByteTrack Docker Container Source: https://github.com/foundationvision/bytetrack/blob/main/README.md Start a Docker container with GPU support, mounting local directories for pretrained models, datasets, and output logs. This command also configures display and device access for interactive use. ```shell mkdir -p pretrained && \ mkdir -p YOLOX_outputs && \ xhost +local: && \ docker run --gpus all -it --rm \ -v $PWD/pretrained:/workspace/ByteTrack/pretrained \ -v $PWD/datasets:/workspace/ByteTrack/datasets \ -v $PWD/YOLOX_outputs:/workspace/ByteTrack/YOLOX_outputs \ -v /tmp/.X11-unix/:/tmp/.X11-unix:rw \ --device /dev/video0:/dev/video0:mwr \ --net=host \ -e XDG_RUNTIME_DIR=$XDG_RUNTIME_DIR \ -e DISPLAY=$DISPLAY \ --privileged \ bytetrack:latest ``` -------------------------------- ### Define ncnn_add_example Macro Source: https://github.com/foundationvision/bytetrack/blob/main/deploy/ncnn/cpp/CMakeLists.txt Defines a CMake macro to simplify adding ncnn example executables. It handles executable creation, OpenCV linking, and setting target properties. ```cmake macro(ncnn_add_example name) add_executable(${name} ${name}.cpp) if(OpenCV_FOUND) target_include_directories(${name} PRIVATE ${OpenCV_INCLUDE_DIRS}) target_link_libraries(${name} PRIVATE ncnn ${OpenCV_LIBS}) elseif(NCNN_SIMPLEOCV) target_compile_definitions(${name} PUBLIC USE_NCNN_SIMPLEOCV) target_link_libraries(${name} PRIVATE ncnn) endif() # add test to a virtual project group set_property(TARGET ${name} PROPERTY FOLDER "examples") endmacro() ``` -------------------------------- ### Optimize Running Speed Source: https://github.com/foundationvision/bytetrack/blob/main/deploy/ncnn/cpp/README.md Example of modifying the 'num_threads' variable in bytetrack.cpp to optimize performance based on CPU cores. ```cpp yolox.opt.num_threads = 20; ``` -------------------------------- ### Train Custom Dataset Source: https://github.com/foundationvision/bytetrack/blob/main/README.md Train ByteTrack on a custom dataset. Prepare your data in COCO format, create a custom Exp file referencing existing examples, and modify get_data_loader and get_eval_loader functions. ```shell cd python3 tools/train.py -f exps/example/mot/your_exp_file.py -d 8 -b 48 --fp16 -o -c pretrained/yolox_x.pth ``` -------------------------------- ### Modify ncnn Param File Source: https://github.com/foundationvision/bytetrack/blob/main/deploy/ncnn/cpp/README.md Example of modifying the bytetrack_s.param file to incorporate the YoloV5Focus layer, necessary for ncnn compatibility. ```text 235 268 Input images 0 1 images Split splitncnn_input0 1 4 images images_splitncnn_0 images_splitncnn_1 images_splitncnn_2 images_splitncnn_3 Crop Slice_4 1 1 images_splitncnn_3 467 -23309=1,0 -23310=1,2147483647 -23311=1,1 Crop Slice_9 1 1 467 472 -23309=1,0 -23310=1,2147483647 -23311=1,2 Crop Slice_14 1 1 images_splitncnn_2 477 -23309=1,0 -23310=1,2147483647 -23311=1,1 Crop Slice_19 1 1 477 482 -23309=1,1 -23310=1,2147483647 -23311=1,2 Crop Slice_24 1 1 images_splitncnn_1 487 -23309=1,1 -23310=1,2147483647 -23311=1,1 Crop Slice_29 1 1 487 492 -23309=1,0 -23310=1,2147483647 -23311=1,2 Crop Slice_34 1 1 images_splitncnn_0 497 -23309=1,1 -23310=1,2147483647 -23311=1,1 Crop Slice_39 1 1 497 502 -23309=1,1 -23310=1,2147483647 -23311=1,2 Concat Concat_40 4 1 472 492 482 502 503 0=0 ... ``` ```text 226 328 Input images 0 1 images YoloV5Focus focus 1 1 images 503 ... ``` -------------------------------- ### Run ByteTrack Demo Source: https://github.com/foundationvision/bytetrack/blob/main/deploy/ncnn/cpp/README.md Command to execute the ByteTrack C++ demo with a video file. ```shell ./bytetrack palace.mp4 ``` -------------------------------- ### Build ByteTrack C++ Project Source: https://github.com/foundationvision/bytetrack/blob/main/deploy/ncnn/cpp/README.md Steps to copy necessary files into the ncnn/examples directory and build the ByteTrack C++ executable. ```shell cd ncnn/build/examples cmake .. make ``` -------------------------------- ### Run ByteTrack Demo Source: https://github.com/foundationvision/bytetrack/blob/main/README.md Execute the ByteTrack demo script to perform tracking on a video. This command requires specifying the experiment configuration, checkpoint, and optional arguments like FP16 and fuse. ```shell cd python3 tools/demo_track.py video -f exps/example/mot/yolox_x_mix_det.py -c pretrained/bytetrack_x_mot17.pth.tar --fp16 --fuse --save_result ``` -------------------------------- ### Run ByteTrack-TensorRT C++ Demo Source: https://github.com/foundationvision/bytetrack/blob/main/deploy/TensorRT/cpp/README.md Execute the compiled ByteTrack-TensorRT C++ demo with a specified engine file and input video. ```shell ./bytetrack ../../../../YOLOX_outputs/yolox_s_mix_det/model_trt.engine -i ../../../../videos/palace.mp4 ``` -------------------------------- ### Run QDTrack with ReID Motion Source: https://github.com/foundationvision/bytetrack/blob/main/tutorials/qdtrack/README.md Execute the QDTrack ReID motion tracker using a specified configuration and pre-trained model. Ensure the distributed training environment is set up correctly. ```bash python3 -m torch.distributed.launch --nproc_per_node=8 --master_port=29501 tools/test.py configs/mot17/qdtrack-frcnn_r50_fpn_4e_mot17.py work_dirs/mot17_half_qdtrack.pth --launcher pytorch --eval track --eval-options resfile_path=output ``` -------------------------------- ### Build ByteTrack-TensorRT C++ Demo Source: https://github.com/foundationvision/bytetrack/blob/main/deploy/TensorRT/cpp/README.md Commands to build the ByteTrack-TensorRT C++ demo after setting up paths in CMakeLists.txt. ```shell cd /deploy/TensorRT/cpp mkdir build cd build cmake .. make ``` -------------------------------- ### Run ONNX Runtime Demo Source: https://github.com/foundationvision/bytetrack/blob/main/deploy/ONNXRuntime/README.md Executes the ONNX Runtime inference demo. This command should be run from the ONNXRuntime deployment directory within ByteTrack. The demo is capable of achieving approximately 16 FPS on a specified CPU configuration. ```shell cd /deploy/ONNXRuntime python3 onnx_inference.py ``` -------------------------------- ### Build ByteTrack Docker Image Source: https://github.com/foundationvision/bytetrack/blob/main/README.md Build a Docker image tagged as 'bytetrack:latest' from the current directory. ```shell docker build -t bytetrack:latest . ``` -------------------------------- ### Run TensorRT ByteTrack Demo Source: https://github.com/foundationvision/bytetrack/blob/main/deploy/TensorRT/python/README.md Executes a TensorRT-accelerated demo for ByteTrack object tracking using a pre-converted TensorRT model. This command enables TensorRT acceleration for higher FPS. ```shell cd python3 tools/demo_track.py video -f exps/example/mot/yolox_s_mix_det.py --trt --save_result ``` -------------------------------- ### Convert Input Video for TensorRT C++ Demo Source: https://github.com/foundationvision/bytetrack/blob/main/deploy/TensorRT/cpp/README.md Utility command to convert input videos to a format compatible with the TensorRT C++ demo if frame loss occurs. ```shell cd python3 tools/convert_video.py ``` -------------------------------- ### Configure Input Dimensions Source: https://github.com/foundationvision/bytetrack/blob/main/deploy/TensorRT/cpp/README.md Set the input width and height for the ByteTrack model in C++ source code. ```c++ static const int INPUT_W = 1088; static const int INPUT_H = 608; ``` -------------------------------- ### Run ByteTrack on MOT20 Test Set Source: https://github.com/foundationvision/bytetrack/blob/main/README.md Execute ByteTrack for testing on the MOT20 dataset with specific parameters for matching threshold and MOT20 mode. The input size should be adjusted in the configuration file as noted. ```shell cd python3 tools/track.py -f exps/example/mot/yolox_x_mix_mot20_ch.py -c pretrained/bytetrack_x_mot20.pth.tar -b 1 -d 1 --fp16 --fuse --match_thresh 0.7 --mot20 python3 tools/interpolation.py ``` -------------------------------- ### Finding Packages Source: https://github.com/foundationvision/bytetrack/blob/main/deploy/DeepStream/CMakeLists.txt Locates necessary packages like GLib and OpenCV for the project. ```cmake find_package(GLib) find_package(OpenCV) ``` -------------------------------- ### Mix Datasets for Training and Testing Source: https://github.com/foundationvision/bytetrack/blob/main/README.md Prepare data for training and testing by mixing different datasets. This involves running specific mix scripts after datasets have been converted to COCO format. ```shell cd python3 tools/mix_data_ablation.py python3 tools/mix_data_test_mot17.py python3 tools/mix_data_test_mot20.py ``` -------------------------------- ### Include Directories Source: https://github.com/foundationvision/bytetrack/blob/main/deploy/DeepStream/CMakeLists.txt Adds include paths for GLib, OpenCV, DeepStream, and project-specific headers. ```cmake include_directories(${GLIB2_INCLUDE_DIR}) include_directories(${OpenCV_INCLUDE_DIRS}) include_directories(${DS_INCLUDES_DIR}) include_directories(${CMAKE_SOURCE_DIR}/includes) ``` -------------------------------- ### Run BYTE Tracker with FairMOT Source: https://github.com/foundationvision/bytetrack/blob/main/tutorials/fairmot/README.md Execute the BYTE tracker script for MOT tasks. This configuration uses a match threshold of 0.8 and specifies the model path. ```python python3 track_half.py mot --load_model ../exp/mot/mot17_half_dla34/model_last.pth --match_thres 0.8 ``` -------------------------------- ### Run JDE Tracker Source: https://github.com/foundationvision/bytetrack/blob/main/tutorials/jde/README.md Execute the JDE tracking script with specified configuration and model weights. Ensure the model file is placed in the correct directory. ```bash python3 track_half.py --cfg ./cfg/yolov3_1088x608.cfg --weights weights/mix_mot17_half_jde.pt ``` -------------------------------- ### Basic CMake Configuration Source: https://github.com/foundationvision/bytetrack/blob/main/deploy/TensorRT/cpp/CMakeLists.txt Sets the minimum CMake version, project name, and C++ standard. It also configures build type and enables CUDA usage. ```cmake cmake_minimum_required(VERSION 2.6) project(bytetrack) add_definitions(-std=c++11) option(CUDA_USE_STATIC_CUDA_RUNTIME OFF) set(CMAKE_CXX_STANDARD 11) set(CMAKE_BUILD_TYPE Debug) find_package(CUDA REQUIRED) ``` -------------------------------- ### Run TransTrack Source: https://github.com/foundationvision/bytetrack/blob/main/tutorials/transtrack/README.md Execute the TransTrack script with specified parameters for tracking. ```bash python3 main_track.py --output_dir . --dataset_file mot --coco_path mot --batch_size 1 --resume pretrained/671mot17_crowdhuman_mot17.pth --eval --with_box_refine --num_queries 500 ``` -------------------------------- ### DeepStream Configuration for ByteTracker Source: https://github.com/foundationvision/bytetrack/blob/main/deploy/DeepStream/README.md Configuration snippet for deepstream_app_config.txt to enable and specify the ByteTracker library. Ensure the ll-lib-file path is correct. ```ini [tracker] enable=1 tracker-width=640 tracker-height=384 gpu-id=0 ll-lib-file=//opt/nvidia/deepstream/deepstream/lib/libByteTracker.so enable-batch-process=1 ``` -------------------------------- ### Executable Definition and Linking Source: https://github.com/foundationvision/bytetrack/blob/main/deploy/TensorRT/cpp/CMakeLists.txt Finds all C++ source files in the 'src' directory and creates the 'bytetrack' executable. Links necessary libraries including TensorRT, CUDA runtime, and OpenCV. ```cmake file(GLOB My_Source_Files ${PROJECT_SOURCE_DIR}/src/*.cpp) add_executable(bytetrack ${My_Source_Files}) target_link_libraries(bytetrack nvinfer) target_link_libraries(bytetrack cudart) target_link_libraries(bytetrack ${OpenCV_LIBS}) ``` -------------------------------- ### Build ByteTracker Library Source: https://github.com/foundationvision/bytetrack/blob/main/deploy/DeepStream/README.md Commands to build the ByteTracker C++ library. This creates a shared object file that can be used with DeepStream. ```bash $mkdir build && cd build $cmake .. $make ByteTracker ``` -------------------------------- ### Train CTracker Model Source: https://github.com/foundationvision/bytetrack/blob/main/tutorials/ctracker/README.md Run this command to train the CTracker model. Ensure the dataset is prepared and the generate_half_csv.py script has been executed. ```bash python3 train.py --root_path MOT17 --csv_train train_half_annots.csv --model_dir ctracker/ --depth 50 --epochs 50 ``` -------------------------------- ### Train MOTR Model Source: https://github.com/foundationvision/bytetrack/blob/main/tutorials/motr/README.md Command to initiate the training process for the MOTR model using distributed PyTorch. Ensure all specified paths and pretrained models are correctly set up. ```bash python3 -m torch.distributed.launch --nproc_per_node=8 \ --use_env main.py \ --meta_arch motr \ --dataset_file e2e_joint \ --epoch 50 \ --with_box_refine \ --lr_drop 40 \ --lr 2e-4 \ --lr_backbone 2e-5 \ --pretrained coco_model_final.pth \ --output_dir exps/e2e_motr_r50_mot17trainhalf \ --batch_size 1 \ --sample_mode 'random_interval' \ --sample_interval 10 \ --sampler_steps 10 20 30 \ --sampler_lengths 2 3 4 5 \ --update_query_pos \ --merger_dropout 0 \ --dropout 0 \ --random_drop 0.1 \ --fp_ratio 0.3 \ --query_interaction_layer 'QIM' \ --extra_track_attn \ --mot_path . --data_txt_path_train ./datasets/data_path/mot17.half \ --data_txt_path_val ./datasets/data_path/mot17.val \ ``` -------------------------------- ### Test CTracker_BYTE Model Source: https://github.com/foundationvision/bytetrack/blob/main/tutorials/ctracker/README.md Run this command to test the CTracker_BYTE model. This requires adding mot_online and byte_tracker.py to the CTracker repository, and using the test_byte.py script. ```bash python3 test_byte.py --dataset_path MOT17 --model_dir ctracker --model_path ctracker/mot17_half_ctracker.pt ``` -------------------------------- ### Run ByteTrack on MOT17 Validation Set Source: https://github.com/foundationvision/bytetrack/blob/main/README.md Execute the ByteTrack algorithm for evaluation on the MOT17 validation set. Ensure you are in the ByteTrack home directory and have the necessary configuration and model files. ```shell cd python3 tools/track.py -f exps/example/mot/yolox_x_ablation.py -c pretrained/bytetrack_ablation.pth.tar -b 1 -d 1 --fp16 --fuse ``` -------------------------------- ### Run ByteTrack on MOT17 Test Set Source: https://github.com/foundationvision/bytetrack/blob/main/README.md Execute ByteTrack for testing on the MOT17 dataset. This command also includes running an interpolation script, likely for post-processing results before submission. ```shell cd python3 tools/track.py -f exps/example/mot/yolox_x_mix_det.py -c pretrained/bytetrack_x_mot17.pth.tar -b 1 -d 1 --fp16 --fuse python3 tools/interpolation.py ``` -------------------------------- ### Run TraDeS_BYTE Tracking Source: https://github.com/foundationvision/bytetrack/blob/main/tutorials/trades/README.md Execute the TraDeS_BYTE tracking script with specified parameters. This version uses byte_tracker.py for motion tracking with a Kalman filter. ```bash python3 test.py tracking --exp_id mot17_half --dataset mot --dataset_version 17halfval --pre_hm --ltrb_amodal --inference --load_model ../models/mot_half.pth --gpus 0 --clip_len 3 --trades --track_thresh 0.4 --new_thresh 0.5 --out_thresh 0.1 --pre_thresh 0.5 ``` -------------------------------- ### Additional Build Definitions Source: https://github.com/foundationvision/bytetrack/blob/main/deploy/TensorRT/cpp/CMakeLists.txt Applies additional build definitions for optimization and threading. ```cmake add_definitions(-O2 -pthread) ``` -------------------------------- ### Run TraDeS Tracking Source: https://github.com/foundationvision/bytetrack/blob/main/tutorials/trades/README.md Execute the TraDeS tracking script with specified parameters. Ensure the model and dataset paths are correct. ```bash python3 test.py tracking --exp_id mot17_half --dataset mot --dataset_version 17halfval --pre_hm --ltrb_amodal --inference --load_model ../models/mot_half.pth --gpus 0 --clip_len 3 --trades --track_thresh 0.4 --new_thresh 0.4 --out_thresh 0.2 --pre_thresh 0.5 ``` -------------------------------- ### Test CTracker Model Source: https://github.com/foundationvision/bytetrack/blob/main/tutorials/ctracker/README.md Execute this command to test the trained CTracker model. Make sure to replace the test.py script with the one from the CTracker repository. ```bash python3 test.py --dataset_path MOT17 --model_dir ctracker --model_path ctracker/mot17_half_ctracker.pt ``` -------------------------------- ### Generate ncnn Param and Bin Files Source: https://github.com/foundationvision/bytetrack/blob/main/deploy/ncnn/cpp/README.md Convert the generated ONNX file into ncnn's param and bin formats using the onnx2ncnn tool. ```shell cd ncnn/build/tools/onnx ./onnx2ncnn bytetrack_s.onnx bytetrack_s.param bytetrack_s.bin ``` -------------------------------- ### Run Other Trackers on MOT17 Validation Set Source: https://github.com/foundationvision/bytetrack/blob/main/README.md Compare ByteTrack performance by running SORT, DeepSORT, and MOTDT trackers. These commands use the same configuration and model as the ByteTrack run. ```shell python3 tools/track_sort.py -f exps/example/mot/yolox_x_ablation.py -c pretrained/bytetrack_ablation.pth.tar -b 1 -d 1 --fp16 --fuse ``` ```shell python3 tools/track_deepsort.py -f exps/example/mot/yolox_x_ablation.py -c pretrained/bytetrack_ablation.pth.tar -b 1 -d 1 --fp16 --fuse ``` ```shell python3 tools/track_motdt.py -f exps/example/mot/yolox_x_ablation.py -c pretrained/bytetrack_ablation.pth.tar -b 1 -d 1 --fp16 --fuse ``` -------------------------------- ### Convert PyTorch Model to ONNX Source: https://github.com/foundationvision/bytetrack/blob/main/deploy/ONNXRuntime/README.md Converts a PyTorch model to ONNX format using the provided export script. Ensure you are in the ByteTrack home directory and specify the output name, configuration file, and pre-trained weights. ```shell cd python3 tools/export_onnx.py --output-name bytetrack_s.onnx -f exps/example/mot/yolox_s_mix_det.py -c pretrained/bytetrack_s_mot17.pth.tar ``` -------------------------------- ### Optimize ncnn Model Source: https://github.com/foundationvision/bytetrack/blob/main/deploy/ncnn/cpp/README.md Use ncnnoptimize to optimize the param and bin files for better performance. ```shell ../ncnnoptimize bytetrack_s.param bytetrack_s.bin bytetrack_s_op.param bytetrack_s_op.bin 65536 ``` -------------------------------- ### Train MOT20 Test Model Source: https://github.com/foundationvision/bytetrack/blob/main/README.md Train the MOT20 test model using MOT20 train and CrowdHuman datasets. This command requires clipping bounding boxes within the image, with modifications suggested in provided file lines. ```shell cd python3 tools/train.py -f exps/example/mot/yolox_x_mix_mot20_ch.py -d 8 -b 48 --fp16 -o -c pretrained/yolox_x.pth ``` -------------------------------- ### Replace CSTrack File Source: https://github.com/foundationvision/bytetrack/blob/main/tutorials/cstrack/README.md Replace the existing cstrack.py file with the one from the specified GitHub URL. ```bash replace https://github.com/JudasDie/SOTS/blob/master/lib/tracker/cstrack.py ``` -------------------------------- ### Integrate BYTETracker with Other Detectors Source: https://github.com/foundationvision/bytetrack/blob/main/README.md Pass detection results from other detectors to BYTETracker for tracking. Ensure detection results are formatted correctly for the tracker. ```python from yolox.tracker.byte_tracker import BYTETracker tracker = BYTETracker(args) for image in images: dets = detector(image) online_targets = tracker.update(dets, info_imgs, img_size) ``` -------------------------------- ### Run CenterTrack Tracking Test Source: https://github.com/foundationvision/bytetrack/blob/main/tutorials/centertrack/README.md Execute the tracking test script for CenterTrack with specified experiment parameters and model. ```bash python3 test.py tracking --exp_id mot17_half --dataset mot --dataset_version 17halfval --pre_hm --ltrb_amodal --load_model ../models/mot17_half.pth --track_thresh 0.4 --new_thresh 0.5 --out_thresh 0.2 --pre_thresh 0.5 ``` -------------------------------- ### Generate ONNX File Source: https://github.com/foundationvision/bytetrack/blob/main/deploy/ncnn/cpp/README.md Command to generate the ONNX file from a PyTorch model checkpoint using the provided export script. ```shell cd python3 tools/export_onnx.py -f exps/example/mot/yolox_s_mix_det.py -c pretrained/bytetrack_s_mot17.pth.tar ``` -------------------------------- ### Convert ETHZ to COCO Format Source: https://github.com/foundationvision/bytetrack/blob/main/README.md Convert the ETHZ dataset to COCO format using the provided script. Ensure you are in the ByteTrack home directory. ```shell cd python3 tools/convert_ethz_to_coco.py ``` -------------------------------- ### Source File Globbing Source: https://github.com/foundationvision/bytetrack/blob/main/deploy/DeepStream/CMakeLists.txt Collects all .cpp files from the src directory for compilation. ```cmake file(GLOB TRACK ${CMAKE_SOURCE_DIR}/src/*.cpp) ``` -------------------------------- ### Clone SOTS Repository Source: https://github.com/foundationvision/bytetrack/blob/main/tutorials/cstrack/README.md Clone the SOTS repository from GitHub, specifically checking out the MOT branch. ```bash git clone -b MOT https://github.com/JudasDie/SOTS.git ``` -------------------------------- ### Convert PyTorch Model to TensorRT Source: https://github.com/foundationvision/bytetrack/blob/main/deploy/TensorRT/python/README.md Converts a PyTorch ByteTrack model to a TensorRT-compatible format. Ensure you are in the ByteTrack home directory and have the necessary configuration and model files. ```shell cd python3 tools/trt.py -f exps/example/mot/yolox_s_mix_det.py -c pretrained/bytetrack_s_mot17.pth.tar ``` -------------------------------- ### Clone CenterTrack Repository Source: https://github.com/foundationvision/bytetrack/blob/main/tutorials/centertrack/README.md Use git to clone the CenterTrack repository from GitHub. ```bash git clone https://github.com/xingyizhou/CenterTrack.git ``` -------------------------------- ### Compiler Flags and OpenCV Integration Source: https://github.com/foundationvision/bytetrack/blob/main/deploy/TensorRT/cpp/CMakeLists.txt Sets C++ compiler flags for optimization and error handling, and finds the OpenCV package, including its include directories. ```cmake set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -Wall -Ofast -Wfatal-errors -D_MWAITXINTRIN_H_INCLUDED") find_package(OpenCV) include_directories(${OpenCV_INCLUDE_DIRS}) ``` -------------------------------- ### Convert MOT20 to COCO Format Source: https://github.com/foundationvision/bytetrack/blob/main/README.md Convert the MOT20 dataset to COCO format using the provided script. Ensure you are in the ByteTrack home directory. ```shell cd python3 tools/convert_mot20_to_coco.py ``` -------------------------------- ### Library Linking Source: https://github.com/foundationvision/bytetrack/blob/main/deploy/DeepStream/CMakeLists.txt Specifies the directory for linking libraries and adds the ByteTracker shared library, linking it with nvds_meta. ```cmake link_directories(${DS_LIBS_DIR}) add_library(ByteTracker SHARED ${TRACK}) target_link_libraries(ByteTracker nvds_meta) ``` -------------------------------- ### Train Ablation Model (MOT17 half train and CrowdHuman) Source: https://github.com/foundationvision/bytetrack/blob/main/README.md Use this command to train an ablation model using MOT17 half training data and CrowdHuman dataset. Ensure you have downloaded the COCO pretrained YOLOX model. ```shell cd python3 tools/train.py -f exps/example/mot/yolox_x_ablation.py -d 8 -b 48 --fp16 -o -c pretrained/yolox_x.pth ``` -------------------------------- ### Evaluate CTracker Model Source: https://github.com/foundationvision/bytetrack/blob/main/tutorials/ctracker/README.md Use this command to evaluate the CTracker model's performance on the MOT challenge. Ensure eval_motchallenge.py is added to the repository and ground truth files are prepared. ```bash python3 eval_motchallenge.py --groundtruths MOT17/train --tests ctracker/results --gt_type half_val --eval_official --score_threshold -1 ``` -------------------------------- ### DeepStream and Library Paths Source: https://github.com/foundationvision/bytetrack/blob/main/deploy/DeepStream/CMakeLists.txt Defines the root directory for DeepStream and specifies paths for its libraries and includes. ```cmake set(DS_ROOT_DIR /opt/nvidia/deepstream/deepstream) set(DS_LIBS_DIR ${DS_ROOT_DIR}/lib) set(DS_INCLUDES_DIR ${DS_ROOT_DIR}/sources/includes) ``` -------------------------------- ### Convert Cityperson to COCO Format Source: https://github.com/foundationvision/bytetrack/blob/main/README.md Convert the Cityperson dataset to COCO format using the provided script. Ensure you are in the ByteTrack home directory. ```shell cd python3 tools/convert_cityperson_to_coco.py ``` -------------------------------- ### Train MOT17 Test Model Source: https://github.com/foundationvision/bytetrack/blob/main/README.md Command for training the MOT17 test model, incorporating MOT17 training data, CrowdHuman, Cityperson, and ETHZ datasets. Requires COCO pretrained YOLOX model. ```shell cd python3 tools/train.py -f exps/example/mot/yolox_x_mix_det.py -d 8 -b 48 --fp16 -o -c pretrained/yolox_x.pth ``` -------------------------------- ### Convert MOT17 to COCO Format Source: https://github.com/foundationvision/bytetrack/blob/main/README.md Convert the MOT17 dataset to COCO format using the provided script. Ensure you are in the ByteTrack home directory. ```shell cd python3 tools/convert_mot17_to_coco.py ``` -------------------------------- ### Evaluate MOTR Model Source: https://github.com/foundationvision/bytetrack/blob/main/tutorials/motr/README.md Command to run the evaluation script for the MOTR model. This command is used after training to assess the model's performance on a validation set. Ensure the pretrained model path is correct. ```bash python3 eval.py \ --meta_arch motr \ --dataset_file e2e_joint \ --epoch 200 \ --with_box_refine \ --lr_drop 100 \ --lr 2e-4 \ --lr_backbone 2e-5 \ --pretrained exps/e2e_motr_r50_mot17val/motr_final.pth \ --output_dir exps/e2e_motr_r50_mot17val \ --batch_size 1 \ --sample_mode 'random_interval' \ --sample_interval 10 \ --sampler_steps 50 90 120 \ --sampler_lengths 2 3 4 5 \ --update_query_pos \ --merger_dropout 0 \ --dropout 0 \ --random_drop 0.1 \ --fp_ratio 0.3 \ --query_interaction_layer 'QIM' \ --extra_track_attn \ --mot_path ./MOT17/images/train --data_txt_path_train ./datasets/data_path/mot17.half \ --data_txt_path_val ./datasets/data_path/mot17.val \ --resume model_final.pth \ ``` -------------------------------- ### Convert CrowdHuman to COCO Format Source: https://github.com/foundationvision/bytetrack/blob/main/README.md Convert the CrowdHuman dataset to COCO format using the provided script. Ensure you are in the ByteTrack home directory. ```shell cd python3 tools/convert_crowdhuman_to_coco.py ``` -------------------------------- ### Compiler Flags Source: https://github.com/foundationvision/bytetrack/blob/main/deploy/DeepStream/CMakeLists.txt Sets C++ and CUDA compiler flags, including position-independent code generation. ```cmake set(CMAKE_CXX_FLAGS "-Wall -Wextra -fPIC") set(CMAKE_CUDA_FLAGS "--compiler-options -fPIC") ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.