在Yolov5 Yolov4 Yolov3 TensorRT 实现Implementation
在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
BENCHMARKx86 (inference time)modelsizegpufp32fp16INT8yolov5s640x6401080ti8ms/7msyolov5m640x6401080ti13ms/11msyolov5l640x6401080ti20ms/15msyolov5x640x6401080ti30ms/23msJetson NX with Jetpack4.4.1 (inference / detect time)modelsizegpufp32fp16INT8yolov3416x416nx105ms/120ms30ms/48ms20ms/35msyolov3-tiny416x416nx14ms/23ms8ms/15ms12ms/19msyolov4-tiny416x416nx13ms/23ms7ms/16ms7ms/15msyolov4416x416nx111ms/125ms55ms/65ms47ms/57msyolov5s416x416nx47ms/88ms33ms/74ms28ms/64msyolov5m416x416nx110ms/145ms63ms/101ms49ms/91msyolov5l416x416nx205ms/242ms95ms/123ms76ms/118msyolov5x416x416nx351ms/405ms151ms/183ms114ms/149msubuntumodelsizegpufp32fp16INT8yolov4416x416titanv11ms/17ms8ms/15ms7ms/14msyolov5s416x416titanv7ms/22ms5ms/20ms5ms/18msyolov5m416x416titanv9ms/23ms8ms/22ms7ms/21msyolov5l416x416titanv17ms/28ms11ms/23ms11ms/24msyolov5x416x416titanv25ms/40ms15ms/27ms15ms/27msWRAPPERPrepare the pretrained .weights and .cfg model.Detector detector;
Config config;
std::vector res;
detector.detect(vec_image, res)Build and use yolo-trt as DLL or SO librarieswindows10dependency : TensorRT 7.1.3.4 , cuda 11.0 , cudnn 8.0 , opencv4 , vs2015build:open MSVC sln/sln.sln filedll project : the trt yolo detector dlldemo project : test of the dllubuntu & 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
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::vectorcv::Mat &mat_image,std::vector &vec_batch_result); private: Detector(const Detector &); const Detector &operator =(const Detector &); class Impl; Impl *_impl;};
REFERENCE
https://github.com/wang-xinyu/tensorrtx/tree/master/yolov4
https://github.com/mj8ac/trt-yolo-app_win64
https://github.com/NVIDIA-AI-IOT/deepstream_reference_apps
總結
以上是生活随笔為你收集整理的在Yolov5 Yolov4 Yolov3 TensorRT 实现Implementation的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: TensorRT 基于Yolov3的开发
- 下一篇: FFmpeg扩展开发