diff --git a/ppdet/modeling/assigners/atss_assigner.py b/ppdet/modeling/assigners/atss_assigner.py index 4835dd1d563b735a070836b0d18980483dfe0814..43e6ae2abbc03d27819145712f7ac91e5469773a 100644 --- a/ppdet/modeling/assigners/atss_assigner.py +++ b/ppdet/modeling/assigners/atss_assigner.py @@ -79,7 +79,10 @@ class ATSSAssigner(nn.Layer): gt_bboxes, bg_index, gt_scores=None): - r"""The assignment is done in following steps + r"""This code is based on + https://github.com/fcjian/TOOD/blob/master/mmdet/core/bbox/assigners/atss_assigner.py + + The assignment is done in following steps 1. compute iou between all bbox (bbox of all pyramid levels) and gt 2. compute center distance between all bbox and gt 3. on each pyramid level, for each gt, select k bbox whose center diff --git a/ppdet/modeling/assigners/task_aligned_assigner.py b/ppdet/modeling/assigners/task_aligned_assigner.py index bae00cc7cac72289e7c2cb2d7bab65b13737e679..7e31c8afcb360918338aaa377dfc08046af894ab 100644 --- a/ppdet/modeling/assigners/task_aligned_assigner.py +++ b/ppdet/modeling/assigners/task_aligned_assigner.py @@ -47,7 +47,10 @@ class TaskAlignedAssigner(nn.Layer): gt_bboxes, bg_index, gt_scores=None): - r"""The assignment is done in following steps + r"""This code is based on + https://github.com/fcjian/TOOD/blob/master/mmdet/core/bbox/assigners/task_aligned_assigner.py + + The assignment is done in following steps 1. compute alignment metric between all bbox (bbox of all pyramid levels) and gt 2. select top-k bbox as candidates for each gt 3. limit the positive sample's center in gt (because the anchor-free detector diff --git a/ppdet/modeling/heads/detr_head.py b/ppdet/modeling/heads/detr_head.py index 8f4b4ebbfb082318d85deee568a2307443e26edf..6ca3499b9f9f31ea794851c877f7da26acc0601a 100644 --- a/ppdet/modeling/heads/detr_head.py +++ b/ppdet/modeling/heads/detr_head.py @@ -28,6 +28,10 @@ __all__ = ['DETRHead', 'DeformableDETRHead'] class MLP(nn.Layer): + """This code is based on + https://github.com/facebookresearch/detr/blob/main/models/detr.py + """ + def __init__(self, input_dim, hidden_dim, output_dim, num_layers): super().__init__() self.num_layers = num_layers @@ -48,7 +52,11 @@ class MLP(nn.Layer): class MultiHeadAttentionMap(nn.Layer): - """This is a 2D attention module, which only returns the attention softmax (no multiplication by value)""" + """This code is based on + https://github.com/facebookresearch/detr/blob/main/models/segmentation.py + + This is a 2D attention module, which only returns the attention softmax (no multiplication by value) + """ def __init__(self, query_dim, hidden_dim, num_heads, dropout=0.0, bias=True): @@ -94,9 +102,11 @@ class MultiHeadAttentionMap(nn.Layer): class MaskHeadFPNConv(nn.Layer): - """ - Simple convolutional head, using group norm. - Upsampling is done using a FPN approach + """This code is based on + https://github.com/facebookresearch/detr/blob/main/models/segmentation.py + + Simple convolutional head, using group norm. + Upsampling is done using a FPN approach """ def __init__(self, input_dim, fpn_dims, context_dim, num_groups=8): @@ -307,7 +317,7 @@ class DeformableDETRHead(nn.Layer): linear_init_(self.score_head) constant_(self.score_head.bias, -4.595) constant_(self.bbox_head.layers[-1].weight) - + with paddle.no_grad(): bias = paddle.zeros_like(self.bbox_head.layers[-1].bias) bias[2:] = -2.0 diff --git a/ppdet/modeling/heads/tood_head.py b/ppdet/modeling/heads/tood_head.py index b244dfdc00eeffdab6af10b46afe57095fb4f3d7..b9dbd17e36f920d2df7b01d09eb7a461b9d68365 100644 --- a/ppdet/modeling/heads/tood_head.py +++ b/ppdet/modeling/heads/tood_head.py @@ -48,6 +48,10 @@ class ScaleReg(nn.Layer): class TaskDecomposition(nn.Layer): + """This code is based on + https://github.com/fcjian/TOOD/blob/master/mmdet/models/dense_heads/tood_head.py + """ + def __init__( self, feat_channels, @@ -105,6 +109,9 @@ class TaskDecomposition(nn.Layer): @register class TOODHead(nn.Layer): + """This code is based on + https://github.com/fcjian/TOOD/blob/master/mmdet/models/dense_heads/tood_head.py + """ __inject__ = ['nms', 'static_assigner', 'assigner'] __shared__ = ['num_classes'] diff --git a/ppdet/modeling/transformers/deformable_transformer.py b/ppdet/modeling/transformers/deformable_transformer.py index 2ed3ae5f20b116b1292a3d46a4d4271382f9b175..0c2089a8b638838295d7f26efb48782a80cf6903 100644 --- a/ppdet/modeling/transformers/deformable_transformer.py +++ b/ppdet/modeling/transformers/deformable_transformer.py @@ -11,6 +11,9 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. +# +# Modified from Deformable-DETR (https://github.com/fundamentalvision/Deformable-DETR) +# Copyright (c) 2020 SenseTime. All Rights Reserved. from __future__ import absolute_import from __future__ import division diff --git a/ppdet/modeling/transformers/detr_transformer.py b/ppdet/modeling/transformers/detr_transformer.py index 65eb1285561bdbdcf9ccbac824498548d5e63a79..bd513772da1ac3aa7787316660bbda0a8fe4b3cb 100644 --- a/ppdet/modeling/transformers/detr_transformer.py +++ b/ppdet/modeling/transformers/detr_transformer.py @@ -11,6 +11,9 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. +# +# Modified from DETR (https://github.com/facebookresearch/detr) +# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved from __future__ import absolute_import from __future__ import division diff --git a/ppdet/modeling/transformers/matchers.py b/ppdet/modeling/transformers/matchers.py index 6e606ef98c1a34186707be8d318393427e7a9f56..794d8632803c3546123cb595249c3343c6d48fba 100644 --- a/ppdet/modeling/transformers/matchers.py +++ b/ppdet/modeling/transformers/matchers.py @@ -11,6 +11,9 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. +# +# Modified from DETR (https://github.com/facebookresearch/detr) +# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved from __future__ import absolute_import from __future__ import division diff --git a/ppdet/modeling/transformers/position_encoding.py b/ppdet/modeling/transformers/position_encoding.py index 52067ffc89c92a6d0fd88d3f84710ce145453557..e54165918eff04d762ac87eca2c3dc012871215d 100644 --- a/ppdet/modeling/transformers/position_encoding.py +++ b/ppdet/modeling/transformers/position_encoding.py @@ -11,6 +11,9 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. +# +# Modified from DETR (https://github.com/facebookresearch/detr) +# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved from __future__ import absolute_import from __future__ import division diff --git a/ppdet/modeling/transformers/utils.py b/ppdet/modeling/transformers/utils.py index d4fa3efa3651941021e06b22b01984f3c99a93cc..414ada5888a27f2153e08756221ef77455fb8851 100644 --- a/ppdet/modeling/transformers/utils.py +++ b/ppdet/modeling/transformers/utils.py @@ -11,6 +11,9 @@ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. +# +# Modified from DETR (https://github.com/facebookresearch/detr) +# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved from __future__ import absolute_import from __future__ import division