plugin  0.1.0
detection_model_ssd.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/detection_model.h"
25 
26 namespace ov {
27 class InferRequest;
28 class Model;
29 } // namespace ov
30 struct InferenceResult;
31 struct InputData;
32 struct InternalModelData;
33 struct ResultBase;
34 
35 class ModelSSD : public DetectionModel {
36 public:
46  ModelSSD(const std::string& modelFileName,
47  float confidenceThreshold,
48  bool useAutoResize,
49  const std::vector<std::string>& labels = std::vector<std::string>(),
50  const std::string& layout = "");
51 
52  std::shared_ptr<InternalModelData> preprocess(const InputData& inputData, ov::InferRequest& request) override;
53  std::unique_ptr<ResultBase> postprocess(InferenceResult& infResult) override;
54 
55 protected:
56  std::unique_ptr<ResultBase> postprocessSingleOutput(InferenceResult& infResult);
57  std::unique_ptr<ResultBase> postprocessMultipleOutputs(InferenceResult& infResult);
58  void prepareInputsOutputs(std::shared_ptr<ov::Model>& model) override;
59  void prepareSingleOutput(std::shared_ptr<ov::Model>& model);
60  void prepareMultipleOutputs(std::shared_ptr<ov::Model>& model);
61  size_t objectSize = 0;
62  size_t detectionsNumId = 0;
63 };
Definition: detection_model.h:25
Definition: detection_model_ssd.h:35
ModelSSD(const std::string &modelFileName, float confidenceThreshold, bool useAutoResize, const std::vector< std::string > &labels=std::vector< std::string >(), const std::string &layout="")
Definition: detection_model_ssd.cpp:36
std::unique_ptr< ResultBase > postprocessMultipleOutputs(InferenceResult &infResult)
Definition: detection_model_ssd.cpp:108
std::unique_ptr< ResultBase > postprocessSingleOutput(InferenceResult &infResult)
Definition: detection_model_ssd.cpp:60
Definition: results.h:53
Definition: input_data.h:20
Definition: internal_model_data.h:19
Definition: results.h:29