image.png

    1. import torch.nn as nn
    2. import torch.nn.functional as F
    3. from mmcv.cnn import xavier_init
    4. from mmdet.core import auto_fp16
    5. from ..registry import NECKS
    6. from ..utils import ConvModule
    7. @NECKS.register_module
    8. class FPN(nn.Module):
    9. """
    10. Feature Pyramid Network.
    11. This is an implementation of - Feature Pyramid Networks for Object
    12. Detection (https://arxiv.org/abs/1612.03144)
    13. Args:
    14. in_channels (List[int]):
    15. number of input channels per scale
    16. # 不同尺度的feature map输入FPN的channel数
    17. out_channels (int):
    18. number of output channels (used at each scale)
    19. # 经过FPN后不同尺度的feature map输出的channel数(默认为251)
    20. num_outs (int):
    21. number of output scales
    22. #
    23. start_level (int):
    24. index of the first input scale to use as an output scale
    25. end_level (int, default=-1):
    26. index of the last input scale to use as an output scale