@@ -35,6 +35,7 @@ class IOUSimilarityOp : public framework::OperatorWithKernel {
35
35
PADDLE_ENFORCE_EQ (y_dims.size (), 2UL , " The rank of Input(Y) must be 2." );
36
36
PADDLE_ENFORCE_EQ (y_dims[1 ], 4UL , " The shape of Y is [M, 4]" );
37
37
38
+ ctx->ShareLoD (" X" , /* ->*/ " Out" );
38
39
ctx->SetOutputDim (" Out" , framework::make_ddim ({x_dims[0 ], y_dims[0 ]}));
39
40
}
40
41
};
@@ -47,29 +48,32 @@ class IOUSimilarityOpMaker : public framework::OpProtoAndCheckerMaker {
47
48
" (LoDTensor, default LoDTensor<float>) "
48
49
" Box list X is a 2-D LoDTensor with shape [N, 4] holds N boxes, "
49
50
" each box is represented as [xmin, ymin, xmax, ymax], "
50
- " the shape of X is [N, 4]. [xmin, ymin] is the lower left "
51
- " coordinate of the box, and [xmax, ymax] is the right upper "
52
- " coordinate of the box.This tensor can contain LoD information "
53
- " to represent a batch of inputs. One instance of this batch can "
54
- " contain different numbers of entities." );
51
+ " the shape of X is [N, 4]. [xmin, ymin] is the left top "
52
+ " coordinate of the box if the input is image feature map, they "
53
+ " are close to the origin of the coordinate system. "
54
+ " [xmax, ymax] is the right bottom coordinate of the box. "
55
+ " This tensor can contain LoD information to represent a batch "
56
+ " of inputs. One instance of this batch can contain different "
57
+ " numbers of entities." );
55
58
AddInput (" Y" ,
56
59
" (Tensor, default Tensor<float>) "
57
- " Box list Y holds M boxes, each box is "
58
- " represented as [xmin, ymin, xmax, ymax], the shape of X is [N, "
59
- " 4]. [xmin, ymin] is the lower left coordinate of the box, and "
60
- " [xmax, ymax] is the right upper coordinate of the box." );
60
+ " Box list Y holds M boxes, each box is represented as "
61
+ " [xmin, ymin, xmax, ymax], the shape of X is [N, 4]. "
62
+ " [xmin, ymin] is the left top coordinate of the box if the "
63
+ " input is image feature map, and [xmax, ymax] is the right "
64
+ " bottom coordinate of the box." );
61
65
62
66
AddOutput (" Out" ,
63
- " (LoDTensor or Tensor , the lod is same as input X) The output of "
67
+ " (LoDTensor, the lod is same as input X) The output of "
64
68
" iou_similarity op, a tensor with shape [N, M] "
65
69
" representing pairwise iou scores." );
66
70
67
71
AddComment (R"DOC(
68
72
IOU Similarity Operator.
69
73
Computes intersection-over-union (IOU) between two box lists.
70
74
Box list 'X' should be a LoDTensor and 'Y' is a common Tensor,
71
- boxes in 'Y' are shared by all input images .
72
- Given two box A and B, the calculation of IOU is as follows:
75
+ boxes in 'Y' are shared by all instance of the batched inputs of X .
76
+ Given two boxes A and B, the calculation of IOU is as follows:
73
77
74
78
$$
75
79
IOU(A, B) =
0 commit comments