/yolo_and_gst

YOLOv3 and GStreamer. Playback video with object detection

Primary LanguageC++

YOLOv3 and GStreamer

Русский

YOLOv3 - модель для распознавания объектов на изображении.
GStreamer - мультимедийная библиотека для работы с видео и аудио.
yolo_and_gst - связка этих компонентов.
На вход даёшь mp4-видео, на выходе получаешь его воспроизведение с подсвеченными обнаруженными объектами.

screenshot

В этом проекте не используется OpenCV

Для распознавания образов используется проект ncnn - это реализация алгоритма YOLOv3.

Вы можете попробовать эту программу без сборки. Скачайте готовую версию по ссылке.
Для её запуска, возможно, потребуется установить зависимости (см. Перед сборкой).
Также можете скачать mp4-видео)
Оригинал

Перед сборкой

Требуется установить зависимости. Выполните следующие команды:

sudo apt install libgstreamer1.0-0 libgstreamer1.0-dev gstreamer1.0-libav gstreamer1.0-x
sudo apt install libfreetype6 libfreetype6-dev

Сборка

Откройте в терминале директорию, где хотите расположить проект, и выполните следующие команды:

git clone https://github.com/itsroar/yolo_and_gst --recurse-submodules
cd yolo_and_gst
mkdir build
cd build
cmake .. -DCMAKE_BUILD_TYPE=Release
make -j{кол-во_потоков}

В случае успешной сборки в папке build появится исполняемый файл yolo_and_gst.

После сборки

В корне проекта создайте папку res и расположите в ней файлы-ресурсы используемые программой: шрифт для отрисовки текста, датасет для нейронной сети.
Эти файлы вы можете взять из готовой версии программы, которую можно скачать по ссылке.
Возьмите из архива arial.ttf, mobilenetv2_yolov3.bin и mobilenetv2_yolov3.param.

Программа готова к запуску

Запуск

./yolo_and_gst <путь_к_mp4-видео>
./yolo_and_gst <путь_к_mp4-видео> <желаемый_fps>

English

YOLOv3 - model for object detection in image.
GStreamer - multimedia library for working with video and audio.
yolo_and_gst - combination of these elements.
Input: mp4 video
Output: playback video with object detection

screenshot

This project does not use OpenCV

For object detection uses project ncnn project - this is an implementation of the YOLOv3 algorithm.

You can try this program without building. Download the finished program from the link.
To run it, you may need to install dependencies (see Before building).
Also you may download mp4-video)
Original

Before building

Dependencies need to be installed. Run the following commands:

sudo apt install libgstreamer-1.0 libgstreamer-1.0-dev gstreamer1.0-libav gstreamer1.0-x
sudo apt install libfreetype6 libfreetype6-dev

Building

Open the directory where you want to locate this project. Run the following commands:

git clone https://github.com/itsroar/yolo_and_gst --recurse-submodules
cd yolo_and_gst
mkdir build
cd build
cmake .. -DCMAKE_BUILD_TYPE=Release
make -j{thread_count}

If the build is successful, the executable file yolo_and_gst will appear in the build folder.

After building

In the root of the project, create res folder and place the resource files used by the program in it: font for drawing text, dataset for neural network.
You can take these files from the finished version of the program, which can be downloaded from link.
Take from the archive arial.ttf, mobilenetv2_yolov3.bin и mobilenetv2_yolov3.param.

The program is ready to run

Running

./yolo_and_gst <mp4_path>
./yolo_and_gst <mp4_path> <fps>