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.

fsrdetectionoutput_ops.h 3.9 kB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  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_FSRDETECTIONOUTPUT_OPS_H_
  17. #define GE_OP_FSRDETECTIONOUTPUT_OPS_H_
  18. #include "graph/operator_reg.h"
  19. namespace ge {
  20. /**
  21. *@brief Returns detection result.
  22. *@par Inputs:
  23. * Four inputs, including:
  24. *@li rois: An NCHW tensor of type floa16 or float32, output from operator proposal_d at the preceding layer, used as the input of operator FSRDetectionOutput.
  25. *@li prior_box: An NCHWC0 tensor of type floa16 or float32, specifying the prediction offset, used to update the coordinates [x1, y1, x2, y2] of each ROI.
  26. *@li score: An NCHWC0 tensor of type floa16 or float32, specifying the probability of each class. Class 0 is the background class.
  27. *@li actual_rois_num: An NCHW tensor of type int32, specifying the number of valid boxes per batch.
  28. *@par Attributes:
  29. *@li batch_rois: An optional int32, specifying the number of images to be predicted. Defaults to "1024". The value range is [1, 1024].
  30. *@li im_info: An optional list of two ints. Defaults to (375, 1024). The value range is [1, 1024].
  31. *@li num_classes: An optional int32, specifying the number of classes to be predicted. Defaults to "80". The value must be greater than 0.
  32. *@li max_rois_num: An optional int32, specifying the maximum number of ROIs per batch. Defaults to "1024". The value must be a multiple of 16.
  33. *@li score_thresh: An optional float32, specifying the threshold for box filtering. Defaults to 0.45. The value range is [0.0, 1.0].
  34. *@li nms_thresh: An optional float32, specifying the confidence threshold for box filtering, which is the output "obj" of operator Region. Defaults to 0.7. The value range is (0.0, 1.0).
  35. *@li bbox_reg_weights: An optional list of four ints. Defaults to (1, 1, 1, 1). Must not have value "0".
  36. *@li post_nms_topn: An optional int, specifying the number of output boxes. Defaults to "304". The value must be less than or equal to 1024 and must be a multiple of 16.
  37. *@li kernel_name: An optional string, specifying the operator name. Defaults to "fsr_detection_output".
  38. *@par Outputs:
  39. *box: An NCHW tensor of type float16, describing the information of each output box, including the coordinates, class, and confidence.
  40. *actual_bbox_num: An NCHW tensor of type int32, specifying the number of output boxes.
  41. *@attention Constraints:\n
  42. *@li totalnum < max_rois_num * batch_rois.
  43. *@li "score" must be with shape (total_num, (num_classes+15)//16, 1, 1, 16), where "total_num" indicates the number of valid input boxes of all images.
  44. *@li "prior_box" must be with shape (total_num, (num_classes*4+15)//16, 1, 1, 16), where "total_num" indicates the number of valid input boxes of all images.
  45. */
  46. REG_OP(FSRDetectionOutput)
  47. .INPUT(rois, TensorType({DT_FLOAT, DT_FLOAT16}))
  48. .INPUT(prior_box, TensorType({DT_FLOAT, DT_FLOAT16}))
  49. .INPUT(score, TensorType({DT_FLOAT, DT_FLOAT16}))
  50. .INPUT(actual_rois_num, TensorType({DT_INT32}))
  51. .OUTPUT(actual_bbox_num, TensorType({DT_INT32}))
  52. .OUTPUT(box, TensorType({DT_FLOAT, DT_FLOAT16}))
  53. .ATTR(batch_rois, Int, 1024)
  54. .ATTR(im_info, ListInt, {375,1024})
  55. .ATTR(num_classes, Int, 80)
  56. .ATTR(max_rois_num, Int, 1024)
  57. .ATTR(score_thresh, Float, 0.45)
  58. .ATTR(nms_thresh, Float, 0.7)
  59. .ATTR(bbox_reg_weights, ListInt, {1,1,1,1})
  60. .ATTR(post_nms_topn, Int, 304)
  61. .OP_END_FACTORY_REG(FSRDetectionOutput)
  62. }
  63. #endif

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