You can not select more than 25 topics Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long.

nn_detect_ops.h 2.8 kB

5 years ago
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. /**
  2. * Copyright 2019-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. #ifndef GE_OP_NN_DETECT_OPS_H_
  17. #define GE_OP_NN_DETECT_OPS_H_
  18. #include "graph/operator_reg.h"
  19. #include "graph/operator.h"
  20. namespace ge {
  21. REG_OP(BoundingBoxDecode)
  22. .INPUT(rois, TensorType({DT_FLOAT16, DT_FLOAT}))
  23. .INPUT(deltas, TensorType({DT_FLOAT16, DT_FLOAT}))
  24. .OUTPUT(bboxes, TensorType({DT_FLOAT16, DT_FLOAT}))
  25. .ATTR(means, ListFloat, {0.0, 0.0, 0.0, 0.0})
  26. .ATTR(stds, ListFloat, {1.0, 1.0, 1.0, 1.0})
  27. .REQUIRED_ATTR(max_shape, ListInt)
  28. .ATTR(wh_ratio_clip, Float, 0.016)
  29. .OP_END_FACTORY_REG(BoundingBoxDecode)
  30. REG_OP(BoundingBoxEncode)
  31. .INPUT(anchor_box, TensorType({DT_FLOAT16, DT_FLOAT}))
  32. .INPUT(ground_truth_box, TensorType({DT_FLOAT16, DT_FLOAT}))
  33. .OUTPUT(delats, TensorType({DT_FLOAT16, DT_FLOAT}))
  34. .ATTR(means, ListFloat, {0.0, 0.0, 0.0, 0.0})
  35. .ATTR(stds, ListFloat, {1.0, 1.0, 1.0, 1.0})
  36. .OP_END_FACTORY_REG(BoundingBoxEncode)
  37. REG_OP(CheckValid)
  38. .INPUT(bbox_tensor, TensorType({DT_FLOAT16}))
  39. .INPUT(img_metas, TensorType({DT_FLOAT16}))
  40. .OUTPUT(valid_tensor, TensorType({DT_INT8}))
  41. .OP_END_FACTORY_REG(CheckValid)
  42. REG_OP(Iou)
  43. .INPUT(bboxes, TensorType({DT_FLOAT16, DT_FLOAT}))
  44. .INPUT(gtboxes, TensorType({DT_FLOAT16, DT_FLOAT}))
  45. .OUTPUT(overlap, TensorType({DT_FLOAT16, DT_FLOAT}))
  46. .ATTR(mode, String, "iou")
  47. .OP_END_FACTORY_REG(Iou)
  48. REG_OP(ROIAlignGrad)
  49. .INPUT(ydiff, TensorType({DT_FLOAT}))
  50. .INPUT(rois, TensorType({DT_FLOAT}))
  51. .OPTIONAL_INPUT(rois_n, TensorType({DT_INT32}))
  52. .OUTPUT(xdiff, TensorType({DT_FLOAT}))
  53. .REQUIRED_ATTR(xdiff_shape, ListInt)
  54. .REQUIRED_ATTR(pooled_width, Int)
  55. .REQUIRED_ATTR(pooled_height, Int)
  56. .REQUIRED_ATTR(spatial_scale, Float)
  57. .ATTR(sample_num, Int, 2)
  58. .OP_END_FACTORY_REG(ROIAlignGrad)
  59. REG_OP(ROIAlign)
  60. .INPUT(features, TensorType({DT_FLOAT}))
  61. .INPUT(rois, TensorType({DT_FLOAT}))
  62. .OPTIONAL_INPUT(rois_n, TensorType({DT_INT32}))
  63. .OUTPUT(output, TensorType({DT_FLOAT}))
  64. .REQUIRED_ATTR(spatial_scale, Float)
  65. .REQUIRED_ATTR(pooled_height, Int)
  66. .REQUIRED_ATTR(pooled_width, Int)
  67. .ATTR(sample_num, Int, 2)
  68. .OP_END_FACTORY_REG(ROIAlign)
  69. } // namespace ge
  70. #endif // GE_OP_NN_DETECT_OPS_H_

图引擎模块(GE)是MindSpore的一个子模块,其代码由C++实现,位于前端模块ME和底层硬件之间,起到承接作用。图引擎模块以ME下发的图作为输入,然后进行一系列的深度图优化操作,最后输出一张可以在底层硬件上高效运行的图。GE针对昇腾AI处理器的硬件结构特点,做了特定的优化工作,以此来充分发挥出昇腾AI处理器的强大算力。在进行模型训练/推理时,GE会被自动调用而用户并不感知。GE主要由GE API和GE Core两部分组成,详细的架构图如下所示