|
| 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 | +#ifndef TENSORFLOW_LITE_SUPPORT_C_TASK_PROCESSOR_CATEGORY_H_ |
| 16 | +#define TENSORFLOW_LITE_SUPPORT_C_TASK_PROCESSOR_CATEGORY_H_ |
| 17 | + |
| 18 | +// Defines C structure for a Category which encapsulates a single predicted |
| 19 | +// class. |
| 20 | + |
| 21 | +#ifdef __cplusplus |
| 22 | +extern "C" { |
| 23 | +#endif // __cplusplus |
| 24 | + |
| 25 | +// A single predicted class. |
| 26 | +typedef struct TfLiteCategory { |
| 27 | + // The index of the class in the corresponding label map, usually packed in |
| 28 | + // the TFLite Model Metadata [1]. |
| 29 | + // |
| 30 | + // [1]: https://www.tensorflow.org/lite/convert/metadata |
| 31 | + int index; |
| 32 | + |
| 33 | + // The score for this class e.g. (but not necessarily) a probability in [0,1]. |
| 34 | + float score; |
| 35 | + |
| 36 | + // A human readable name of the class filled from the label map. |
| 37 | + char* display_name; |
| 38 | + // An ID for the class, not necessarily human-readable (e.g. a Google |
| 39 | + // Knowledge Graph ID [1]), filled from the label map. |
| 40 | + // |
| 41 | + // [1]: https://developers.google.com/knowledge-graph |
| 42 | + char* label; |
| 43 | +} TfLiteCategory; |
| 44 | + |
| 45 | +#ifdef __cplusplus |
| 46 | +} // extern "C" |
| 47 | +#endif // __cplusplus |
| 48 | + |
| 49 | +#endif // TENSORFLOW_LITE_SUPPORT_C_TASK_VISION_CATEGORY_H_ |
0 commit comments