megvii-research / BBN

The official PyTorch implementation of paper BBN: Bilateral-Branch Network with Cumulative Learning for Long-Tailed Visual Recognition
https://arxiv.org/abs/1912.02413
MIT License
661 stars 102 forks source link

AttributeError: 'IMBALANCECIFAR10' object has no attribute 'data' #7

Open xinfu607 opened 4 years ago

xinfu607 commented 4 years ago

Hi,I meet "AttributeError" when running "train.py". Could you please tell me how to fix it ?

Downloading https://www.cs.toronto.edu/~kriz/cifar-10-python.tar.gz to ./datasets/imbalance_cifar10/cifar-10-python.tar.gz 212664376it [00:19, 38731722.29it/s]Traceback (most recent call last): File "/xinfu/code/long_tail/BBN/main/train.py", line 69, in train_set = eval(cfg.DATASET.DATASET)("train", cfg) File "/xinfu/code/long_tail/BBN/lib/dataset/imbalance_cifar.py", line 25, in init img_num_list = self.get_img_num_per_cls(self.cls_num, imb_type, imb_factor) File "/xinfu/code/long_tail/BBN/lib/dataset/imbalance_cifar.py", line 44, in get_img_num_per_cls img_max = len(self.data) / cls_num AttributeError: 'IMBALANCECIFAR10' object has no attribute 'data'

XinChengHuNan commented 4 years ago

It is maybe because of the version of torch I fixed it by pip install torch==1.0.1