-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
make the utility util_keras-h5-model_to-tensorflow-pb_to-nvinfer-uff.py. Following was the progress: a. Got VGG base CNN working correctly with UFF parser b. Got mobilenet basee working correct with UFF parser. Issue was caused by Merge Op and Switch Op which was solved using K.set_learning_phase(0) even before graph construction. This was critical c. ExpandDims is still not supported by Nvidia's tensorrt. Way around is using reshape in netvlad. TODO: a. expand_dims --> reshape. Verify UFFparser works on x86 as well as on TX2 b. numerical verification by giving same image to keras and same image to tensorrt.
- Loading branch information
Showing
5 changed files
with
157 additions
and
23 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
# To check if .uff file can be loaded back | ||
|
||
import tensorrt as trt | ||
|
||
TRT_LOGGER = trt.Logger( trt.Logger.WARNING) | ||
LOG_DIR = 'models.keras/June2019/centeredinput-m1to1-240x320x3__mobilenet-conv_pw_6_relu__K16__allpairloss/' | ||
uff_fname = 'output_nvinfer.uff' | ||
|
||
with trt.Builder( TRT_LOGGER) as builder, builder.create_network() as network, trt.UffParser() as parser: | ||
parser.register_input("input_1", (3,240,320) ) | ||
# parser.register_output( "conv_pw_5_relu/Relu6" ) | ||
parser.register_output( "net_vlad_layer_1/l2_normalize_1" ) | ||
parser.parse( LOG_DIR+'/'+uff_fname, network ) | ||
pass |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters