GithubHelp home page GithubHelp logo

pioling / infer Goto Github PK

View Code? Open in Web Editor NEW

This project forked from shouxieai/infer

0.0 0.0 0.0 47.65 MB

A new tensorrt integrate.

License: MIT License

Shell 1.19% C++ 25.71% Python 2.41% Cuda 69.03% Makefile 1.66%

infer's Introduction

New tensorrt package, easy to integrate many tasks

  • Easily implement producer-consumer models for various tasks and perform high-performance inference
  • No complex packaging, no coupling!

For the Yolo-Demo

  • Currently supports Yolo series 3/4/5/x/7/8
  • YoloV8-Segment is supported
  • 🚀 Pre-processing about 1ms
  • 🚀 Post-processing about 0.5ms

Description

  • cpm.hpp Producer-consumer model
    • For direct inference tasks, cpm.hpp can be turned into an automatic multi-batch producer-consumer model
  • infer.hpp A repackaging of tensorRT. Simple interface
  • yolo.hpp Wrapper for yolo tasks. Based on infer.hpp

Inference flow of trt

step1 Compile the model, e.g.

trtexec --onnx=yolov5s.onnx --saveEngine=yolov5s.engine

step2: Use infer inference

model = trt::load("yolov5s.engine");
... preprocess ...

// Configure the dynamic batch size.
auto dims = model->static_dims();
dims[0] = batch;
model->set_run_dims(dims);
model->forward({input_device, output_device}, stream);

... postprocess ...

step2: Use yolo inference

cv::Mat image = cv::imread("image.jpg");
auto model = yolo::load("yolov5s.engine");
auto objs = model->forward(yolo::Image(image.data, image.cols, image.rows));
// use objs to draw to image. 

Use of CPM (wrapping the inference as producer-consumer)

cpm::Instance<yolo::BoxArray, yolo::Image, yolo::Infer> cpmi;
cpmi.start([]{
    return yolo::load("yolov5s.engine", yolo::Type::V5);
}, batch);

auto result_futures = cpmi.commits(images);
for(auto& fut : result_futures){
    auto objs = fut.get();
    ... process ...
}

Reference

infer's People

Contributors

hopef avatar shouxieai avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.