add the command of executing inference with TensorRT models
Browse files- README.md +15 -8
- configs/inference_trt.json +10 -0
- configs/metadata.json +2 -1
- docs/README.md +15 -8
README.md
CHANGED
@@ -75,13 +75,14 @@ Please notice that the benchmark results are tested on one WSI image since the i
|
|
75 |
| end2end |224.97 | 223.50 | 222.65 | 224.03 | 1.01 | 1.01 | 1.00 | 1.00 |
|
76 |
|
77 |
This result is benchmarked under:
|
78 |
-
|
79 |
-
|
80 |
-
-
|
81 |
-
|
82 |
-
|
83 |
-
|
84 |
-
|
|
|
85 |
|
86 |
## MONAI Bundle Commands
|
87 |
|
@@ -121,12 +122,18 @@ cd scripts && source evaluate_froc.sh
|
|
121 |
python -m monai.bundle ckpt_export network_def --filepath models/model.ts --ckpt_file models/model.pt --meta_file configs/metadata.json --config_file configs/inference.json
|
122 |
```
|
123 |
|
124 |
-
#### Export checkpoint to TensorRT based models with fp32 or fp16 precision
|
125 |
|
126 |
```
|
127 |
python -m monai.bundle trt_export --net_id network_def --filepath models/model_trt.ts --ckpt_file models/model.pt --meta_file configs/metadata.json --config_file configs/inference.json --precision <fp32/fp16> --dynamic_batchsize "[1, 400, 600]"
|
128 |
```
|
129 |
|
|
|
|
|
|
|
|
|
|
|
|
|
130 |
# References
|
131 |
|
132 |
[1] He, Kaiming, et al, "Deep Residual Learning for Image Recognition." In Proceedings of the IEEE conference on computer vision and pattern recognition, pp. 770-778. 2016. <https://arxiv.org/pdf/1512.03385.pdf>
|
|
|
75 |
| end2end |224.97 | 223.50 | 222.65 | 224.03 | 1.01 | 1.01 | 1.00 | 1.00 |
|
76 |
|
77 |
This result is benchmarked under:
|
78 |
+
|
79 |
+
- TensorRT: 8.5.3+cuda11.8
|
80 |
+
- Torch-TensorRT Version: 1.4.0
|
81 |
+
- CPU Architecture: x86-64
|
82 |
+
- OS: ubuntu 20.04
|
83 |
+
- Python version:3.8.10
|
84 |
+
- CUDA version: 11.8
|
85 |
+
- GPU models and configuration: A100 80G
|
86 |
|
87 |
## MONAI Bundle Commands
|
88 |
|
|
|
122 |
python -m monai.bundle ckpt_export network_def --filepath models/model.ts --ckpt_file models/model.pt --meta_file configs/metadata.json --config_file configs/inference.json
|
123 |
```
|
124 |
|
125 |
+
#### Export checkpoint to TensorRT based models with fp32 or fp16 precision
|
126 |
|
127 |
```
|
128 |
python -m monai.bundle trt_export --net_id network_def --filepath models/model_trt.ts --ckpt_file models/model.pt --meta_file configs/metadata.json --config_file configs/inference.json --precision <fp32/fp16> --dynamic_batchsize "[1, 400, 600]"
|
129 |
```
|
130 |
|
131 |
+
#### Execute inference with the TensorRT model
|
132 |
+
|
133 |
+
```
|
134 |
+
python -m monai.bundle run --config_file "['configs/inference.json', 'configs/inference_trt.json']"
|
135 |
+
```
|
136 |
+
|
137 |
# References
|
138 |
|
139 |
[1] He, Kaiming, et al, "Deep Residual Learning for Image Recognition." In Proceedings of the IEEE conference on computer vision and pattern recognition, pp. 770-778. 2016. <https://arxiv.org/pdf/1512.03385.pdf>
|
configs/inference_trt.json
ADDED
@@ -0,0 +1,10 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"imports": [
|
3 |
+
"$import glob",
|
4 |
+
"$import os",
|
5 |
+
"$import torch_tensorrt"
|
6 |
+
],
|
7 |
+
"handlers#0#_disabled_": true,
|
8 |
+
"network_def": "$torch.jit.load(@bundle_root + '/models/model_trt.ts')",
|
9 |
+
"evaluator#amp": false
|
10 |
+
}
|
configs/metadata.json
CHANGED
@@ -1,7 +1,8 @@
|
|
1 |
{
|
2 |
"schema": "https://github.com/Project-MONAI/MONAI-extra-test-data/releases/download/0.8.1/meta_schema_20220324.json",
|
3 |
-
"version": "0.
|
4 |
"changelog": {
|
|
|
5 |
"0.4.9": "adapt to BundleWorkflow interface",
|
6 |
"0.4.8": "update the readme file with TensorRT convert",
|
7 |
"0.4.7": "add name tag",
|
|
|
1 |
{
|
2 |
"schema": "https://github.com/Project-MONAI/MONAI-extra-test-data/releases/download/0.8.1/meta_schema_20220324.json",
|
3 |
+
"version": "0.5.0",
|
4 |
"changelog": {
|
5 |
+
"0.5.0": "add the command of executing inference with TensorRT models",
|
6 |
"0.4.9": "adapt to BundleWorkflow interface",
|
7 |
"0.4.8": "update the readme file with TensorRT convert",
|
8 |
"0.4.7": "add name tag",
|
docs/README.md
CHANGED
@@ -68,13 +68,14 @@ Please notice that the benchmark results are tested on one WSI image since the i
|
|
68 |
| end2end |224.97 | 223.50 | 222.65 | 224.03 | 1.01 | 1.01 | 1.00 | 1.00 |
|
69 |
|
70 |
This result is benchmarked under:
|
71 |
-
|
72 |
-
|
73 |
-
-
|
74 |
-
|
75 |
-
|
76 |
-
|
77 |
-
|
|
|
78 |
|
79 |
## MONAI Bundle Commands
|
80 |
|
@@ -114,12 +115,18 @@ cd scripts && source evaluate_froc.sh
|
|
114 |
python -m monai.bundle ckpt_export network_def --filepath models/model.ts --ckpt_file models/model.pt --meta_file configs/metadata.json --config_file configs/inference.json
|
115 |
```
|
116 |
|
117 |
-
#### Export checkpoint to TensorRT based models with fp32 or fp16 precision
|
118 |
|
119 |
```
|
120 |
python -m monai.bundle trt_export --net_id network_def --filepath models/model_trt.ts --ckpt_file models/model.pt --meta_file configs/metadata.json --config_file configs/inference.json --precision <fp32/fp16> --dynamic_batchsize "[1, 400, 600]"
|
121 |
```
|
122 |
|
|
|
|
|
|
|
|
|
|
|
|
|
123 |
# References
|
124 |
|
125 |
[1] He, Kaiming, et al, "Deep Residual Learning for Image Recognition." In Proceedings of the IEEE conference on computer vision and pattern recognition, pp. 770-778. 2016. <https://arxiv.org/pdf/1512.03385.pdf>
|
|
|
68 |
| end2end |224.97 | 223.50 | 222.65 | 224.03 | 1.01 | 1.01 | 1.00 | 1.00 |
|
69 |
|
70 |
This result is benchmarked under:
|
71 |
+
|
72 |
+
- TensorRT: 8.5.3+cuda11.8
|
73 |
+
- Torch-TensorRT Version: 1.4.0
|
74 |
+
- CPU Architecture: x86-64
|
75 |
+
- OS: ubuntu 20.04
|
76 |
+
- Python version:3.8.10
|
77 |
+
- CUDA version: 11.8
|
78 |
+
- GPU models and configuration: A100 80G
|
79 |
|
80 |
## MONAI Bundle Commands
|
81 |
|
|
|
115 |
python -m monai.bundle ckpt_export network_def --filepath models/model.ts --ckpt_file models/model.pt --meta_file configs/metadata.json --config_file configs/inference.json
|
116 |
```
|
117 |
|
118 |
+
#### Export checkpoint to TensorRT based models with fp32 or fp16 precision
|
119 |
|
120 |
```
|
121 |
python -m monai.bundle trt_export --net_id network_def --filepath models/model_trt.ts --ckpt_file models/model.pt --meta_file configs/metadata.json --config_file configs/inference.json --precision <fp32/fp16> --dynamic_batchsize "[1, 400, 600]"
|
122 |
```
|
123 |
|
124 |
+
#### Execute inference with the TensorRT model
|
125 |
+
|
126 |
+
```
|
127 |
+
python -m monai.bundle run --config_file "['configs/inference.json', 'configs/inference_trt.json']"
|
128 |
+
```
|
129 |
+
|
130 |
# References
|
131 |
|
132 |
[1] He, Kaiming, et al, "Deep Residual Learning for Image Recognition." In Proceedings of the IEEE conference on computer vision and pattern recognition, pp. 770-778. 2016. <https://arxiv.org/pdf/1512.03385.pdf>
|