Giter VIP home page Giter VIP logo

qengineering / yolox-tracking-ncnn-rpi_64-bit Goto Github PK

View Code? Open in Web Editor NEW
17.0 2.0 6.0 20.58 MB

YoloX with tracking for a bare Raspberry Pi 4 using ncnn.

Home Page: https://qengineering.eu/deep-learning-examples-on-raspberry-32-64-os.html

License: BSD 3-Clause "New" or "Revised" License

C++ 95.47% C 2.89% CMake 1.64%
deep-learning ncnn ncnn-model raspberry-pi-4 raspberry-pi-64-os tracking yolox yolox-nano byte-tracking

yolox-tracking-ncnn-rpi_64-bit's Introduction

YoloX with Tracking

YoloXtrack.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.

License

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

paypal

yolox-tracking-ncnn-rpi_64-bit's People

Contributors

qengineering avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

yolox-tracking-ncnn-rpi_64-bit's Issues

Tflite traking fps performance

Hi, @Qengineering

I saw that below 2 link from the top is the same link and not firecting the Tflite-tracker code.

Is these fps for tflite + tracking ?

Can raspbery pi 4 handle the vehicle count ie 20 fps ?

Screen Shot 2022-08-17 at 19 45 18

typeinfo for ncnn::Layer

Hi @Qengineering ,

When I run the project file YoloX_Byte_Track.cbp, I got following error:

||=== Build: Release in YoloX Byte Track (compiler: GNU GCC Compiler) ===|

/usr/bin/ld: obj/Release/src/yoloX.o:(.data.rel.ro._ZTI11YoloV5Focus[_ZTI11YoloV5Focus]+0x10)|
|undefined reference to 'typeinfo for ncnn::Layer'|

||error: ld returned 1 exit status|

||=== Build failed: 2 error(s), 0 warning(s) (0 minute(s), 1 second(s)) ===|

I have installed Eigen and working with your RPi 64 Img. I have checked the previous #1. It seems not working for me. What is confusing me is that YoloX detection was running on the system with the code

yolox.register_custom_layer("YoloV5Focus", YoloV5Focus_layer_creator);
It means that my ncnn should be fine to work with YoloX. However, it fails in the tracking program.
I also checked the Project build options that ncnn library has been added in the compiler. I am not sure which part causes failure this time.

Bytetracker on android

Hi, @Qengineering
Thanks for this great work.
I was trying to port the models to android using ndk and jni.
There is a problem with a fstream function inside bytetracker. I see "fstream" is included in bytetracker.cpp, but I had no luck finding the code using it. And just compiles OK without it until being run on android.
Is there a file operation inside this library? Do you have any suggestions?
Regards.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.