Skip to content

darknet -> tensorrt. TensorRT yoloV23 use raw darknet *.weights and *.cfg fils. If the wrapper is useful to you,please Star it.

Notifications You must be signed in to change notification settings

stolyarchuk/yolo-tensorrt

 
 

Repository files navigation

yolo-tensorrt

INTRODUCTION

The project is the encapsulation of nvidia official yolo-tensorrt implementation. And you must have the trained yolo model(.weights) and .cfg file from the darknet.

PLATFORM

model gpu precision memory used inference time
yolov3-416x416 gtx1050 INT8 25ms
yolov3-416x416 gtx1050 FLOAT32 50ms
yolov3-608x608 gtx1050 INT8 ~450M ~50ms
yolov3-608x608 gtx1050 FLOAT32 ~1000M ~95ms
yolov3-416x416 jetson nano (15w) HALF(FP16) 250ms

WRAPPER

Prepare the pretrained .weights and .cfg model.

Detector detector;
Config config;
config.inference_precison = INT8;
detector.init(config);

cv::Mat mat_image = cv::imread("dog.jpg");
std::vector<Result> res;
detector.detect(mat_image, res)

How to use yolo-trt as DLL or SO libraries

windows10

  • dependency : cuda 10.0 , cudnn 7.5 , TensorRT 5.1.5 , opencv3.3 , gflags , vs2015

  • build:

    open MSVC sln/sln.sln file

    • dll project : the interface of the trt yolo dll
    • demo project : test of the dll

ubuntu

jetson nano

dependency : gflags , JetPack 4.2.2

sudo apt-get install libgflags-dev
cd yolo-tensorrt/
mkdir build
cd build/
cmake ..
make

The project generate the libdetector.so lib, and the sample code. If you want to use the generated libdetector.so lib in your own project,the cmake file perhaps could help you in scripts dir.

note: when the platform is jetson nano the gencode arch must be set compute_53,code=sm_53 at cmake file.

API

struct Config
{
	std::string file_model_cfg = "configs/yolov3.cfg";

	std::string file_model_weights = "configs/yolov3.weights";

	float detect_thresh = 0.9;

	ModelType net_type = YOLOV3;

	Precision inference_precison = INT8;
	
	int gpu_id = 0;

	std::string calibration_image_list_file_txt = "configs/calibration_images.txt";
};

class API Detector
{
public:
	explicit Detector();
	~Detector();

	void init(const Config &config);

	void detect(const cv::Mat &mat_image, std::vector<Result> &vec_result);

private:
	Detector(const Detector &);
	const Detector &operator =(const Detector &);
	class Impl;
	Impl *_impl;
};

REFERENCE

About

darknet -> tensorrt. TensorRT yoloV23 use raw darknet *.weights and *.cfg fils. If the wrapper is useful to you,please Star it.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • C++ 90.0%
  • CMake 5.4%
  • Cuda 2.4%
  • Python 2.2%