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.

ssddetectionoutput_ops.h 3.3 kB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  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_SSDDETECTIONOUTPUT_OPS_H_
  17. #define GE_OP_SSDDETECTIONOUTPUT_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 mbox_conf: An ND tensor of type floa16 or float32, specifying the box confidences data, used as the input of operator SSDDetectionOutput.
  25. *@li mbox_loc: An ND tensor of type floa16 or float32, specifying the box loc predictions, used as the input of operator SSDDetectionOutput.
  26. *@li mbox_priorbox: An ND tensor of type floa16 or float32, output from operator PriorBoxD, used as the input of operator SSDDetectionOutput.
  27. *@par Attributes:
  28. *@li num_classes: An optional int32, specifying the number of classes to be predicted. Defaults to "2". The value must be greater than 1 and lesser than 1025.
  29. *@li share_location: An option bool, specify the shared location. Defaults to True
  30. *@li background_label_id: An option int32, specify the background label id. Must be 0
  31. *@li nms_threshold: An option float32, specify the nms threshold
  32. *@li top_k: An option int32, specify the topk value. Defaults to 200
  33. *@li eta: An option float32, specify the eta value. Defaults to 1
  34. *@li variance_encoded_in_target: An option bool, specify whether variance encoded in target or not. Defaults to False
  35. *@li code_type: An option int32, specify the code type. Defaults to 1(only supports 2). The corner is 1, center_size is 2, corner_size is 3
  36. *@li keep_top_k: An option int32, specify the topk value after nms. Defaults to -1
  37. *@li confidence_threshold: An option float32, specify the topk filter threshold. Only consider detections with confidence greater than the threshold
  38. *@li kernel_name: An optional string, specifying the operator name. Defaults to "ssd_detection_output".
  39. *@par Outputs:
  40. *out_boxnum: An NCHW tensor of type int32, specifying the number of output boxes.
  41. *y: An NCHW tensor of type float16, describing the information of each output box, including the coordinates, class, and confidence.
  42. */
  43. REG_OP(SSDDetectionOutput)
  44. .INPUT(bbox_delta, TensorType({DT_FLOAT, DT_FLOAT16}))
  45. .INPUT(score, TensorType({DT_FLOAT, DT_FLOAT16}))
  46. .INPUT(anchors, TensorType({DT_FLOAT, DT_FLOAT16}))
  47. .OUTPUT(out_boxnum, TensorType({DT_INT32}))
  48. .OUTPUT(y, TensorType({DT_FLOAT, DT_FLOAT16}))
  49. .ATTR(num_classes, Int, 2)
  50. .ATTR(share_location, Bool, true)
  51. .ATTR(background_label_id, Int, 0)
  52. .ATTR(iou_threshold, Float, 0.3)
  53. .ATTR(top_k, Int, 200)
  54. .ATTR(eta, Float, 1.0)
  55. .ATTR(variance_encoded_in_target, Bool, false)
  56. .ATTR(code_type, Int, 1)
  57. .ATTR(keep_top_k, Int, -1)
  58. .ATTR(confidence_threshold, Float, 0.0)
  59. .OP_END_FACTORY_REG(SSDDetectionOutput)
  60. }
  61. #endif

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