waxnkw/gvcnn-pytorch

IndexError: index 21 is out of bounds for axis 0 with size 21

Opened this issue · 1 comments

Hi when I am running gvcnn_train.py I ma getting the below error. Any suggestions to remove this error.

torch.Size([64, 1536])
Traceback (most recent call last):
File "gvcnn_train.py", line 107, in
svcnn = train_3d_single()
File "gvcnn_train.py", line 68, in train_3d_single
trainer.train(40)
File "D:\git_hub\gvcnn-pytorch\tools\Trainer.py", line 71, in train
loss, val_overall_acc, val_mean_class_acc = self.update_validation_accuracy(epoch)
File "D:\git_hub\gvcnn-pytorch\tools\Trainer.py", line 120, in update_validation_accuracy
wrong_class[target.cpu().data.numpy().astype('int')[i]] += 1
IndexError: index 21 is out of bounds for axis 0 with size 21

(fastai-3.7) D:\git_hub\gvcnn-pytorch>

It seems that the number of your dataset's classes is more than 21. I make a hard code of the number of classes to 21in update_validation_accuracy() of tools/Trainer.py. You can change it to the number of classes of your dataset.