|
|
@ -65,7 +65,7 @@ def rpn_target_assign(bbox_pred,
|
|
|
|
rpn_negative_overlap=0.3,
|
|
|
|
rpn_negative_overlap=0.3,
|
|
|
|
use_random=True):
|
|
|
|
use_random=True):
|
|
|
|
"""
|
|
|
|
"""
|
|
|
|
** Target Assign Layer for region proposal network (RPN) in Faster-RCNN detection. **
|
|
|
|
**Target Assign Layer for region proposal network (RPN) in Faster-RCNN detection.**
|
|
|
|
|
|
|
|
|
|
|
|
This layer can be, for given the Intersection-over-Union (IoU) overlap
|
|
|
|
This layer can be, for given the Intersection-over-Union (IoU) overlap
|
|
|
|
between anchors and ground truth boxes, to assign classification and
|
|
|
|
between anchors and ground truth boxes, to assign classification and
|
|
|
@ -148,6 +148,7 @@ def rpn_target_assign(bbox_pred,
|
|
|
|
cls_logits=cls_logits,
|
|
|
|
cls_logits=cls_logits,
|
|
|
|
anchor_box=anchor_box,
|
|
|
|
anchor_box=anchor_box,
|
|
|
|
gt_boxes=gt_boxes)
|
|
|
|
gt_boxes=gt_boxes)
|
|
|
|
|
|
|
|
|
|
|
|
"""
|
|
|
|
"""
|
|
|
|
|
|
|
|
|
|
|
|
helper = LayerHelper('rpn_target_assign', **locals())
|
|
|
|
helper = LayerHelper('rpn_target_assign', **locals())
|
|
|
@ -1525,20 +1526,23 @@ def anchor_generator(input,
|
|
|
|
anchors, e.g. [0.5, 1.0, 2.0].
|
|
|
|
anchors, e.g. [0.5, 1.0, 2.0].
|
|
|
|
variance(list|tuple): The variances to be used in box regression deltas.
|
|
|
|
variance(list|tuple): The variances to be used in box regression deltas.
|
|
|
|
Default:[0.1, 0.1, 0.2, 0.2].
|
|
|
|
Default:[0.1, 0.1, 0.2, 0.2].
|
|
|
|
stride(list|turple): The anchors stride across width and height,
|
|
|
|
stride(list|turple): The anchors stride across width and height,e.g. [16.0, 16.0]
|
|
|
|
e.g. [16.0, 16.0]
|
|
|
|
|
|
|
|
offset(float): Prior boxes center offset. Default: 0.5
|
|
|
|
offset(float): Prior boxes center offset. Default: 0.5
|
|
|
|
name(str): Name of the prior box op. Default: None.
|
|
|
|
name(str): Name of the prior box op. Default: None.
|
|
|
|
|
|
|
|
|
|
|
|
Returns:
|
|
|
|
Returns:
|
|
|
|
Anchors(Variable): The output anchors with a layout of [H, W, num_anchors, 4].
|
|
|
|
Anchors(Variable),Variances(Variable):
|
|
|
|
H is the height of input, W is the width of input,
|
|
|
|
|
|
|
|
num_anchors is the box count of each position.
|
|
|
|
two variables:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
- Anchors(Variable): The output anchors with a layout of [H, W, num_anchors, 4]. \
|
|
|
|
|
|
|
|
H is the height of input, W is the width of input, \
|
|
|
|
|
|
|
|
num_anchors is the box count of each position. \
|
|
|
|
Each anchor is in (xmin, ymin, xmax, ymax) format an unnormalized.
|
|
|
|
Each anchor is in (xmin, ymin, xmax, ymax) format an unnormalized.
|
|
|
|
Variances(Variable): The expanded variances of anchors
|
|
|
|
- Variances(Variable): The expanded variances of anchors \
|
|
|
|
with a layout of [H, W, num_priors, 4].
|
|
|
|
with a layout of [H, W, num_priors, 4]. \
|
|
|
|
H is the height of input, W is the width of input
|
|
|
|
H is the height of input, W is the width of input \
|
|
|
|
num_anchors is the box count of each position.
|
|
|
|
num_anchors is the box count of each position. \
|
|
|
|
Each variance is in (xcenter, ycenter, w, h) format.
|
|
|
|
Each variance is in (xcenter, ycenter, w, h) format.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -1748,7 +1752,7 @@ def generate_proposals(scores,
|
|
|
|
eta=1.0,
|
|
|
|
eta=1.0,
|
|
|
|
name=None):
|
|
|
|
name=None):
|
|
|
|
"""
|
|
|
|
"""
|
|
|
|
** Generate proposal Faster-RCNN **
|
|
|
|
**Generate proposal Faster-RCNN**
|
|
|
|
|
|
|
|
|
|
|
|
This operation proposes RoIs according to each box with their probability to be a foreground object and
|
|
|
|
This operation proposes RoIs according to each box with their probability to be a foreground object and
|
|
|
|
the box can be calculated by anchors. Bbox_deltais and scores to be an object are the output of RPN. Final proposals
|
|
|
|
the box can be calculated by anchors. Bbox_deltais and scores to be an object are the output of RPN. Final proposals
|
|
|
@ -1762,7 +1766,6 @@ def generate_proposals(scores,
|
|
|
|
4. Remove predicted boxes with small area.
|
|
|
|
4. Remove predicted boxes with small area.
|
|
|
|
5. Apply NMS to get final proposals as output.
|
|
|
|
5. Apply NMS to get final proposals as output.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Args:
|
|
|
|
Args:
|
|
|
|
scores(Variable): A 4-D Tensor with shape [N, A, H, W] represents the probability for each box to be an object.
|
|
|
|
scores(Variable): A 4-D Tensor with shape [N, A, H, W] represents the probability for each box to be an object.
|
|
|
|
N is batch size, A is number of anchors, H and W are height and width of the feature map.
|
|
|
|
N is batch size, A is number of anchors, H and W are height and width of the feature map.
|
|
|
@ -1777,6 +1780,7 @@ def generate_proposals(scores,
|
|
|
|
nms_thresh(float): Threshold in NMS, 0.5 by default.
|
|
|
|
nms_thresh(float): Threshold in NMS, 0.5 by default.
|
|
|
|
min_size(float): Remove predicted boxes with either height or width < min_size. 0.1 by default.
|
|
|
|
min_size(float): Remove predicted boxes with either height or width < min_size. 0.1 by default.
|
|
|
|
eta(float): Apply in adaptive NMS, if adaptive threshold > 0.5, adaptive_threshold = adaptive_threshold * eta in each iteration.
|
|
|
|
eta(float): Apply in adaptive NMS, if adaptive threshold > 0.5, adaptive_threshold = adaptive_threshold * eta in each iteration.
|
|
|
|
|
|
|
|
|
|
|
|
"""
|
|
|
|
"""
|
|
|
|
helper = LayerHelper('generate_proposals', **locals())
|
|
|
|
helper = LayerHelper('generate_proposals', **locals())
|
|
|
|
|
|
|
|
|
|
|
|