1 Star 5 Fork 1

cubone/learnopencv

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
AgeGender
AlphaBlending
AugmentedRealityWithArucoMarkers
Autoencoder-in-TensorFlow
Background-Subtraction
Bag-Of-Tricks-For-Image-Classification
BatchNormalization
BlobDetector
CI
CameraCalibration
CenterofBlob
CharClassification
Classification-with-localization-convert-any-keras-classi...
ColorSpaces
Colorization
Colormap
Contour-Detection-using-OpenCV
ConvexHull
Creating-a-Virtual-Pen-and-Eraser
DNN-OpenCV-Classification-Android
DNN-OpenCV-Classification-with-Java
Deep-Learning-with-OpenCV-DNN-Module
Delaunay
DenoisingAutoencoder
Depth-Perception-Using-Stereo-Camera
Efficient-image-loading
EfficientNet
EigenFace
EpipolarGeometryAndStereoVision
ExposureFusion
FBAMatting
FPS
Face-Recognition-with-ArcFace
FaceAverage
FaceDetectionComparison
FaceMaskOverlay
FaceMorph
FaceSwap
FacialAttractiveness
FacialLandmarkDetection
Federated-Learning-Intro
FunnyMirrors
GOTURN
Getting-Started-OpenCV-CUDA-Module
Graph-Convolutional-Networks-Model-Relations-In-Data
HandPose
Hangman
HeadPose
Holes
Homography
Hough-Transform
HuMoments
Image-Classification-in-PyTorch
Image-Inpainting
Image-classification-pre-trained-models
ImageAlignment-FeatureBased
ImageAlignment
ImageMetrics
Improving-Illumination-in-Night-Time-Images
Inference-for-PyTorch-Models/ONNX-Caffe2
Install-OpenCV-Windows-exe
InstallScripts
Intro-to-Generative-Adversarial-Network
InvisibilityCloak
Keras-Fine-Tuning
Keras-ImageNet-Models
Keras-Transfer-Learning
KerasCNN-CIFAR
KerasMLP-MNIST
MRNet-Single-Model
MRnet-MultiTask-Approach
Mask-RCNN
MultiObjectTracker
Non-Maximum-Suppression
NonPhotorealisticRendering
OCR
ObjectDetection-YOLO
OpenCV-dnn-gpu-support-Linux
OpenCV-dnn-gpu-support-Windows
OpenPose-Multi-Person
OpenPose
OpenVINO-OpenCV
Optical-Flow-Estimation-using-Deep-Learning-RAFT
Optical-Flow-in-OpenCV
Photoshop-Filters-in-OpenCV
Playing-Chrome-TRex-Game-with-Facial-Gestures
Playing-rock-paper-scissors-with-AI
PyTorch-Fully-Convolutional-Image-Classification
PyTorch-Keypoint-RCNN
PyTorch-Mask-RCNN
PyTorch-Multi-Label-Image-Classification-Image-Tagging
PyTorch-Multi-Label-Image-Classification
PyTorch-ONNX-TensorRT-CPP
PyTorch-ONNX-TensorRT
README.md
imagenet_classes.txt
pytorch_model.py
requirements.txt
resnet50.onnx
trt_inference.py
turkish_coffee.jpg
PyTorch-Receptive-Field-With-Backprop
PyTorch-Segmentation-torchvision
PyTorch-Vision-Experiment-Logging
PyTorch-faster-RCNN
PyTorch-for-Beginners
PyTorch-to-CoreML-model-conversion
PyTorch-to-TensorFlow-Model-Conversion
Pytorch-Lightning
Pytorch-Net-Surgery
QRCode-OpenCV
Quora-Dataset-Duplicate-Search
ReconstructFaceUsingEigenFaces
RedEyeRemover
RotationMatrixToEulerAngles
SVM-using-Python
SeamlessCloning
SelectiveSearch
SnakeGame
Super-Resolution-in-OpenCV
TSNE
TensorBoard-With-Pytorch-Lightning
TensorFlow-Fully-Convolutional-Image-Classification
TensorFlow-Receptive-Field-With-Backprop
Tetris
TextDetectionEAST
Threshold
Training_a_custom_hand_detector_with_dlib
UI-cvui
UnderstandingLensDistortion
Universal-Sentence-Encoder
Variational-Autoencoder-TensorFlow
VideoBackgroundEstimation
VideoReadWriteDisplay
VideoStabilization
WarpTriangle
XeusCling
YOLOv3-Training-Snowman-Detector
app-seperation-semseg
barcode-QRcodeScanner
digits-classification
docs
downloadOpenImages
forEach
hdr
heatmap
imread
keras-linear-regression
ninjaEyeDetector
otsu-method
pymodule
qt-test
stereo-camera
tracking
video-classification-and-human-activity-recognition
.gitignore
README.md
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
贡献代码
同步代码
Loading...
README

How to convert a model from PyTorch to TensorRT and speed up inference

The blog post is here: https://www.learnopencv.com/how-to-convert-a-model-from-pytorch-to-tensorrt-and-speed-up-inference/

To run PyTorch part:

python3 -m pip install -r requirements.txt
python3 pytorch_model.py

To run TensorRT part:

  1. Download and install NVIDIA CUDA 10.0 or later following by official instruction: link
  2. Download and extract CuDNN library for your CUDA version (login required): link
  3. Download and extract NVIDIA TensorRT library for your CUDA version (login required): link. The minimum required version is 6.0.1.5. Please follow the Installation Guide for your system and don't forget to install Python's part
  4. Add the absolute path to CUDA, TensorRT, CuDNN libs to the environment variable PATH or LD_LIBRARY_PATH
  5. Install PyCUDA
python3 trt_inference.py

AI Courses by OpenCV

Want to become an expert in AI? AI Courses by OpenCV is a great place to start.

马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/cubone/learnopencv.git
git@gitee.com:cubone/learnopencv.git
cubone
learnopencv
learnopencv
master

搜索帮助