955 B
955 B
AGENTS.md — ByteTrack Counter C++
RKNN Dynamic Shape Requirement
The RKNN model (zenai_apc_cicalengka_20260609.rknn) is exported with dynamic input shapes (model inference type: dynamic_shape). The C API requires calling rknn_set_input_shapes() before rknn_inputs_set(). Without it, librknnrt.so crashes with:
std::out_of_range: vector::_M_range_check: __n (which is 18446744073709551615) >= this->size() (which is 1)
This is called in the constructor of RKNNYOLO at src/rknn_yolo.cpp:60, right after querying input attributes:
in_attr.dims[0] = 1;
in_attr.dims[1] = imgsz_;
in_attr.dims[2] = imgsz_;
in_attr.dims[3] = 3;
in_attr.n_dims = 4;
ret = rknn_set_input_shapes(rknn_ctx_, io_num.n_input, &in_attr);
Build
cd /opt/bytetrack-counter-cpp/build
cmake .. -DHAS_RKNN=ON
make -j$(nproc)
Service
systemctl restart bytetrack-counter
journalctl -u bytetrack-counter -f