diff --git a/configs/ssd/README.md b/configs/ssd/README.md index 9340e7e812986bbcc427f27a485b2ca9f376e50d..1ebc458669cfbc60216440c412aa1df7ac62602c 100644 --- a/configs/ssd/README.md +++ b/configs/ssd/README.md @@ -6,8 +6,8 @@ | 骨架网络 | 网络类型 | 每张GPU图片个数 | 学习率策略 |推理时间(fps) | Box AP | 下载 | 配置文件 | | :-------------- | :------------- | :-----: | :-----: | :------------: | :-----: | :-----------------------------------------------------: | :-----: | -| VGG | SSD | 8 | 240e | ---- | 77.8 | [下载链接](https://paddledet.bj.bcebos.com/models/ssd_vgg16_300_240e_voc.pdparams) | [配置文件](https://github.com/PaddlePaddle/PaddleDetection/tree/master/dygraph/configs/ssd/ssd_vgg16_300_240e_voc.yml) | -| MobileNet v1 | SSD | 32 | 120e | ---- | 73.8 | [下载链接](https://paddledet.bj.bcebos.com/models/ssd_mobilenet_v1_300_120e_voc.pdparams) | [配置文件](https://github.com/PaddlePaddle/PaddleDetection/tree/master/dygraph/configs/ssd/ssd_mobilenet_v1_300_120e_voc.yml) | +| VGG | SSD | 8 | 240e | ---- | 77.8 | [下载链接](https://paddledet.bj.bcebos.com/models/ssd_vgg16_300_240e_voc.pdparams) | [配置文件](https://github.com/PaddlePaddle/PaddleDetection/tree/develop/configs/ssd/ssd_vgg16_300_240e_voc.yml) | +| MobileNet v1 | SSD | 32 | 120e | ---- | 73.8 | [下载链接](https://paddledet.bj.bcebos.com/models/ssd_mobilenet_v1_300_120e_voc.pdparams) | [配置文件](https://github.com/PaddlePaddle/PaddleDetection/tree/develop/configs/ssd/ssd_mobilenet_v1_300_120e_voc.yml) | **注意:** SSD-VGG使用4GPU在总batch size为32下训练240个epoch。SSD-MobileNetv1使用2GPU在总batch size为64下训练120周期。 diff --git a/ppdet/modeling/architectures/ssd.py b/ppdet/modeling/architectures/ssd.py index 49b01bde0d6e4d399f35b43660d608ea44b06644..136e34fd5259486f7e922d455707e9f4d5019a06 100644 --- a/ppdet/modeling/architectures/ssd.py +++ b/ppdet/modeling/architectures/ssd.py @@ -24,6 +24,15 @@ __all__ = ['SSD'] @register class SSD(BaseArch): + """ + Single Shot MultiBox Detector, see https://arxiv.org/abs/1512.02325 + + Args: + backbone (nn.Layer): backbone instance + ssd_head (nn.Layer): `SSDHead` instance + post_process (object): `BBoxPostProcess` instance + """ + __category__ = 'architecture' __inject__ = ['post_process'] diff --git a/ppdet/modeling/heads/ssd_head.py b/ppdet/modeling/heads/ssd_head.py index a280c01432049c82396f301736cf197006fdbc80..8cbbe0a460441b5414fec5826f21699834c960c0 100644 --- a/ppdet/modeling/heads/ssd_head.py +++ b/ppdet/modeling/heads/ssd_head.py @@ -68,6 +68,20 @@ class SepConvLayer(nn.Layer): @register class SSDHead(nn.Layer): + """ + SSDHead + + Args: + num_classes (int): Number of classes + in_channels (list): Number of channels per input feature + anchor_generator (dict): Configuration of 'AnchorGeneratorSSD' instance + kernel_size (int): Conv kernel size + padding (int): Conv padding + use_sepconv (bool): Use SepConvLayer if true + conv_decay (float): Conv regularization coeff + loss (object): 'SSDLoss' instance + """ + __shared__ = ['num_classes'] __inject__ = ['anchor_generator', 'loss'] diff --git a/ppdet/modeling/losses/ssd_loss.py b/ppdet/modeling/losses/ssd_loss.py index 04ba75b64c4eee4b4460e2acefb130a4741be81d..961a8c4e8d899c76c4baa50b82f133756488a0b9 100644 --- a/ppdet/modeling/losses/ssd_loss.py +++ b/ppdet/modeling/losses/ssd_loss.py @@ -28,6 +28,21 @@ __all__ = ['SSDLoss'] @register class SSDLoss(nn.Layer): + """ + SSDLoss + + Args: + match_type (str): The type of matching method, should be + 'bipartite' or 'per_prediction'. None ('bipartite') by default. + overlap_threshold (float32, optional): If `match_type` is 'per_prediction', + this threshold is to determine the extra matching bboxes based + on the maximum distance, 0.5 by default. + neg_pos_ratio (float): The ratio of negative samples / positive samples. + neg_overlap (float): The overlap threshold of negative samples. + loc_loss_weight (float): The weight of loc_loss. + conf_loss_weight (float): The weight of conf_loss. + """ + def __init__(self, match_type='per_prediction', overlap_threshold=0.5,