In what way should I measure the performance? directly from TensorFlow?
My FCN model was created in TF 2.0. I first froze the exported pb file according to the instruction here:
and then used tf2onnx to produce an ONNX model. I was not able to generate the ONNX model directly from the saved model format. I was not able as well to use TF-TRT to measure performance directly from TF 2.0 (following the instructions in Accelerating Inference In TF-TRT User Guide :: NVIDIA Deep Learning Frameworks Documentation) - I keep receiving errors regarding “tag_constants.SERVING”.
Here is the TF 2.0 code for my FCN with 7 conv2d layers:
image_dim = 256
input_shape_image = (image_dim, image_dim,3)
input_image = Input(shape=input_shape_image, name=‘image’)
n1 = Conv2D(64,(3,3), padding=“same”, activation=‘relu’)(input_image)
n2 = Conv2D(128,(3,3), padding=“same”, activation=‘relu’)(n1)
n3 = Conv2D(128,(3,3), padding=“same”, activation=‘relu’)(n2)
n4 = Conv2D(64,(3,3), padding=“same”, activation=‘relu’)(n3)
n5 = Conv2D(64,(3,3), padding=“same”, activation=‘relu’)(n4)
n6 = Conv2D(32,(3,3), padding=“same”, activation=‘relu’)(n5)
n7 = Conv2D(16,(3,3), padding=“same”, activation=‘relu’)(n6)
g = Conv2D(1,(3,3), padding=“same”, activation=‘sigmoid’)(n7)
and here is the trtexec log file: model_fcn.log (93.4 KB)
Here is a link to the ONNX model: Dropbox - model_fcn.onnx - Simplify your life
Model summary:
Layer (type) Output Shape Param #
image (InputLayer) [(None, 256, 256, 3)] 0
conv2d (Conv2D) (None, 256, 256, 64) 1792
conv2d_1 (Conv2D) (None, 256, 256, 128) 73856
conv2d_2 (Conv2D) (None, 256, 256, 128) 147584
conv2d_3 (Conv2D) (None, 256, 256, 64) 73792
conv2d_4 (Conv2D) (None, 256, 256, 64) 36928
conv2d_5 (Conv2D) (None, 256, 256, 32) 18464
conv2d_6 (Conv2D) (None, 256, 256, 16) 4624
conv2d_7 (Conv2D) (None, 256, 256, 1) 145
Total params: 357,185
Trainable params: 357,185
Non-trainable params: 0