#include "mediapipe/tasks/cc/metadata/metadata_extractor.h"
#include <string>
#include "absl/cleanup/cleanup.h"
#include "absl/memory/memory.h"
#include "absl/status/status.h"
#include "absl/strings/match.h"
#include "absl/strings/str_cat.h"
#include "absl/strings/str_format.h"
#include "absl/strings/string_view.h"
#include "flatbuffers/flatbuffers.h"
#include "mediapipe/framework/port/status_macros.h"
#include "mediapipe/tasks/cc/common.h"
#include "mediapipe/tasks/cc/metadata/metadata_parser.h"
#include "mediapipe/tasks/cc/metadata/metadata_version_utils.h"
#include "mediapipe/tasks/cc/metadata/utils/zip_utils.h"
#include "mediapipe/tasks/metadata/metadata_schema_generated.h"
#include "tensorflow/lite/schema/schema_generated.h"
namespace mediapipe {
namespace tasks {
namespace metadata {
namespace {
constexpr char kMetadataBufferName[] = …;
StatusCode;
Offset;
Vector;
CreateStatusWithPayload;
MediaPipeTasksStatus;
TensorMetadata;
template <typename T>
const T* GetItemFromVector(
const flatbuffers::Vector<flatbuffers::Offset<T>>* src_vector, int index) { … }
}
absl::StatusOr<std::unique_ptr<ModelMetadataExtractor>>
ModelMetadataExtractor::CreateFromModelBuffer(const char* buffer_data,
size_t buffer_size) { … }
absl::StatusOr<const tflite::ProcessUnit*>
ModelMetadataExtractor::FindFirstProcessUnit(
const tflite::TensorMetadata& tensor_metadata,
tflite::ProcessUnitOptions type) { … }
std::string ModelMetadataExtractor::FindFirstAssociatedFileName(
const tflite::TensorMetadata& tensor_metadata,
tflite::AssociatedFileType type, absl::string_view locale) { … }
absl::Status ModelMetadataExtractor::InitFromModelBuffer(
const char* buffer_data, size_t buffer_size) { … }
absl::Status ModelMetadataExtractor::ExtractAssociatedFiles(
const char* buffer_data, size_t buffer_size) { … }
absl::StatusOr<absl::string_view> ModelMetadataExtractor::GetAssociatedFile(
const std::string& filename) const { … }
absl::StatusOr<std::string> ModelMetadataExtractor::GetModelVersion() const { … }
const flatbuffers::Vector<flatbuffers::Offset<tflite::TensorMetadata>>*
ModelMetadataExtractor::GetInputTensorMetadata() const { … }
const tflite::TensorMetadata* ModelMetadataExtractor::GetInputTensorMetadata(
int index) const { … }
int ModelMetadataExtractor::GetInputTensorCount() const { … }
const Vector<Offset<TensorMetadata>>*
ModelMetadataExtractor::GetOutputTensorMetadata() const { … }
const tflite::TensorMetadata* ModelMetadataExtractor::GetOutputTensorMetadata(
int index) const { … }
int ModelMetadataExtractor::GetOutputTensorCount() const { … }
const Vector<flatbuffers::Offset<tflite::ProcessUnit>>*
ModelMetadataExtractor::GetInputProcessUnits() const { … }
const tflite::ProcessUnit* ModelMetadataExtractor::GetInputProcessUnit(
int index) const { … }
int ModelMetadataExtractor::GetInputProcessUnitsCount() const { … }
const Vector<flatbuffers::Offset<tflite::ProcessUnit>>*
ModelMetadataExtractor::GetOutputProcessUnits() const { … }
const tflite::ProcessUnit* ModelMetadataExtractor::GetOutputProcessUnit(
int index) const { … }
int ModelMetadataExtractor::GetOutputProcessUnitsCount() const { … }
const flatbuffers::Vector<flatbuffers::Offset<tflite::CustomMetadata>>*
ModelMetadataExtractor::GetCustomMetadataList() const { … }
const tflite::CustomMetadata* ModelMetadataExtractor::GetCustomMetadata(
int index) const { … }
int ModelMetadataExtractor::GetCustomMetadataCount() const { … }
}
}
}