def extract(self, x, label):
        conv1 = self.conv_block1(x)
        conv2 = self.conv_block2(conv1)
        conv3 = self.conv_block3(conv2)
        conv4 = self.conv_block4(conv3)
        conv5 = self.conv_block5(conv4)
        fconv = self.fconv_block(conv5)

        if self.use_norm_weights:
            fconv_norm = l2_norm(fconv)
            conv3_norm = l2_norm(conv3)
            conv4_norm = l2_norm(conv4)
        else:
            fconv_norm = fconv
            conv3_norm = conv3
            conv4_norm = conv4

        if self.weighted_mask:
            fconv_pooled = weighted_masked_embeddings(fconv_norm.shape, label,
                                                      fconv_norm, self.n_classes)
            conv3_pooled = weighted_masked_embeddings(conv3_norm.shape, label,
                                                      conv3_norm, self.n_classes)
            conv4_pooled = weighted_masked_embeddings(conv4_norm.shape, label,
                                                      conv4_norm, self.n_classes)
        else:
            fconv_pooled = masked_embeddings(fconv_norm.shape, label, fconv_norm,
                                             self.n_classes)
            conv3_pooled = masked_embeddings(conv3_norm.shape, label, conv3_norm,
                                             self.n_classes)
            conv4_pooled = masked_embeddings(conv4_norm.shape, label, conv4_norm,
                                             self.n_classes)

        return fconv_pooled, conv4_pooled, conv3_pooled
    def extract(self, x, label):
        conv1 = self.conv_block1(x)
        conv2 = self.conv_block2(conv1)
        conv3 = self.conv_block3(conv2)
        conv4 = self.conv_block4(conv3)
        conv5 = self.conv_block5(conv4)
        fconv = self.fconv_block(conv5)

        fconv_pooled = masked_embeddings(fconv.shape, label, fconv,
                                         self.n_classes)
        conv3_pooled = masked_embeddings(conv3.shape, label, conv3,
                                         self.n_classes)
        conv4_pooled = masked_embeddings(conv4.shape, label, conv4,
                                         self.n_classes)

        return fconv_pooled, conv4_pooled, conv3_pooled
    def extract(self, x, label):
        crop_h, crop_w = int(x.size()[-2]), int(x.size()[-1])
        x = self.stages[0](x)

        side = []
        side_out = []
        for i in range(1, len(self.stages)):
            x = self.stages[i](x)
            side_temp = self.side_prep[i - 1](x)
            side.append(
                center_crop(self.upscale[i - 1](side_temp), crop_h, crop_w))
            side_out.append(
                center_crop(
                    self.upscale_[i - 1](self.score_dsn[i - 1](side_temp)),
                    crop_h, crop_w))

        out = torch.cat(side[:], dim=1)
        out = masked_embeddings(out.shape,
                                label,
                                out,
                                self.n_classes,
                                pad=True)

        return out