1/* Copyright 2020 The TensorFlow Authors. All Rights Reserved. 2 3Licensed under the Apache License, Version 2.0 (the "License"); 4you may not use this file except in compliance with the License. 5You may obtain a copy of the License at 6 7 http://www.apache.org/licenses/LICENSE-2.0 8 9Unless required by applicable law or agreed to in writing, software 10distributed under the License is distributed on an "AS IS" BASIS, 11WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12See the License for the specific language governing permissions and 13limitations under the License. 14==============================================================================*/ 15 16syntax = "proto2"; 17 18package tflite.task.vision; 19 20import "tensorflow_lite_support/cc/task/core/proto/external_file.proto"; 21 22// Options for setting up an ImageClassifier. 23// Next Id: 14 24message ImageClassifierOptions { 25 // The external model file, as a single standalone TFLite file. If it is 26 // packed with TFLite Model Metadata [1], those are used to populate e.g. the 27 // label map, score calibration and recommended score thresholds. Models 28 // without any such metadata or partial metadata are supported, but may result 29 // in the image classifier providing degraded functionality; typically, a 30 // model that doesn't contain any label map won't be able to return any class 31 // or display names but will be limited to returning class indices. 32 // 33 // [1]: https://www.tensorflow.org/lite/convert/metadata 34 optional core.ExternalFile model_file_with_metadata = 10; 35 36 // The locale to use for display names specified through the TFLite Model 37 // Metadata, if any. Defaults to English. 38 optional string display_names_locale = 11 [default = "en"]; 39 40 // The maximum number of top-scored classification results to return. If < 0, 41 // all available results will be returned. If 0, an invalid argument error is 42 // returned. 43 optional int32 max_results = 2 [default = -1]; 44 45 // Score threshold in [0,1), overrides the ones provided in the model metadata 46 // (if any). Results below this value are rejected. 47 optional float score_threshold = 3; 48 49 // Optional whitelist of class names. If non-empty, classifications whose 50 // class name is not in this set will be filtered out. Duplicate or unknown 51 // class names are ignored. Mutually exclusive with class_name_blacklist. 52 repeated string class_name_whitelist = 4; 53 54 // Optional blacklist of class names. If non-empty, classifications whose 55 // class name is in this set will be filtered out. Duplicate or unknown 56 // class names are ignored. Mutually exclusive with class_name_whitelist. 57 repeated string class_name_blacklist = 5; 58 59 // The number of threads to be used for TFLite ops that support 60 // multi-threading when running inference with CPU. 61 // num_threads should be greater than 0 or equal to -1. Setting num_threads to 62 // -1 has the effect to let TFLite runtime set the value. 63 optional int32 num_threads = 13 [default = -1]; 64 65 // Reserved tags. 66 reserved 1, 6, 7, 8, 9, 12; 67} 68