• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /**
2  * Copyright 2020 Huawei Technologies Co., Ltd
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 #ifndef MINDSPORE_CORE_OPS_NON_MAX_SUPPRESSION_H_
18 #define MINDSPORE_CORE_OPS_NON_MAX_SUPPRESSION_H_
19 
20 #include <map>
21 #include <vector>
22 #include <string>
23 #include <memory>
24 #include <algorithm>
25 #include "ops/op_utils.h"
26 #include "ops/primitive_c.h"
27 #include "abstract/primitive_infer_map.h"
28 #include "abstract/abstract_value.h"
29 #include "utils/check_convert_utils.h"
30 
31 namespace mindspore {
32 namespace ops {
33 constexpr auto kNameNonMaxSuppression = "NonMaxSuppression";
34 /// \brief NonMaxSuppression QuantDTypeCast the NonMaxSuppression operator prototype.
35 class MS_CORE_API NonMaxSuppression : public PrimitiveC {
36  public:
37   /// \brief Constructor.
NonMaxSuppression()38   NonMaxSuppression() : PrimitiveC(kNameNonMaxSuppression) {}
39 
40   /// \brief Destructor.
41   ~NonMaxSuppression() = default;
42 
43   MS_DECLARE_PARENT(NonMaxSuppression, PrimitiveC);
44 
45   /// \brief Method to init the op's attributes.
46   ///
47   /// \param[in] center_point_box Define a value to indicate the format of the box data. If the value is 0, the box data
48   ///            is supplied by diagonal point, such as [y1, x1, y2, x2](the pair [y1, x1] is picture coordinate). If
49   ///            the value is 1, the box data is supplied as [x_center, y_center, width, height].
50   void Init(const int64_t center_point_box = 0);
51 
52   /// \brief Method to set center_point_box attribute.
53   ///
54   /// \param[in] center_point_box a value to indicate the format of the box data.
55   void set_center_point_box(const int64_t center_point_box);
56 
57   /// \brief Method to get center_point_box attribute.
58   ///
59   /// \return a integer value.
60   int64_t get_center_point_box() const;
61 };
62 AbstractBasePtr NonMaxSuppressionInfer(const abstract::AnalysisEnginePtr &, const PrimitivePtr &primitive,
63                                        const std::vector<AbstractBasePtr> &input_args);
64 using PrimNonMaxSuppressionPtr = std::shared_ptr<NonMaxSuppression>;
65 }  // namespace ops
66 }  // namespace mindspore
67 
68 #endif  // MINDSPORE_CORE_OPS_NON_MAX_SUPPRESSION_H_
69