duan8/densenet
Aditya Lohia e8653a776d
Add: AlexNet, MobileNetV3, DenseNet121 Python Network Definition API (#512)
* add: mobilenetv2 Python network definition API

* add: mobilenetv3 base code

* add: mobilenetv2 Python network definition API

* restructure: mobilenetv2 code

* add: Alexnet Python Network Definition API

* update: README according to new folder architecture

* add: mobilenetv3 small and large python network definition API

* add: DenseNet121 Python Network Definition API
2021-04-28 13:39:55 +08:00
..
CMakeLists.txt Add DenseNet121 (#460) 2021-04-01 20:21:29 +08:00
densenet121.cpp Add DenseNet121 (#460) 2021-04-01 20:21:29 +08:00
densenet121.py Add: AlexNet, MobileNetV3, DenseNet121 Python Network Definition API (#512) 2021-04-28 13:39:55 +08:00
logging.h Add DenseNet121 (#460) 2021-04-01 20:21:29 +08:00
README.md update readme 2021-04-02 09:44:28 +08:00

Densenet121

The Pytorch implementation is makaveli10/densenet. Model from torchvision. The tensorrt implemenation is taken from makaveli10/cpptensorrtz.

How to Run

  1. generate densenet121.wts from pytorch
git clone https://github.com/wang-xinyu/tensorrtx.git
git clone https://github.com/makaveli10/torchtrtz.git

// go to torchtrtz/densenet
// Enter these two commands to create densenet121.wts
python models.py
python gen_trtwts.py
  1. build densenet and run
// put densenet121.wts into tensorrtx/densenet
// go to tensorrtx/densenet
mkdir build
cd build
cmake ..
make
sudo ./densenet -s  // serialize model to file i.e. 'densenet.engine'
sudo ./densenet -d  // deserialize model and run inference
  1. Verify output from torch impl

TensorRT output[:5]:

    [-0.587389, -0.329202, -1.83404, -1.89935, -0.928404]