This commit is contained in:
wang-xinyu 2020-03-06 15:24:21 +08:00
commit 1f73c63ef3
2 changed files with 13 additions and 15 deletions

View File

@ -30,8 +30,9 @@ Following models are implemented, each one also has a readme inside.
|[googlenet](./googlenet)| GoogLeNet (Inception v1) | |[googlenet](./googlenet)| GoogLeNet (Inception v1) |
|[inception](./inceptionv3)| Inception v3 | |[inception](./inceptionv3)| Inception v3 |
|[mnasnet](./mnasnet)| MNASNet with depth multiplier of 0.5 from the paper | |[mnasnet](./mnasnet)| MNASNet with depth multiplier of 0.5 from the paper |
|[mobilenet](./mobilenetv2)| MobileNet V2 | |[mobilenet](./mobilenetv2)| MobileNet V2, V3-small, V3-large. |
|[resnet](./resnet)| resnet-18, resnet-50 and resnext50-32x4d are implemented | |[resnet](./resnet)| resnet-18, resnet-50 and resnext50-32x4d are implemented |
|[senet](./senet)| se_resnet50 |
|[shufflenet](./shufflenetv2)| ShuffleNetV2 with 0.5x output channels | |[shufflenet](./shufflenetv2)| ShuffleNetV2 with 0.5x output channels |
|[squeezenet](./squeezenet)| SqueezeNet 1.1 model | |[squeezenet](./squeezenet)| SqueezeNet 1.1 model |
|[vgg](./vgg)| VGG 11-layer model | |[vgg](./vgg)| VGG 11-layer model |
@ -53,4 +54,5 @@ Some tricky operations encountered in these models, already solved, but might ha
|leaky relu| I wrote a leaky relu plugin, but PRelu in `NvInferPlugin.h` can be used, see yolov3. | |leaky relu| I wrote a leaky relu plugin, but PRelu in `NvInferPlugin.h` can be used, see yolov3. |
|yolo layer| yolo layer is implemented as a plugin, see yolov3. | |yolo layer| yolo layer is implemented as a plugin, see yolov3. |
|upsample| replaced by a deconvolution layer, see yolov3. | |upsample| replaced by a deconvolution layer, see yolov3. |
|hsigmoid| hard sigmoid is implemented as a plugin, hsigmoid and hswish are used in mobilenetv3 |

View File

@ -1,23 +1,20 @@
# mobilenet v2 # SENet
MobileNetV2 architecture from An implementation of SENet, proposed in Squeeze-and-Excitation Networks by Jie Hu, Li Shen, Samuel Albanie, Gang Sun, Enhua Wu
"MobileNetV2: Inverted Residuals and Linear Bottlenecks" <https://arxiv.org/abs/1801.04381>.
For the Pytorch implementation, you can refer to [pytorchx/mobilenet](https://github.com/wang-xinyu/pytorchx/tree/master/mobilenet) [https://arxiv.org/abs/1709.01507](https://arxiv.org/abs/1709.01507)
Following tricks are used in this mobilenet, For the Pytorch implementation, you can refer to [wang-xinyu/senet.pytorch](https://github.com/wang-xinyu/senet.pytorch).
- Relu6 is used in mobilenet v2. We use `Relu6(x) = Relu(x) - Relu(x-6)` in tensorrt.
- Batchnorm layer, implemented by scale layer.
``` ```
// 1. generate mobilenet.wts from [pytorchx/mobilenet](https://github.com/wang-xinyu/pytorchx/tree/master/mobilenet) // 1. generate se_resnet50.wts from [wang-xinyu/senet.pytorch](https://github.com/wang-xinyu/senet.pytorch)
// 2. put mobilenet.wts into tensorrtx/mobilenet // 2. put se_resnet50.wts into tensorrtx/senet
// 3. build and run // 3. build and run
cd tensorrtx/mobilenet cd tensorrtx/senet
mkdir build mkdir build
@ -27,11 +24,10 @@ cmake ..
make make
sudo ./mobilenet -s // serialize model to plan file i.e. 'mobilenet.engine' sudo ./se_resnet -s // serialize model to plan file i.e. 'se_resnet50.engine'
sudo ./mobilenet -d // deserialize plan file and run inference sudo ./se_resnet -d // deserialize plan file and run inference
// 4. see if the output is same as pytorchx/mobilenet // 4. see if the output is same as [wang-xinyu/senet.pytorch]
``` ```