Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

image_fitting #25

Open
Sugiiiii opened this issue Apr 6, 2023 · 8 comments
Open

image_fitting #25

Sugiiiii opened this issue Apr 6, 2023 · 8 comments

Comments

@Sugiiiii
Copy link

Sugiiiii commented Apr 6, 2023

The current image_fitting does not seem to be the latest version. I encountered many variable mismatch issues while trying to run image_fitting.py. I would really appreciate it if you could upload the latest runnable version.

@Sugiiiii
Copy link
Author

This is the result I got:
图片

@yhc-1
Copy link

yhc-1 commented May 2, 2023

Same issue, could you please update your code?

@garvita-tiwari garvita-tiwari pinned this issue Aug 24, 2023
@garvita-tiwari garvita-tiwari unpinned this issue Aug 24, 2023
@moonbow721
Copy link

It would be better if the codes for quantitative evaluation could be updated.

@moonbow721
Copy link

The implementation of image_fitting is quite different from the descriptions in the paper. For example, the bending
term for elbows and knees is not used here. Besides, why does the 'temp' term for motion sequences also appear here?

optimizer = torch.optim.Adam([smpl_init.body_pose], 0.02, betas=(0.9, 0.999))
# Get loss_weights
weight_dict = self.get_loss_weights()
for it in range(iterations):
loop = tqdm(range(steps_per_iter))
loop.set_description('Optimizing SMPL poses')
for i in loop:
optimizer.zero_grad()
loss_dict = dict()
# convert pose to quaternion and predict distance
pose_quat = axis_angle_to_quaternion(smpl_init.body_pose.view(-1, 23, 3)[:, :21])
loss_dict['pose_pr']= torch.mean(self.pose_prior(pose_quat, train=False)['dist_pred'])
# calculate temporal loss between mesh vertices
smpl_init = self.body_model(betas=self.betas, pose_body=smpl_init.body_pose)
# smpl_opt = self.smpl(betas=self.betas, pose_body=smpl_init.body_pose)
temp_term = smpl_init.vertices[:-1] - smpl_init.vertices[1:]
loss_dict['temp'] = torch.mean(torch.sqrt(torch.sum(temp_term*temp_term, dim=2)))
# calculate data term from inital noisy pose
if it > 0: #for nans
data_term = smpl_init.Jtr - init_joints
loss_dict['data'] = torch.mean(torch.sqrt(torch.sum(data_term*data_term, dim=2)))
# Get total loss for backward pass
tot_loss = self.backward_step(loss_dict, weight_dict, it)
tot_loss.backward()
optimizer.step()
l_str = 'Iter: {}'.format(i)
for k in loss_dict:
l_str += ', {}: {:0.8f}'.format(k, weight_dict[k](loss_dict[k], it).mean().item())
loop.set_description(l_str)

@HonglinChu
Copy link

where define self.loss_weight?

@HonglinChu
Copy link

image
I can not run image_fitting, it seems that the code have many errors

@HonglinChu
Copy link

image
image
where the self.loss_weight is defined?

@tacalvin
Copy link

Anyone manage to get this to work?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants