duan8/resnet
irvingzhang0512 8cfc8ee03f
Support TSM-R50 Python API (#488)
* add tensorrt temporal shift module and related pytorch implementations

* add .gitignore and getn weights script.

* rename get_wts.py script

* Add tsm-r50 demo.

* update readme

* remove useless codes

* update readme

* update readme

* remote video and .gitignore, update tutorial

* update readme and tutorial

* fix a few bugs and test on tensorrt 5.1

* update readme
2021-04-18 16:30:25 +08:00
..
CMakeLists.txt resnet to trt7 2020-11-06 23:54:18 +08:00
logging.h resnet to trt7 2020-11-06 23:54:18 +08:00
README.md Build ResNet50 by TensorRT Python Network Definition API (#482) 2021-04-15 13:17:41 +08:00
resnet18.cpp resnet to trt7 2020-11-06 23:54:18 +08:00
resnet50.cpp resnet to trt7 2020-11-06 23:54:18 +08:00
resnet50.py Support TSM-R50 Python API (#488) 2021-04-18 16:30:25 +08:00
resnext50_32x4d.cpp resnet to trt7 2020-11-06 23:54:18 +08:00

resnet

ResNet-18 and ResNet-50 model from "Deep Residual Learning for Image Recognition" https://arxiv.org/pdf/1512.03385.pdf

For the Pytorch implementation, you can refer to pytorchx/resnet

Following tricks are used in this resnet, nothing special, residual connection and batchnorm are used.

  • Batchnorm layer, implemented with scale layer.

TensorRT C++ API

// 1. generate resnet18.wts or resnet50.wts from [pytorchx/resnet](https://github.com/wang-xinyu/pytorchx/tree/master/resnet)

// 2. put resnet18.wts or resnet50.wts into tensorrtx/resnet

// 3. build and run

cd tensorrtx/resnet

mkdir build

cd build

cmake ..

make

sudo ./resnet18 -s   // serialize model to plan file i.e. 'resnet18.engine'
sudo ./resnet18 -d   // deserialize plan file and run inference

or

sudo ./resnet50 -s   // serialize model to plan file i.e. 'resnet50.engine'
sudo ./resnet50 -d   // deserialize plan file and run inference


// 4. see if the output is same as pytorchx/resnet

TensorRT Python API

# 1. generate resnet50.wts from [pytorchx/resnet](https://github.com/wang-xinyu/pytorchx/tree/master/resnet)

# 2. put resnet50.wts into tensorrtx/resnet

# 3. install Python dependencies (tensorrt/pycuda/numpy)

cd tensorrtx/resnet

python resnet50.py -s   // serialize model to plan file i.e. 'resnet50.engine'
python resnet50.py -d   // deserialize plan file and run inference

# 4. see if the output is same as pytorchx/resnet