(self, num_classes: int, base_net: nn.ModuleList, source_layer_indexes: List[int],
                 extras: nn.ModuleList, classification_headers: nn.ModuleList,
                 regression_headers: nn.ModuleList, is_test=False, config=None, device=None)
Compose a SSD model using the given components.
Compose a SSD model using the given components.
Compose a SSD model using the given components .
def __init__(self, num_classes: int, base_net: nn.ModuleList, source_layer_indexes: List[int],
                 extras: nn.ModuleList, classification_headers: nn.ModuleList,
                 regression_headers: nn.ModuleList, is_test=False, config=None, device=None):
        """Compose a SSD model using the given components.
        """
        super(SSD, self).__init__()

        self.num_classes = num_classes
        self.base_net = base_net
        self.source_layer_indexes = source_layer_indexes
        self.extras = extras
        self.classification_headers = classification_headers
        self.regression_headers = regression_headers
        self.is_test = is_test
        self.config = config

        # register layers in source_layer_indexes by adding them to a module list
        self.source_layer_add_ons = nn.ModuleList([t[1] for t in source_layer_indexes
                                                   if isinstance(t, tuple) and not isinstance(t, GraphPath)])
        if device:
            self.device = device
        else:
            self.device = torch.device("cuda:0" if torch.cuda.is_available() else "cpu")
        if is_test:
            self.config = config
            self.priors = config.priors.to(self.device)
def __init__ ( self , num_classes : int , base_net : nn . ModuleList , source_layer_indexes : List [ int ] , extras : nn . ModuleList , classification_headers : nn . ModuleList , regression_headers : nn . ModuleList , is_test = False , config = None , device = None ) : super ( SSD , self ) . __init__ ( ) self . num_classes = num_classes self . base_net = base_net self . source_layer_indexes = source_layer_indexes self . extras = extras self . classification_headers = classification_headers self . regression_headers = regression_headers self . is_test = is_test self . config = config # register layers in source_layer_indexes by adding them to a module list self . source_layer_add_ons = nn . ModuleList ( [ t [ 1 ] for t in source_layer_indexes if isinstance ( t , tuple ) and not isinstance ( t , GraphPath ) ] ) if device : self . device = device else : self . device = torch . device ( "cuda:0" if torch . cuda . is_available ( ) else "cpu" ) if is_test : self . config = config self . priors = config . priors . to ( self . device )