Browse Source

!835 Fixed examples of BoundingBoxEncode and BoundingBoxDecode operators

Merge pull request !835 from lihongkang/master
tags/v0.3.0-alpha
mindspore-ci-bot Gitee 5 years ago
parent
commit
f748d02c05
1 changed files with 12 additions and 2 deletions
  1. +12
    -2
      mindspore/ops/operations/other_ops.py

+ 12
- 2
mindspore/ops/operations/other_ops.py View File

@@ -76,8 +76,13 @@ class BoundingBoxEncode(PrimitiveWithInfer):
Tensor, encoded bounding boxes. Tensor, encoded bounding boxes.


Examples: Examples:
>>> anchor_box = Tensor([[4,1,2,1],[2,2,2,3]],mindspore.float32)
>>> groundtruth_box = Tensor([[3,1,2,2],[1,2,1,4]],mindspore.float32)
>>> boundingbox_encode = P.BoundingBoxEncode(means=(0.0, 0.0, 0.0, 0.0), stds=(1.0, 1.0, 1.0, 1.0)) >>> boundingbox_encode = P.BoundingBoxEncode(means=(0.0, 0.0, 0.0, 0.0), stds=(1.0, 1.0, 1.0, 1.0))
>>> delta_box = boundingbox_encode(anchor_box, groundtruth_box)
>>> boundingbox_encode(anchor_box, groundtruth_box)
[[5.0000000e-01 5.0000000e-01 -6.5504000e+04 6.9335938e-01]
[-1.0000000e+00 2.5000000e-01 0.0000000e+00 4.0551758e-01]]

""" """


@prim_attr_register @prim_attr_register
@@ -118,9 +123,14 @@ class BoundingBoxDecode(PrimitiveWithInfer):
Tensor, decoded boxes. Tensor, decoded boxes.


Examples: Examples:
>>> anchor_box = Tensor([[4,1,2,1],[2,2,2,3]],mindspore.float32)
>>> deltas = Tensor([[3,1,2,2],[1,2,1,4]],mindspore.float32)
>>> boundingbox_decode = P.BoundingBoxDecode(means=(0.0, 0.0, 0.0, 0.0), stds=(1.0, 1.0, 1.0, 1.0), >>> boundingbox_decode = P.BoundingBoxDecode(means=(0.0, 0.0, 0.0, 0.0), stds=(1.0, 1.0, 1.0, 1.0),
>>> max_shape=(768, 1280), wh_ratio_clip=0.016) >>> max_shape=(768, 1280), wh_ratio_clip=0.016)
>>> bbox = boundingbox_decode(anchor_box, deltas)
>>> boundingbox_decode(anchor_box, deltas)
[[4.1953125 0. 0. 5.1953125]
[2.140625 0. 3.859375 60.59375]]

""" """


@prim_attr_register @prim_attr_register


Loading…
Cancel
Save