コード例 #1
0
ファイル: oaho_train.py プロジェクト: lwohlhart/oaho
 def _export_model(self, estimator: tf.estimator.Estimator,
                   save_location: str) -> None:
     """
     Used to export your model in a format that can be used with
     Tf.Serving
     :param estimator: your estimator function
     """
     # this should match the input shape of your model
     # TODO: update this to your input used in prediction/serving
     x1 = tf.feature_column.numeric_column("input", shape=[480, 640, 1])
     # create a list in case you have more than one input
     feature_columns = [x1]
     feature_spec = tf.feature_column.make_parse_example_spec(
         feature_columns)
     export_input_fn = tf.estimator.export.build_parsing_serving_input_receiver_fn(
         feature_spec)
     # export the saved model
     estimator.export_savedmodel(save_location, export_input_fn)
コード例 #2
0
 def _export_model(self, estimator: tf.estimator.Estimator,
                   save_location: str) -> None:
     """
     Used to export your model in a format that can be used with
     Tf.Serving
     :param estimator: your estimator function
     """
     # this should match the input shape of your model
     x1 = tf.feature_column.numeric_column(
         "input",
         shape=[
             self.config["train_batch_size"], conf.c_maxnum, conf.c_maxlen
         ])
     # create a list in case you have more than one input
     ## feature_columns = [x1]
     feature_columns = x1
     feature_spec = tf.feature_column.make_parse_example_spec(
         feature_columns)
     export_input_fn = tf.estimator.export.build_parsing_serving_input_receiver_fn(
         feature_spec)
     # export the saved model
     estimator.export_savedmodel(save_location, export_input_fn)