ICode9

精准搜索请尝试: 精确搜索
首页 > 其他分享> 文章详细

在Yolov5 Yolov4 Yolov3 TensorRT 实现Implementation

2020-11-30 09:01:30  阅读:924  来源: 互联网

标签:Yolov5 yolov4 Yolov3 7ms yolo nx Yolov4 Detector 416x416


在Yolov5 Yolov4 Yolov3 TensorRT 实现Implementation

news: yolov5 support

引论

该项目是nvidia官方yolo-tensorrt的封装实现。你必须有经过训练的yolo模型(.weights)和来自darknet(yolov3&yolov4)的.cfg文件。对于yolov5,需要Pythorch中的模型文件(yolov5s.yaml)和经过训练的权重文件(yolov5s.pt)。

 

 

 参考:https://github.com/enazoe/yolo-tensorrt

  • yolov5s , yolov5m , yolov5l , yolov5x tutorial
  • yolov4 , yolov4-tiny
  • yolov3 , yolov3-tiny

Features

  • inequal net width and height
  • batch inference
  • support FP32,FP16,INT8
  • dynamic input size

PLATFORM & BENCHMARK

  • windows 10
  • ubuntu 18.04
  • L4T (Jetson platform)

BENCHMARK

x86 (inference time)

model

size

gpu

fp32

fp16

INT8

yolov5s

640x640

1080ti

8ms

/

7ms

yolov5m

640x640

1080ti

13ms

/

11ms

yolov5l

640x640

1080ti

20ms

/

15ms

yolov5x

640x640

1080ti

30ms

/

23ms

Jetson NX with Jetpack4.4.1 (inference / detect time)

model

size

gpu

fp32

fp16

INT8

yolov3

416x416

nx

105ms/120ms

30ms/48ms

20ms/35ms

yolov3-tiny

416x416

nx

14ms/23ms

8ms/15ms

12ms/19ms

yolov4-tiny

416x416

nx

13ms/23ms

7ms/16ms

7ms/15ms

yolov4

416x416

nx

111ms/125ms

55ms/65ms

47ms/57ms

yolov5s

416x416

nx

47ms/88ms

33ms/74ms

28ms/64ms

yolov5m

416x416

nx

110ms/145ms

63ms/101ms

49ms/91ms

yolov5l

416x416

nx

205ms/242ms

95ms/123ms

76ms/118ms

yolov5x

416x416

nx

351ms/405ms

151ms/183ms

114ms/149ms

ubuntu

model

size

gpu

fp32

fp16

INT8

yolov4

416x416

titanv

11ms/17ms

8ms/15ms

7ms/14ms

yolov5s

416x416

titanv

7ms/22ms

5ms/20ms

5ms/18ms

yolov5m

416x416

titanv

9ms/23ms

8ms/22ms

7ms/21ms

yolov5l

416x416

titanv

17ms/28ms

11ms/23ms

11ms/24ms

yolov5x

416x416

titanv

25ms/40ms

15ms/27ms

15ms/27ms

WRAPPER

Prepare the pretrained .weights and .cfg model.

Detector detector;

Config config;

 

std::vector<BatchResult> res;

detector.detect(vec_image, res)

Build and use yolo-trt as DLL or SO libraries

windows10

  • dependency : TensorRT 7.1.3.4 , cuda 11.0 , cudnn 8.0 , opencv4 , vs2015
  • build:

open MSVC sln/sln.sln file

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

ubuntu & L4T (jetson)

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

git clone https://github.com/enazoe/yolo-tensorrt.git
cd yolo-tensorrt/
mkdir build
cd build/
cmake ..
make
./yolo-trt

API

struct Config
{
        std::string file_model_cfg = "configs/yolov4.cfg";
 
        std::string file_model_weights = "configs/yolov4.weights";
 
        float detect_thresh = 0.9;
 
        ModelType net_type = YOLOV4;
 
        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 std::vector<cv::Mat> &mat_image,std::vector<BatchResult> &vec_batch_result);
 
private:
        Detector(const Detector &);
        const Detector &operator =(const Detector &);
        class Impl;
        Impl *_impl;
};

REFERENCE

 

 

标签:Yolov5,yolov4,Yolov3,7ms,yolo,nx,Yolov4,Detector,416x416
来源: https://www.cnblogs.com/wujianming-110117/p/14059442.html

本站声明: 1. iCode9 技术分享网(下文简称本站)提供的所有内容,仅供技术学习、探讨和分享;
2. 关于本站的所有留言、评论、转载及引用,纯属内容发起人的个人观点,与本站观点和立场无关;
3. 关于本站的所有言论和文字,纯属内容发起人的个人观点,与本站观点和立场无关;
4. 本站文章均是网友提供,不完全保证技术分享内容的完整性、准确性、时效性、风险性和版权归属;如您发现该文章侵犯了您的权益,可联系我们第一时间进行删除;
5. 本站为非盈利性的个人网站,所有内容不会用来进行牟利,也不会利用任何形式的广告来间接获益,纯粹是为了广大技术爱好者提供技术内容和技术思想的分享性交流网站。

专注分享技术,共同学习,共同进步。侵权联系[81616952@qq.com]

Copyright (C)ICode9.com, All Rights Reserved.

ICode9版权所有