imsoo / darknet_server

Darknet (Open source neural networks framework) Server
MIT License
28 stars 8 forks source link

Darknet server

This is for the use of the Darknet (Open source neural networks) in cloud computing. using this project, You can send video or Webcam stream to server, and get result from Server in real time.

Overview

In this project, Server and client communicate based on ZeroMQ message library. Client read frame from video or Webcam using by OpenCV and send to server by json message format. Server receive message and do work something. (Object detection or Pose Estimation) and send result (processed frame and detection result) back to client by json message format.

Client - Server Server Parallel Pipeline

Requirements

Pre-trained models

How to Build

add some code in yolo_v2_class.cpp

vi src/yolo_v2_class.cpp

add below Detector::get_net_height() member function definition

LIB_API int Detector::get_net_out_width() const { detector_gpu_t &detector_gpu = static_cast<detector_gpu_t >(detector_gpu_ptr.get()); return detector_gpu.net.layers[detector_gpu.net.n - 2].out_w; } LIB_API int Detector::get_net_out_height() const { detector_gpu_t &detector_gpu = static_cast<detector_gpu_t >(detector_gpu_ptr.get()); return detector_gpu.net.layers[detector_gpu.net.n - 2].out_h; } LIB_API float Detector::predict(float input) const { detector_gpu_t &detector_gpu = static_cast<detector_gpu_t >(detector_gpu_ptr.get()); return network_predict(detector_gpu.net, input); }

add some code in yolo_v2_class.hpp

vi include/yolo_v2_class.hpp

add below Detector::get_net_height() member function declaration

LIB_API int get_net_out_width() const; LIB_API int get_net_out_height() const; LIB_API float predict(float input) const;

Build a library darknet.so

vi Makefile ## set option LIBSO = 1 make ## build a library darknet.so sudo cp libdarknet.so /usr/local/lib/

Build darknet_server

git clone https://github.com/imsoo/darknet_server cd darknet_server/server make

Run Sink & Ventilator

./sink ./ventilator

Run worker (if GPU shows low utilization and has enough memory, run more worker)

./worker [-pose] [-gpu GPU_ID] [-thresh THRESH]


* #### Client (Linux)
``` sh
## Build darknet_client
git clone https://github.com/imsoo/darknet_server
cd darknet_server/client/darknet_client
make

## Run darknet client
./darknet_client <-addr ADDR> <-vid VIDEO_PATH | -cam CAM_NUM> [-out_vid] [-out_json] [-dont_show]

How to use on the command line

JSON Output

References