asafkar / deep_shadow

Code for DeepShadow paper
Apache License 2.0
12 stars 3 forks source link

Unable to reconstruct the 3D object #4

Open AminMemariani opened 1 week ago

AminMemariani commented 1 week ago

Hi, thank you for the great research you have done. I ran the train.py for the rose object and I was able to get the "rose_LR=5e-05_dev=mixed" folder which contains the "events" files. However, I am still not able to see the 3D object file. How can I get that?

Thank you

asafkar commented 6 days ago

Hi, The _"rose_LR=5e-05dev=mixed" directory contains the tensorboard files only. The NERF-like model is saved in /tmp/deep_shadow/models by default (can be changed by indicating _args.savedir.

In order to generate a depth map, which is what this model aims to do, you need to load the model and sample from it using a 2d grid of coordinates. Once you generate the depth map, you can generate a 3d object from that, given the camera parameters.

If this isn't clear, I can upload an example in the next few days.

AminMemariani commented 6 days ago

Hi, The _"rose_LR=5e-05dev=mixed" directory contains the tensorboard files only. The NERF-like model is saved in /tmp/deep_shadow/models by default (can be changed by indicating _args.savedir.

In order to generate a depth map, which is what this model aims to do, you need to load the model and sample from it using a 2d grid of coordinates. Once you generate the depth map, you can generate a 3d object from that, given the camera parameters.

If this isn't clear, I can upload an example in the next few days.

Unfortunately, I am using MacOS and it seems the files are missing in my tmp folder

asafkar commented 6 days ago

Can you try indicating a different directory? Perhaps you don't have write permissions to the /tmp folder

AminMemariani commented 6 days ago

Can you try indicating a different directory? Perhaps you don't have write permissions to the /tmp folder

Sorry for asking a lot. I changed the DIR and executed the train.py again. Now I have a models folder which consists of some .pth files. I created a file called load.py

import torch
from modelfolder import yourmodel

model = yourmodel()
checkpoint = torch.load('model/rose_LR=5e-05_dev=mixed_1250_snapshot.pth')
try:
    checkpoint.eval()
except AttributeError as error:
    print error
### 'dict' object has no attribute 'eval'

model.load_state_dict(checkpoint['state_dict'])
### now you can evaluate it
model.eval()

It seems the model is missing in the repo! How to see 3D objects?