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

Error when train the model #10

Open
hanchaoyuan opened this issue Feb 17, 2022 · 5 comments
Open

Error when train the model #10

hanchaoyuan opened this issue Feb 17, 2022 · 5 comments

Comments

@hanchaoyuan
Copy link

During training, this error occurs!Do you know how to solve?
154000356-60f0c911-7e81-41ad-9716-766b80650ac5
After I declared the variable I got another error
154394009-75ce6375-6c4a-41fa-b2f4-b94e7e2016cf

@captain-pool
Copy link

Facing the same problem. For the first one, I set imfd_initial to '' and trained the MTM model. Next when I try to train the DRM model, it fails since input['person_fdepth'] is not a torch tensor, instead it's a list which looks like ['', '', '']. How can I fix this? CC: @fyviezhao

@captain-pool
Copy link

This is most likely happening because, the data loader is setting imfd to '' in case of DRM or TFM training and returning it.

elif self.model == 'DRM' or self.model == 'TFM':
imfd = ''
imfd_initial = np.load(os.path.join(self.warproot, 'initial-depth', im_name.replace('whole_front.png', 'initial_front_depth.npy')))
imfd_initial = torch.from_numpy(imfd_initial).unsqueeze(0)

This data dictionary is being sent to DRM model's set_input() function, where it is being loaded as a torch tensor and being used to compute gradients.

if self.isTrain:
self.imfd = input['person_fdepth'].to(self.device) # for ground truth
self.imbd = input['person_bdepth'].to(self.device) # for ground truth
if self.use_grad_loss:
self.fgrad = self.compute_grad(self.imfd) # for ground truth
self.bgrad = self.compute_grad(self.imbd) # for ground truth
if self.use_normal_loss or self.use_gan_loss:
self.im_mask = input['person_mask'].to(self.device) # for input
self.imfn = util.depth2normal_ortho(self.imfd).to(self.device) # for ground truth
self.imbn = util.depth2normal_ortho(self.imbd).to(self.device) # for ground truth

@hanchaoyuan
Copy link
Author

This is most likely happening because, the data loader is setting imfd to '' in case of DRM or TFM training and returning it.

elif self.model == 'DRM' or self.model == 'TFM':
imfd = ''
imfd_initial = np.load(os.path.join(self.warproot, 'initial-depth', im_name.replace('whole_front.png', 'initial_front_depth.npy')))
imfd_initial = torch.from_numpy(imfd_initial).unsqueeze(0)

This data dictionary is being sent to DRM model's set_input() function, where it is being loaded as a torch tensor and being used to compute gradients.

if self.isTrain:
self.imfd = input['person_fdepth'].to(self.device) # for ground truth
self.imbd = input['person_bdepth'].to(self.device) # for ground truth
if self.use_grad_loss:
self.fgrad = self.compute_grad(self.imfd) # for ground truth
self.bgrad = self.compute_grad(self.imbd) # for ground truth
if self.use_normal_loss or self.use_gan_loss:
self.im_mask = input['person_mask'].to(self.device) # for input
self.imfn = util.depth2normal_ortho(self.imfd).to(self.device) # for ground truth
self.imbn = util.depth2normal_ortho(self.imbd).to(self.device) # for ground truth

I think so, but I have not found a suitable solution, do you have a good solution?

@jasmine-97
Copy link

I face the same problem, so could you tell me how you solve the problem in MTM model?

fyviezhao added a commit that referenced this issue Mar 20, 2022
@fyviezhao
Copy link
Owner

Sorry for the late reply. Please check the latest code for training, which should now work well.

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

4 participants