Skip to content

Problem of principle #9

@Tongbook

Description

@Tongbook
    def _loss_closure():
        optimizer.zero_grad()
        optim_matrix_basis = euler_angle_to_matrix(self.optim_bone_euler, 'YXZ')
        matrix_basis = torch.gather(torch.cat([torch.eye(4).unsqueeze(0), optim_matrix_basis]), dim=0, index=self.gather_id)
        matrix_world = eval_matrix_world(self.bone_parents_id, self.bone_matrix, matrix_basis)
        joints = matrix_world[:, :3, 3]
        joint_dir = joints[joint_pairs_a] - joints[joint_pairs_b]
        dir_loss = F.mse_loss(kpt_dir, joint_dir)
        joint_prior_loss = barrier(self.optim_bone_euler[self.joint_contraint_id], self.joint_constraints_min, self.joint_constraints_max).mean()
        pose_reg_loss = self.optim_bone_euler.square().mean()
        loss = dir_loss + self.pose_reg_loss_weight * pose_reg_loss + self.joint_constraint_loss_weight * joint_prior_loss 
        loss.backward()
        return loss

Above code, what is the loss logic? If it is convenient for you, please introduce me to some unknown places. Thanks.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions