augerino_lib/uniform_aug.py [267:284]:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
        weights_t = weights[:,:2] # for translation
        weight_s = weights[:,2][:,None] # for scale 
        weights_t = weights_t.to(x.device, x.dtype)
        weight_s = weight_s.to(x.device, x.dtype)
        width = self.softplus(self.width[y,:])
        width_t = width[:2]
        width_s = width[2]
        weights_t = weights_t * width_t - width_t.div(2.)
        weight_s = weight_s * width_s.div(2) - width_s.div(2)
        weights = torch.cat([weights_t,weight_s],dim=-1)
        x_out = x
        for i in range(self.n_transfos):
            out_mat_i = weights[:, i] * self.g_matrices[:,:,:,i]
            out_mat_i = out_mat_i.transpose(0, 2).transpose(2, 1)
            ## exponential map
            affine_matrix = expm(out_mat_i)
            flowgrid = F.affine_grid(affine_matrix[:, :2, :], size = x_out.size(),
                                 align_corners=True)
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -



augerino_lib/uniform_aug.py [291:308]:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
        weights_t = weights[:,:2] # for translation
        weight_s = weights[:,2][:,None] # for scale 
        weights_t = weights_t.to(x.device, x.dtype)
        weight_s = weight_s.to(x.device, x.dtype)
        width = self.softplus(self.width[y,:])
        width_t = width[:2]
        width_s = width[2]
        weights_t = weights_t * width_t - width_t.div(2.)
        weight_s = weight_s * width_s.div(2) - width_s.div(2)
        weights = torch.cat([weights_t,weight_s],dim=-1)
        x_out = x
        for i in range(self.n_transfos):
            out_mat_i = weights[:, i] * self.g_matrices[:,:,:,i]
            out_mat_i = out_mat_i.transpose(0, 2).transpose(2, 1)
            ## exponential map
            affine_matrix = expm(out_mat_i)
            flowgrid = F.affine_grid(affine_matrix[:, :2, :], size = x_out.size(),
                                 align_corners=True)
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -



