plugin  0.1.0
detection_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 <string>
21 #include <vector>
22 
23 #include "models/image_model.h"
24 
25 class DetectionModel : public ImageModel {
26 public:
36  DetectionModel(const std::string& modelFileName,
37  float confidenceThreshold,
38  bool useAutoResize,
39  const std::vector<std::string>& labels,
40  const std::string& layout = "");
41 
42  static std::vector<std::string> loadLabels(const std::string& labelFilename);
43 
44 protected:
45  float confidenceThreshold;
46  std::vector<std::string> labels;
47 
48  std::string getLabelName(size_t labelID) {
49  return labelID < labels.size() ? labels[labelID] : std::string("Label #") + std::to_string(labelID);
50  }
51 };
Definition: detection_model.h:25
DetectionModel(const std::string &modelFileName, float confidenceThreshold, bool useAutoResize, const std::vector< std::string > &labels, const std::string &layout="")
Definition: detection_model.cpp:26
Definition: image_model.h:32