in model.py [0:0]
def __init__(self, n_keypoints=17,
shape_basis_size=10,
n_fully_connected=1024,
n_layers=6,
keypoint_rescale=float(1),
keypoint_norm_type='to_mean',
projection_type='orthographic',
z_augment=True,
z_augment_rot_angle=float(np.pi)/8,
z_equivariance=True,
z_equivariance_rot_angle=float(np.pi)/8,
camera_translation=False,
camera_xy_translation=False,
argmin_translation=False,
camera_scale=False,
connectivity_setup='NONE',
huber_scaling=0.01,
reprojection_normalization='kp_total_count',
independent_phi_for_aug=False,
canonicalization={
'use': True,
'n_layers': 6,
'n_rand_samples': 4,
'rot_angle': float(np.pi),
'n_fully_connected': 1024,
},
perspective_depth_threshold=0.1,
depth_offset=0.,
replace_keypoints_with_input=True,
root_joint=0,
weight_init_std=0.01,
loss_weights={'l_reprojection': 1.,
'l_canonicalization': 1.},
log_vars=[
'objective',
'dist_reprojection',
'l_reprojection',
'l_canonicalization'],
**kwargs):
super(C3DPO, self).__init__()
# autoassign constructor params to self
auto_init_args(self)
# factorization net
self.phi = nn.Sequential(
*self.make_trunk(dim_in=self.n_keypoints * 3,
# 2 dim loc, 1 dim visibility
n_fully_connected=self.n_fully_connected,
n_layers=self.n_layers))
# shape coefficient predictor
self.alpha_layer = conv1x1(self.n_fully_connected,
self.shape_basis_size,
std=weight_init_std)
# 3D shape predictor
self.shape_layer = conv1x1(self.shape_basis_size, 3*n_keypoints,
std=weight_init_std)
# rotation predictor (predicts log-rotation)
self.rot_layer = conv1x1(self.n_fully_connected, 3,
std=weight_init_std)
if self.camera_translation:
# camera translation
self.translation_layer = conv1x1(self.n_fully_connected, 3,
std=weight_init_std)
if self.camera_scale:
# camera scale (with final sofplus to ensure positive outputs)
self.scale_layer = nn.Sequential(conv1x1(self.n_fully_connected, 3,
std=weight_init_std),
nn.Softplus())
if self.canonicalization['use']:
# canonicalization net:
self.psi = nn.Sequential(
*self.make_trunk(dim_in=self.n_keypoints*3,
n_fully_connected=self.canonicalization['n_fully_connected'],
n_layers=self.canonicalization['n_layers']))
self.alpha_layer_psi = conv1x1(self.n_fully_connected,
self.shape_basis_size,
std=weight_init_std)