YoloX-Tracking-ncnn-RPi_64-bit
YoloX-Tracking-ncnn-RPi_64-bit copied to clipboard
YoloX with tracking for a bare Raspberry Pi 4 using ncnn.
YoloX with Tracking
https://user-images.githubusercontent.com/44409029/177163299-4a73e807-605e-4fb1-ad79-b00e15786784.mp4
YoloX with Byte Tracking for the ncnn framework.
The model tries to keep track of the individual objects found in the scenes. The example video follows the walkers as they stroll along. Obvious, not a simple task. Not only does the detection needs to be at a robust level. You also have to solve occlusion as the walkers pass each other.
Due to the excellent recognition, the best tracker in the set.
Paper: https://arxiv.org/pdf/2110.06864v2.pdf
Special made for a bare Raspberry Pi 4, see Q-engineering deep learning examples
Benchmark.
| Model | size | objects | mAP | RPi 4 64-OS 1950 MHz |
|---|---|---|---|---|
| Tensorflow lite | 300x300 | 80 | 21.0 | 24.6 FPS |
| NanoDet | 320x320 | 80 | 20.6 | 11.8 FPS |
| YoloX | 416x416 | 80 | 25.8 | 7.2 FPS |
Dependencies.
To run the application, you have to:
- A raspberry Pi 4 with a 64-bit operating system. It can be the Raspberry 64-bit OS, or Ubuntu 18.04 / 20.04. Install 64-bit OS
- The Tencent ncnn framework installed. Install ncnn
- OpenCV 64 bit installed. Install OpenCV 4.5
- Code::Blocks installed. (
$ sudo apt-get install codeblocks)
Installing the app.
To extract and run the network in Code::Blocks
$ mkdir MyDir
$ cd MyDir
$ wget https://github.com/Qengineering/YoloX-Tracking-ncnn-RPi_64-bit/archive/refs/heads/main.zip
$ unzip -j master.zip
Remove master.zip, LICENSE and README.md as they are no longer needed.
$ rm master.zip
$ rm LICENSE
$ rm README.md
Your MyDir folder must now look like this:
├── include
│ ├── BYTETracker.h
│ ├── dataType.h
│ ├── kalmanFilter.h
│ ├── lapjv.h
│ └── STrack.h
├── palace.mp4
├── src
│ ├── BYTETracker.cpp
│ ├── kalmanFilter.cpp
│ ├── lapjv.cpp
│ ├── STrack.cpp
│ ├── utils.cpp
│ └── yoloX.cpp
├── tree.txt
├── Walkers.mp4
├── YoloX_Byte_Track.cbp
├── yoloxN.bin
└── yoloxN.param
Install Eigen.
Install eigen-3.3.9 google or baidu(code:ueq4) (if not done earlier by Tensorflow Lite).
unzip eigen-3.3.9.zip
cd eigen-3.3.9
mkdir build
cd build
cmake ..
sudo make install
Running the app.
To run the application load the project file YoloX_Byte_Track.cbp in Code::Blocks. More info or
if you want to connect a camera to the app, follow the instructions at Hands-On.
Many thanks to nihui and ifzhang
CMake.
Instead of Code::Blocks, you can also use CMake to build the application.
Please follow the next instructions. Assuming your in the 'main' directory.
.
├── bin
├── build
├── CMakeLists.txt
├── include
├── obj
├── palace.mp4
├── src
├── tree.txt
├── Walkers.mp4
├── YoloX_Byte_Track.cbp
├── YoloX_Byte_Track.depend
├── YoloX_Byte_Track.layout
├── yoloxN.bin
└── yoloxN.param
Create a build folder
$ mkdir build
$ cd build
Run CMake and Make
$ cmake ..
-- The C compiler identification is GNU 8.3.0
-- The CXX compiler identification is GNU 8.3.0
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Found OpenCV: /usr/local (found version "4.5.1")
-- Configuring done
-- Generating done
-- Build files have been written to: /home/pi/software/YoloX ByteTrack/build
$ make -j4
Scanning dependencies of target YoloX_Track
[ 28%] Building CXX object CMakeFiles/YoloX_Track.dir/src/BYTETracker.cpp.o
[ 28%] Building CXX object CMakeFiles/YoloX_Track.dir/src/STrack.cpp.o
[ 57%] Building CXX object CMakeFiles/YoloX_Track.dir/src/kalmanFilter.cpp.o
[ 57%] Building CXX object CMakeFiles/YoloX_Track.dir/src/lapjv.cpp.o
[ 71%] Building CXX object CMakeFiles/YoloX_Track.dir/src/utils.cpp.o
[ 85%] Building CXX object CMakeFiles/YoloX_Track.dir/src/yoloX.cpp.o
[100%] Linking CXX executable ../YoloX_Track
[100%] Built target YoloX_Track
$ cd ..
$ tree -L 1
.
├── bin
├── build
├── CMakeLists.txt
├── include
├── obj
├── palace.mp4
├── src
├── tree.txt
├── Walkers.mp4
├── YoloX_Byte_Track.cbp
├── YoloX_Byte_Track.depend
├── YoloX_Byte_Track.layout
├── yoloxN.bin
├── yoloxN.param
└── YoloX_Track
Run
$ ./YoloX_Track
Once YoloX_Track works, you may remove the build directory, since we don't need it any more.
$ sudo rm -rf build
