Skip to content

Commit

Permalink
Support static graph code-gen for yolo_box (#52714)
Browse files Browse the repository at this point in the history
* Support static graph code-gen for yolo_box

* Support static graph code-gen for yolo_box

* Support static graph code-gen for yolo_box

* Update op_compat.yaml

* fix

* fix
  • Loading branch information
sanbuphy authored Apr 13, 2023
1 parent 5664ea2 commit 9bdf7f0
Show file tree
Hide file tree
Showing 7 changed files with 26 additions and 315 deletions.
2 changes: 0 additions & 2 deletions paddle/fluid/operators/detection/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -36,13 +36,11 @@ if(WITH_XPU)
detection_library(iou_similarity_op SRCS iou_similarity_op.cc
iou_similarity_op_xpu.cc)
detection_library(prior_box_op SRCS prior_box_op.cc)
detection_library(yolo_box_op SRCS yolo_box_op.cc)
detection_library(generate_proposals_v2_op SRCS generate_proposals_v2_op.cc)
else()
detection_library(iou_similarity_op SRCS iou_similarity_op.cc
iou_similarity_op.cu)
detection_library(prior_box_op SRCS prior_box_op.cc)
detection_library(yolo_box_op SRCS yolo_box_op.cc)
# detection_library(generate_proposals_v2_op SRCS generate_proposals_v2_op.cc)
endif()

Expand Down
269 changes: 0 additions & 269 deletions paddle/fluid/operators/detection/yolo_box_op.cc

This file was deleted.

9 changes: 0 additions & 9 deletions paddle/phi/api/yaml/legacy_ops.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1384,15 +1384,6 @@
data_type: x
backward: unpool3d_grad

- op : yolo_box
args : (Tensor x, Tensor img_size, int[] anchors, int class_num, float conf_thresh, int downsample_ratio, bool clip_bbox, float scale_x_y=1.0, bool iou_aware=false, float iou_aware_factor=0.5)
output : Tensor(boxes), Tensor(scores)
infer_meta :
func : YoloBoxInferMeta
kernel :
func : yolo_box
data_type : x

- op : yolo_loss
args : (Tensor x, Tensor gt_box, Tensor gt_label, Tensor gt_score, int[] anchors, int[] anchor_mask, int class_num, float ignore_thresh, int downsample_ratio, bool use_label_smooth=true, float scale_x_y=1.0)
output : Tensor(loss), Tensor(objectness_mask), Tensor(gt_match_mask)
Expand Down
6 changes: 6 additions & 0 deletions paddle/phi/api/yaml/op_compat.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2328,6 +2328,12 @@
extra :
attrs : ['str[] skip_eager_deletion_vars = {}']

- op : yolo_box
inputs :
{x : X, img_size : ImgSize}
outputs :
{boxes : Boxes, scores : Scores}

- op: sigmoid_cross_entropy_with_logits
backward: sigmoid_cross_entropy_with_logits_grad
inputs :
Expand Down
11 changes: 11 additions & 0 deletions paddle/phi/api/yaml/op_version.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -250,3 +250,14 @@
- add_attr : axis
comment : The axis to apply unique. If None, the input will be flattened.
default : std::vector<int>{}

- op : yolo_box
version :
- checkpoint : Upgrade yolo box to add new attribute [iou_aware, iou_aware_factor].
action :
- add_attr : iou_aware
comment : Whether use iou aware.
default : "false"
- add_attr : iou_aware_factor
comment : iou aware factor.
default : 0.5f
9 changes: 9 additions & 0 deletions paddle/phi/api/yaml/ops.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2028,3 +2028,12 @@
kernel :
func : where
backward : where_grad

- op : yolo_box
args : (Tensor x, Tensor img_size, int[] anchors={}, int class_num = 1, float conf_thresh = 0.01, int downsample_ratio = 32, bool clip_bbox = true, float scale_x_y=1.0, bool iou_aware=false, float iou_aware_factor=0.5)
output : Tensor(boxes), Tensor(scores)
infer_meta :
func : YoloBoxInferMeta
kernel :
func : yolo_box
data_type : x
35 changes: 0 additions & 35 deletions paddle/phi/ops/compat/yolo_box_sig.cc

This file was deleted.

0 comments on commit 9bdf7f0

Please sign in to comment.