asafkar / deep_shadow

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

test IndexError #2

Open hanklin3 opened 1 year ago

hanklin3 commented 1 year ago

Hi I'm getting this error.

epoch 660 running loss = 9290.15234375
epoch 670 running loss = 9752.0048828125
epoch 680 running loss = 10089.88671875
epoch 690 running loss = 8728.25
epoch 700 running loss = 8996.896484375
saving model iter 700 in /tmp/deep_shadow/models//rose_LR=5e-05_dev=mixed_700_snapshot.pth
Normed Depth Prediction Error = 0.07724940776824951
Traceback (most recent call last):
  File "train.py", line 413, in <module>
    run(args_, task_name_)
  File "train.py", line 366, in run
    test(depth_hat, writer)
  File "train.py", line 276, in test
    shadow_hat[points_to_calc[idx][0].long(), points_to_calc[idx][1].long()] = 1
IndexError: index 259 is out of bounds for dimension 0 with size 4
asafkar commented 1 year ago

Hi, What exactly did you run? which flags did you use? and - which pytorch version are you using?

hanklin3 commented 1 year ago

Training commands: python3 train.py --object rose Python 3.8.5 Torch '1.13.0+cu117' kornia '0.6.8' 4 cores cpu ( not sure if that has anything to do with the 'size 4')

requirements.txt

einops
imageio
imath
kornia>0.2.0
matplotlib
numpy
opencv_python
scikit_image
scikit-image
tensorboard
torch>1.8
torchvision>0.9

Have to fix kornia>0.2.0 cause the old version missing one argument param.

I don't know if above error has to do with the speed_up_calculation, my temp fix

                        if not speed_up_calculation or (speed_up_calculation and idx < len(points_to_calc)):
                            shadow_hat[points_to_calc[idx][0].long(), points_to_calc[idx][1].long()] = 1
                        continue

I was testing with python3 train.py --object cactus --save_dir ../models/ --speed slow but it ran too slow so I stopped it.

asafkar commented 1 year ago

please refrain from using speed==slow, I left the code there only since I referred to it in the paper - but also as stated in the paper, it does not cause any increase in accuracy.

Please let me know if using speed==fast has any issues on your end.

hanklin3 commented 1 year ago

I got the error using the default (--speed fast). And so I was testing if --speed slow would work instead

asafkar commented 1 year ago

I pushed a fix. Please try again and let me know if it's fixed on your end.

hanklin3 commented 1 year ago

thank you! I will try it