View source on GitHub |
Exports inference graph for the model specified in the exp config.
tfm.vision.serving.export_saved_model_lib.export_inference_graph(
input_type: str,
batch_size: Optional[int],
input_image_size: List[int],
params: tfm.core.base_trainer.ExperimentConfig
,
checkpoint_path: str,
export_dir: str,
num_channels: Optional[int] = 3,
export_module: Optional[tfm.core.export_base.ExportModule
] = None,
export_checkpoint_subdir: Optional[str] = None,
export_saved_model_subdir: Optional[str] = None,
save_options: Optional[tf.saved_model.SaveOptions] = None,
log_model_flops_and_params: bool = False,
checkpoint: Optional[tf.train.Checkpoint] = None,
input_name: Optional[str] = None,
function_keys: Optional[Union[List[Text], Dict[Text, Text]]] = None,
add_tpu_function_alias: Optional[bool] = False
)
Saved model is stored at export_dir/saved_model, checkpoint is saved at export_dir/checkpoint, and params is saved at export_dir/params.yaml.
Args | |
---|---|
input_type
|
One of image_tensor , image_bytes , tf_example or tflite .
|
batch_size
|
'int', or None. |
input_image_size
|
List or Tuple of height and width. |
params
|
Experiment params. |
checkpoint_path
|
Trained checkpoint path or directory. |
export_dir
|
Export directory path. |
num_channels
|
The number of input image channels. |
export_module
|
Optional export module to be used instead of using params to create one. If None, the params will be used to create an export module. |
export_checkpoint_subdir
|
Optional subdirectory under export_dir to store checkpoint. |
export_saved_model_subdir
|
Optional subdirectory under export_dir to store saved model. |
save_options
|
SaveOptions for tf.saved_model.save .
|
log_model_flops_and_params
|
If True, writes model FLOPs to model_flops.txt and model parameters to model_params.txt. |
checkpoint
|
An optional tf.train.Checkpoint. If provided, the export module will use it to read the weights. |
input_name
|
The input tensor name, default at None which produces input
tensor name inputs .
|
function_keys
|
a list of string keys to retrieve pre-defined serving signatures. The signaute keys will be set with defaults. If a dictionary is provided, the values will be used as signature keys. |
add_tpu_function_alias
|
Whether to add TPU function alias so that it can be converted to a TPU compatible saved model later. Default is False. |