
import torch.nn as nnimport torch.nn.functional as Ffrom mmcv.cnn import xavier_initfrom mmdet.core import auto_fp16from ..registry import NECKSfrom ..utils import ConvModule@NECKS.register_moduleclass FPN(nn.Module): """ Feature Pyramid Network. This is an implementation of - Feature Pyramid Networks for Object Detection (https://arxiv.org/abs/1612.03144) Args: in_channels (List[int]): number of input channels per scale # 不同尺度的feature map输入FPN的channel数 out_channels (int): number of output channels (used at each scale) # 经过FPN后不同尺度的feature map输出的channel数(默认为251) num_outs (int): number of output scales # start_level (int): index of the first input scale to use as an output scale end_level (int, default=-1): index of the last input scale to use as an output scale