MVIG-SJTU / DIRV

Code for "DIRV: Dense Interaction Region Voting for End-to-End Human-Object Interaction Detection" (AAAI 2021)
37 stars 4 forks source link

IndexError: too many indices for array: array is 1-dimensional, but 2 were indexed #5

Closed Lunarli closed 3 years ago

Lunarli commented 3 years ago

Thaks for your interesting code! when I input your command 'python test_vcoco.py -w logs/vcoco_new/efficientdet-d3_1_85.pth’, it show error that "IndexError: too many indices for array: array is 1-dimensional, but 2 were indexed". But if I replace the efficientdet-d3_1_85.pth with vcoco_best.pth, it works well. So what shou I do to solve this problem?Does the oraginal file efficientdet-d3_vcoco was wrong? Desire to your reply.

yichen928 commented 3 years ago

Hi, I think you should give us more information to solve this problem. For example:

  1. How did you get efficientdet-d3_1_85.pth? What was your training setting and command?
  2. Which line did the IndexError appear?

I think you might make some mistakes in the training process to get efficientdet-d3_1_85.pth.

Lunarli commented 3 years ago

efficientdet-d3_1_85.pth was created after I train VCOCO dataset with efficientdet-d3_vcoco.pth that you give as I use ctrl+c to stop train and save the pth file.

The train command is ‘python train.py -p vcoco --batch_size 2 --load_weights weights/efficientdet-d3_vcoco.pth’. The test command is 'python test_vcoco.py -w logs/vcoco_new/efficientdet-d3_1_85.pth'

I can run the train process,but the efficientdet-d3_1_85.pth is not able to use in the test process and the 'vcoco_best.pth' that I download from your google drive works well in test process. And the command is 'python test_vcoco.py -w weights/vcoco_best.pth'

error

yichen928 commented 3 years ago

Hi, I think the most possible case is that the predicted interaction scores of all the anchor boxes are smaller than our threshold i.e. 0.5. It seems that you only train the model for 85 iterations which is not enough for the network to get any meaningful predictions. As a result, the array "a" in line 78 (i.e. "preds_union["rois"]" in line 200) is empty.

If you want to try the test code, you can use the ckpt provided by us. And if you prefer to train the network by yourself, the model should be trained for much longer time. The provided ckpt is trained for 100+ epochs.

We failed to notice this case since it was very rare if the model has converged, and we will try to fix it in a few days.

Lunarli commented 3 years ago

Thanks for your detailed reply! It will take a long time to train the model to coverge as I only have one gpu. Exactly,I just train the model for for 85 iterations to see weather it can work nomally.

I will follow your advice and train the model for much longer time to see weather it can work normally. Besides, maybe I can turn down the threshold to review the test process.

As for the ckpt files , I use 'vcoco_best.pth' 'hico-det_best.pth' downloads from your Google drive to test on VCOCO datasets and HICO-DET datasets,respectively.And as your paper says it performs very well ! Next,I want to test them with the .pth files trained be myself if I can solve the above-mentioned problem.

yichen928 commented 3 years ago

Glad to know that. For V-COCO dataset, if you only have one GPU, you can consider the EfficientNet-d1 or d2 backbone by changing the parameter "--c" in training and testing. Although the performance would be lower than our d3 backbone, the networks are smaller and easier to train. The initial backbone weights for V-COCO dataset are just the trained checkpoints in "https://github.com/zylo117/Yet-Another-EfficientDet-Pytorch".