j96w/DenseFusion

Evaluation on LineMOD Dataset: RuntimeError: Legacy autograd function:...

Closed this issue · 4 comments

Hi,,
i try to evaluate on LineMOD Dataset, and use this comand "./experiments/scripts/eval_linemod.sh".
When I run the code, it can still be processed at first, but the following error occurs when processing No.7192. I have tried various solutions in the issue, to no avail.
But i evaluate on YCB_Video Dataset,and use comand "./experiments/scripts/eval_ycb.sh",that is avail.
And Training Process is also avail.
Any idea of what is wrong with my iplementation?
Thanks.

My platform is
Ubuntu 22.04
GPU: 3070ti
python 3.6
torch 1.7.1+cu110
torchaudio 0.7.2
torchvision 0.8.2+cu110

  • set -e
  • export PYTHONUNBUFFERED=True
  • PYTHONUNBUFFERED=True
  • export CUDA_VISIBLE_DEVICES=0
  • CUDA_VISIBLE_DEVICES=0
  • python3 ./tools/eval_linemod.py --dataset_root ./datasets/linemod/Linemod_preprocessed --model trained_checkpoints/linemod/pose_model_9_0.01310166542980859.pth --refine_model trained_checkpoints/linemod/pose_refine_model_493_0.006761023565178073.pth
    /home/zhou/SA/DenseFusion/lib/transformations.py:1912: UserWarning: failed to import module _transformations
    warnings.warn('failed to import module %s' % name)
    /home/zhou/SA/DenseFusion/datasets/linemod/dataset.py:66: YAMLLoadWarning: calling yaml.load() without Loader=... is deprecated, as the default Loader is unsafe. Please read https://msg.pyyaml.org/load for full details.
    self.meta[item] = yaml.load(meta_file)
    Object 1 buffer loaded
    Object 2 buffer loaded
    Object 4 buffer loaded
    Object 5 buffer loaded
    Object 6 buffer loaded
    Object 8 buffer loaded
    Object 9 buffer loaded
    Object 10 buffer loaded
    Object 11 buffer loaded
    Object 12 buffer loaded
    Object 13 buffer loaded
    Object 14 buffer loaded
    Object 15 buffer loaded
    /home/zhou/anaconda3/envs/densefusion/lib/python3.6/site-packages/torch/nn/_reduction.py:44: UserWarning: size_average and reduce args will be deprecated, please use reduction='mean' instead.
    warnings.warn(warning.format(ret))
    ./tools/eval_linemod.py:59: YAMLLoadWarning: calling yaml.load() without Loader=... is deprecated, as the default Loader is unsafe. Please read https://msg.pyyaml.org/load for full details.
    meta = yaml.load(meta_file)
    [0.010209865663, 0.024750624233, 0.017249224865, 0.020140358597000002, 0.015454551808, 0.026147178102, 0.010899920102000001, 0.016462758847999998, 0.017588933422000002, 0.014554287471000002, 0.027807811733, 0.028260129399, 0.021235825148]
    /home/zhou/anaconda3/envs/densefusion/lib/python3.6/site-packages/torch/nn/functional.py:2952: UserWarning: nn.functional.upsample is deprecated. Use nn.functional.interpolate instead.
    warnings.warn("nn.functional.upsample is deprecated. Use nn.functional.interpolate instead.")
    /home/zhou/anaconda3/envs/densefusion/lib/python3.6/site-packages/torch/nn/functional.py:3063: UserWarning: Default upsampling behavior when mode=bilinear is changed to align_corners=False since 0.4.0. Please specify align_corners=True if the old behavior is desired. See the documentation of nn.Upsample for details.
    "See the documentation of nn.Upsample for details.".format(mode))
    /home/zhou/anaconda3/envs/densefusion/lib/python3.6/site-packages/torch/nn/modules/container.py:117: UserWarning: Implicit dimension choice for log_softmax has been deprecated. Change the call to include dim=X as an argument.
    input = module(input)
    No.0 Pass! Distance: 0.004216850118266611
    No.1 Pass! Distance: 0.0038697024826312826
    No.2 Pass! Distance: 0.006223264002854911
    No.3 Pass! Distance: 0.005435459421881504
    No.4 Pass! Distance: 0.0028559770089771563
    No.5 Pass! Distance: 0.004135905930436273
    No.6 Pass! Distance: 0.004435833969654068
    No.7 Pass! Distance: 0.0036375894008631392
    No.8 Pass! Distance: 0.001638323984075058
    ...
    ...
    ...
    No.7184 Pass! Distance: 0.0051409396661699835
    No.7185 Pass! Distance: 0.003015364929576589
    No.7186 NOT Pass! Distance: 0.011457473328095534
    No.7187 NOT Pass! Distance: 0.011731082900323854
    No.7188 NOT Pass! Distance: 0.013262642515697212
    No.7189 Pass! Distance: 0.008656459834607513
    No.7190 Pass! Distance: 0.008892003837428275
    No.7191 NOT Pass! Distance: 0.031596818093702995
    No.7192 Pass! Distance: 0.008258320402724294
    Traceback (most recent call last):
    File "./tools/eval_linemod.py", line 126, in
    inds = knn(target.unsqueeze(0), pred.unsqueeze(0))
    File "/home/zhou/anaconda3/envs/densefusion/lib/python3.6/site-packages/torch/autograd/function.py", line 160, in call
    "Legacy autograd function with non-static forward method is deprecated. "
    RuntimeError: Legacy autograd function with non-static forward method is deprecated. Please use new-style autograd function with static forward method. (Example: https://pytorch.org/docs/stable/autograd.html#torch.autograd.Function)

I have solved this problem. For me, the problem appeared in tools/eval_linemod.py line 126 "inds = knn(target.unsqueeze(0), pred.unsqueeze(0))", changed to “inds = KNearestNeighbor.apply(target.unsqueeze (0), pred.unsqueeze(0))“. It works .

I have solved this problem. For me, the problem appeared in tools/eval_linemod.py line 126 "inds = knn(target.unsqueeze(0), pred.unsqueeze(0))", changed to “inds = KNearestNeighbor.apply(target.unsqueeze (0), pred.unsqueeze(0))“. It works .

hello, I have changed to “inds = KNearestNeighbor.apply(target.unsqueeze (0), pred.unsqueeze(0))“, but I met the problem "no attribute 'k'", do you have any idea to solve it? thanks!

I have solved this problem. For me, the problem appeared in tools/eval_linemod.py line 126 "inds = knn(target.unsqueeze(0), pred.unsqueeze(0))", changed to “inds = KNearestNeighbor.apply(target.unsqueeze (0), pred.unsqueeze(0))“. It works .

hello, I have changed to “inds = KNearestNeighbor.apply(target.unsqueeze (0), pred.unsqueeze(0))“, but I met the problem "no attribute 'k'", do you have any idea to solve it? thanks!

Did you solve it, I have the same problem

I have solved this problem. For me, the problem appeared in tools/eval_linemod.py line 126 "inds = knn(target.unsqueeze(0), pred.unsqueeze(0))", changed to “inds = KNearestNeighbor.apply(target.unsqueeze (0), pred.unsqueeze(0))“. It works .

hello, I have changed to “inds = KNearestNeighbor.apply(target.unsqueeze (0), pred.unsqueeze(0))“, but I met the problem "no attribute 'k'", do you have any idea to solve it? thanks!

Did you solve it, I have the same problem

did u solve it ,my friend