def load_weights(self, pretrained_path): model = CRNN10(self.class_num, self.pool_type, self.pool_size, self.interp_ratio) checkpoint = torch.load(pretrained_path, map_location=lambda storage, loc: storage) model.load_state_dict(checkpoint['model_state_dict']) self.conv_block1 = model.conv_block1 self.conv_block2 = model.conv_block2 self.conv_block3 = model.conv_block3 self.conv_block4 = model.conv_block4 init_gru(self.gru) init_layer(self.event_fc) init_layer(self.azimuth_fc) init_layer(self.elevation_fc)
def __init__(self, class_num, pool_type='avg', pool_size=(2, 2), pretrained_path=None): super().__init__(class_num, pool_type, pool_size, pretrained_path=pretrained_path) if pretrained_path: self.load_weights(pretrained_path) self.gru = nn.GRU(input_size=512, hidden_size=256, num_layers=1, batch_first=True, bidirectional=True) init_gru(self.gru) init_layer(self.event_fc) init_layer(self.azimuth_fc) init_layer(self.elevation_fc)
def init_weights(self): init_gru(self.gru) init_layer(self.event_fc) init_layer(self.azimuth_fc) init_layer(self.elevation_fc)
def init_weights(self): init_gru(self.gru_1) init_gru(self.gru_2) init_layer(self.event_fc)