Coder Social home page Coder Social logo

tensorrt-fastsam's Introduction

TensorRT-FastSAM

Requirements

pip install -r requirements.txt

Export ONNX model

python export.py --weights < path to FastSAM-x.pt > --output <onnx_model_path>
##--------- example ---------- 
# python export.py --weights ../models/FastSAM-x.pt --output ../models/FastSAM-x2.onnx

Export trt engine

/usr/src/tensorrt/bin/trtexec \ 
--onnx=<onnx_model_path> \
--saveEngine=<engine_path> \
--explicitBatch \ 
--minShapes=images:1x3x1024x1024 \
--optShapes=images:1x3x1024x1024 \
--maxShapes=images:4x3x1024x1024 \ 
--verbose \ 
--device=0
##--------- example ---------- 
# /usr/src/tensorrt/bin/trtexec \
# --onnx="../models/FastSAM-x2.onnx" \
# --saveEngine="../trt_engines/FastSAM-x.engine" \
# --explicitBatch \
# --minShapes=images:1x3x1024x1024 \
# --optShapes=images:1x3x1024x1024 \
# --maxShapes=images:4x3x1024x1024 \
# --verbose \
# --device=0

Do inference

python trt_infer.py <engine_path> <image_path> --output=<output_path>
##--------- example ---------- 
# python trt_infer.py "../trt_engines/FastSAM-x.engine" --output="../unnamed.jpg"

References

tensorrt-fastsam's People

Contributors

belalhmedan90 avatar linaom1214 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

tensorrt-fastsam's Issues

Question about post-processing and others

Hi Thank you for realizing FastSAM batch inference!
I have some questions

  1. I am having a hard time understanding the post-processing code. Can you add more code comments about that?
  2. Is there any reason that you used an additional NMS code, which is not applied on FastSAM?
  3. I am not familiar with TensorRT, so I would like to ask is this inference code possible on multi-GPU settings.

Thank you in advance!

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.