daveredrum / ScanRefer

[ECCV 2020] ScanRefer: 3D Object Localization in RGB-D Scans using Natural Language
https://daveredrum.github.io/ScanRefer/
Other
232 stars 30 forks source link

Run into problem when visualizing #8

Closed wffancy closed 3 years ago

wffancy commented 3 years ago

Hi @daveredrum ,

I need some help here. After successfullu training and evaluating using the command python scripts/train.py --use_color --batch_size 16 --gpu 1 and python scripts/eval.py --folder 2020-12-30_16-34-15 --reference --use_color --no_nms --force --repeat 5 --gpu 1, when I run python scripts/visualize.py --folder 2020-12-30_16-34-15 --scene_id scene0011_00 --use_color --gpu 1 I get the error messege writing

Traceback (most recent call last):
  File "scripts/visualize.py", line 471, in <module>
    visualize(args)
  File "scripts/visualize.py", line 445, in visualize
    dump_results(args, scanrefer, data, DC)
  File "scripts/visualize.py", line 351, in dump_results
    pred_ref_scores_softmax = F.softmax(data["cluster_ref"] * torch.argmax(data['objectness_scores'], 2).float() * data['pred_mask'], dim=1).detach().cpu().numpy()
KeyError: 'pred_mask'.

I've tried making breakpoints and find that the variable 'data' indeed doesn't have key 'pred_mask'. Actually, I have no idea about how to deal with this problem.

I've also attempted to use the pretrained model. However, I get the RunTimeError telling me the model.pth file in XYZ_COLOR_LANGCLS is a zip archive and the program just stopped. Look forward to your reply.

Thank you!

daveredrum commented 3 years ago

Hi @wffancy,

Thanks for letting me know the issue with visualize.py! It should be caused by an obsolete code snippet before I refactored the project. It should be fixed in the latest commit now. Please let me know if the problem persists.

As for loading the pretrained weights, have you set up the environment as recommended? If so, did you extract the provided zip file and put the extracted folder under outputs?

wffancy commented 3 years ago

Hi @wffancy,

Thanks for letting me know the issue with visualize.py! It should be caused by an obsolete code snippet before I refactored the project. It should be fixed in the latest commit now. Please let me know if the problem persists.

As for loading the pretrained weights, have you set up the environment as recommended? If so, did you extract the provided zip file and put the extracted folder under outputs?

Thanks for prompt reply ! I've set up the environment as recommended as everything goes well when I run train.py and eval.py. I've extracted the downloaded scanrefer_pretrained_XYZ_COLOR_LANGCLS.zip and put the extracted folder XYZ_COLOR_LANGCLS under outputs. Howerver, the model.pth file was recongnized as a zip file when I ran the program and returned an error message as following:

Traceback (most recent call last):
  File "scripts/visualize.py", line 471, in <module>
    visualize(args)
  File "scripts/visualize.py", line 420, in visualize
    model = get_model(args)
  File "scripts/visualize.py", line 69, in get_model
    model.load_state_dict(torch.load(path), strict=False)
  File "/home/huge/anaconda3/envs/ScanRefer/lib/python3.6/site-packages/torch/serialization.py", line 386, in load
    return _load(f, map_location, pickle_module, **pickle_load_args)
  File "/home/huge/anaconda3/envs/ScanRefer/lib/python3.6/site-packages/torch/serialization.py", line 559, in _load
    raise RuntimeError("{} is a zip archive (did you mean to use torch.jit.load()?)".format(f.name))
RuntimeError: /home/huge/Documents/ScanRefer/outputs/XYZ_COLOR_LANGCLS/model.pth is a zip archive (did you mean to use torch.jit.load()?)
daveredrum commented 3 years ago

Can you try eval.py and see if the pretrained weights works?

wffancy commented 3 years ago

Can you try eval.py and see if the pretrained weights works?

Same problem as run visualize.py. It will alse get stuck into RuntimeError regarding the model.pth as zip file.

daveredrum commented 3 years ago

I've just updated the code to pytorch 1.6. Can you try to reinstall the environment with conda install pytorch==1.6.0 torchvision==0.7.0 cudatoolkit=10.2 -c pytorch and see if eval.py and visualize.py work?

The code has passed tests on Ubuntu 18.04/20.04 LTS.

wffancy commented 3 years ago

I've just updated the code to pytorch 1.6. Can you try to reinstall the environment with conda install pytorch==1.6.0 torchvision==0.7.0 cudatoolkit=10.2 -c pytorch and see if eval.py and visualize.py work?

The code has passed tests on Ubuntu 18.04/20.04 LTS.

After updating the code and pytorch version, everything goes well under Ubuntu 16.04 with cuda10.1 . Thanks !