Skip to content

Commit 6d092af

Browse files
committed
proto for input options.
1 parent 7795db9 commit 6d092af

File tree

3 files changed

+120
-0
lines changed

3 files changed

+120
-0
lines changed

tensorflow_lite_support/cc/task/vision/proto/BUILD

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -242,3 +242,31 @@ cc_library(
242242
hdrs = ["embeddings_proto_inc.h"],
243243
deps = [":embeddings_cc_proto"],
244244
)
245+
246+
# ImageTransformer protos.
247+
248+
proto_library(
249+
name = "image_transformer_options_proto",
250+
srcs = ["image_transformer_options.proto"],
251+
deps = [
252+
"//tensorflow_lite_support/cc/task/core/proto:base_options_proto",
253+
"//tensorflow_lite_support/cc/task/core/proto:external_file_proto",
254+
"@org_tensorflow//tensorflow/lite/experimental/acceleration/configuration:configuration_proto",
255+
],
256+
)
257+
258+
cc_proto_library(
259+
name = "image_transformer_options_cc_proto",
260+
deps = [
261+
":image_transformer_options_proto",
262+
],
263+
)
264+
265+
cc_library(
266+
name = "image_transformer_options_proto_inc",
267+
hdrs = ["image_transformer_options_proto_inc.h"],
268+
deps = [
269+
":image_transformer_options_cc_proto",
270+
"//tensorflow_lite_support/cc/task/core/proto:external_file_proto_inc",
271+
],
272+
)
Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
/* Copyright 2021 The TensorFlow Authors. All Rights Reserved.
2+
3+
Licensed under the Apache License, Version 2.0 (the "License");
4+
you may not use this file except in compliance with the License.
5+
You may obtain a copy of the License at
6+
7+
http://www.apache.org/licenses/LICENSE-2.0
8+
9+
Unless required by applicable law or agreed to in writing, software
10+
distributed under the License is distributed on an "AS IS" BASIS,
11+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
See the License for the specific language governing permissions and
13+
limitations under the License.
14+
==============================================================================*/
15+
16+
syntax = "proto2";
17+
18+
package tflite.task.vision;
19+
20+
import "tensorflow/lite/experimental/acceleration/configuration/configuration.proto";
21+
import "tensorflow_lite_support/cc/task/core/proto/base_options.proto";
22+
import "tensorflow_lite_support/cc/task/core/proto/external_file.proto";
23+
24+
// Options for setting up an ObjectDetector.
25+
// Next Id: 10.
26+
message ImageTransformerOptions {
27+
// Base options for configuring Task library, such as specifying the TfLite
28+
// model file with metadata, accelerator options, etc.
29+
optional tflite.task.core.BaseOptions base_options = 9;
30+
31+
// Legacy method for specifying the TFLite model file, as a single standalone
32+
// TFLite file packed with TFLite Model Metadata [1]. Those are mandatory, and
33+
// used to populate e.g. the label map and recommended score threshold.
34+
//
35+
// [1]: https://www.tensorflow.org/lite/convert/metadata
36+
//
37+
// Deprecated: prefer using `base_options.model_file`, which is mutually
38+
// exclusive with this field.
39+
optional core.ExternalFile model_file_with_metadata = 1;
40+
41+
// Legacy method for specifying the number of threads to be used for TFLite
42+
// ops that support multi-threading when running inference with CPU.
43+
// num_threads should be greater than 0 or equal to -1. Setting num_threads to
44+
// -1 has the effect to let TFLite runtime set the value.
45+
//
46+
// Deprecated: only works with `model_file_with_metadata`. Prefer using
47+
// `base_options` to specifying the TFLite model and using
48+
// `base_options.compute_settings.tflite_settings.cpu_settings.num_threads`,
49+
// to configure the number of threads.
50+
optional int32 num_threads = 7 [default = -1];
51+
52+
// Legacy method for specifying how to accelerate the model
53+
// inference using dedicated delegates. Supported delegate type includes:
54+
// NONE, NNAPI, GPU, HEXAGON, XNNPACK, EDGETPU (Google internal),
55+
// and EDGETPU_CORAL.
56+
//
57+
// IMPORTANT: in order to use a delegate, the appropriate delegate plugin
58+
// needs to be linked at build time. See comment above the "object_detector"
59+
// target at:
60+
// https://github.com/tensorflow/tflite-support/blob/master/tensorflow_lite_support/cc/task/vision/BUILD
61+
//
62+
// See settings definition at:
63+
// https://github.com/tensorflow/tensorflow/blob/master/tensorflow/lite/experimental/acceleration/configuration/configuration.proto
64+
//
65+
// Deprecated: only works with `model_file_with_metadata`. Prefer using
66+
// `base_options` to specifying the TFLite model and using
67+
// `base_options.compute_settings` to configure acceleration options.
68+
optional tflite.proto.ComputeSettings compute_settings = 8;
69+
}
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
/* Copyright 2021 The TensorFlow Authors. All Rights Reserved.
2+
3+
Licensed under the Apache License, Version 2.0 (the "License");
4+
you may not use this file except in compliance with the License.
5+
You may obtain a copy of the License at
6+
7+
http://www.apache.org/licenses/LICENSE-2.0
8+
9+
Unless required by applicable law or agreed to in writing, software
10+
distributed under the License is distributed on an "AS IS" BASIS,
11+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
See the License for the specific language governing permissions and
13+
limitations under the License.
14+
==============================================================================*/
15+
16+
#ifndef TENSORFLOW_LITE_SUPPORT_CC_TASK_VISION_PROTO_IMAGE_TRANSFORMER_OPTIONS_PROTO_INC_H_
17+
#define TENSORFLOW_LITE_SUPPORT_CC_TASK_VISION_PROTO_IMAGE_TRANSFORMER_OPTIONS_PROTO_INC_H_
18+
19+
#include "tensorflow_lite_support/cc/task/core/proto/base_options_proto_inc.h"
20+
#include "tensorflow_lite_support/cc/task/core/proto/external_file_proto_inc.h"
21+
22+
#include "tensorflow_lite_support/cc/task/vision/proto/image_transformer_options.pb.h"
23+
#endif // TENSORFLOW_LITE_SUPPORT_CC_TASK_VISION_PROTO_IMAGE_TRANSFORMER_OPTIONS_PROTO_INC_H_

0 commit comments

Comments
 (0)