plugin  0.1.0
classification_model.h
1 /*
2 // Copyright (C) 2020-2024 Intel Corporation
3 //
4 // Licensed under the Apache License, Version 2.0 (the "License");
5 // you may not use this file except in compliance with the License.
6 // You may obtain a copy of the License at
7 //
8 // http://www.apache.org/licenses/LICENSE-2.0
9 //
10 // Unless required by applicable law or agreed to in writing, software
11 // distributed under the License is distributed on an "AS IS" BASIS,
12 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 // See the License for the specific language governing permissions and
14 // limitations under the License.
15 */
16 
17 #pragma once
18 #include <stddef.h>
19 
20 #include <memory>
21 #include <string>
22 #include <vector>
23 
24 #include "models/image_model.h"
25 
26 namespace ov {
27 class Model;
28 } // namespace ov
29 struct InferenceResult;
30 struct ResultBase;
31 
33 public:
42  ClassificationModel(const std::string& modelFileName,
43  size_t nTop,
44  bool useAutoResize,
45  const std::vector<std::string>& labels,
46  const std::string& layout = "");
47 
48  std::unique_ptr<ResultBase> postprocess(InferenceResult& infResult) override;
49 
50  static std::vector<std::string> loadLabels(const std::string& labelFilename);
51 
52 protected:
53  size_t nTop;
54  std::vector<std::string> labels;
55 
56  void prepareInputsOutputs(std::shared_ptr<ov::Model>& model) override;
57 };
Definition: classification_model.h:32
ClassificationModel(const std::string &modelFileName, size_t nTop, bool useAutoResize, const std::vector< std::string > &labels, const std::string &layout="")
Definition: classification_model.cpp:36
Definition: image_model.h:32
Definition: results.h:53
Definition: results.h:29