Hanqer / deep-hough-transform

Jittor and Pytorch code for paper "Deep Hough Transform for Semantic Line Detection" (ECCV 2020, PAMI 2021)
344 stars 71 forks source link

AttributeError: 'int' object has no attribute 'mean' #4

Closed ckadir closed 3 years ago

ckadir commented 3 years ago

Hi, I'm trying to train my custom dataset but I'm getting an error. I am using Google Colaboratory

Error : /content/deep-hough-transform 2021-04-11 10:48:25,507 INFO {'DATA': {'DIR': 'data/training/', 'VAL_DIR': 'data/training/', 'TEST_DIR': 'data/training/', 'LABEL_FILE': 'data/training/train_1716_100_100.txt', 'VAL_LABEL_FILE': 'data/training/test_1716_100_100.txt', 'TEST_LABEL_FILE': 'data/training/test_1716_100_100.txt', 'BATCH_SIZE': 8, 'WORKERS': 8}, 'OPTIMIZER': {'LR': 0.0002, 'MOMENTUM': 0.9, 'GAMMA': 0.1, 'WEIGHT_DECAY': 0.0, 'STEPS': []}, 'MODEL': {'NUMANGLE': 100, 'NUMRHO': 100, 'THRESHOLD': 0.01, 'BACKBONE': 'resnet50'}, 'TRAIN': {'EPOCHS': 30, 'PRINT_FREQ': 50, 'TEST': False, 'SEED': 1997, 'GPU_ID': 0, 'DATA_PARALLEL': False, 'RESUME': None}, 'MISC': {'TMP': '/content/drive/MyDrive/Deep_Hough_Transform/11_04_2021_13_47/results'}} 2021-04-11 10:48:25,509 INFO Namespace(config='./config.yml', resume='', tmp='') Downloading: "https://download.pytorch.org/models/resnet50-19c8e357.pth" to /root/.cache/torch/hub/checkpoints/resnet50-19c8e357.pth 100% 97.8M/97.8M [00:01<00:00, 71.4MB/s] /usr/local/lib/python3.7/dist-packages/torch/utils/data/dataloader.py:477: UserWarning: This DataLoader will create 8 worker processes in total. Our suggested max number of worker in current system is 2, which is smaller than what this DataLoader is going to create. Please be aware that excessive worker creation might get DataLoader running slow or even freeze, lower the worker number to avoid potential slowness/freeze if necessary. cpuset_checked)) 2021-04-11 10:48:36,811 INFO Data loading done. 2021-04-11 10:48:36,816 INFO Start training. 0% 0/93 [00:00<?, ?it/s]/usr/local/lib/python3.7/dist-packages/torch/nn/functional.py:3328: UserWarning: nn.functional.upsample is deprecated. Use nn.functional.interpolate instead. warnings.warn("nn.functional.upsample is deprecated. Use nn.functional.interpolate instead.") /usr/local/lib/python3.7/dist-packages/torch/nn/functional.py:3458: 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) Training Loss:0.11952034384012222: 100% 93/93 [02:14<00:00, 1.45s/it] 100% 200/200 [00:14<00:00, 14.19it/s] Traceback (most recent call last): File "train.py", line 302, in <module> main() File "train.py", line 121, in main acc = validate(val_loader, model, epoch, writer, args) File "train.py", line 273, in validate writer.add_scalar('val/total_recall', total_recall.mean(), epoch) AttributeError: 'int' object has no attribute 'mean'

zeakey commented 3 years ago

Should be a bug but I think it would be very easily fixed by removing the .mean() since total_recall itself is an int. @Hanqer can you check and fix it?

Hanqer commented 3 years ago

It seems not a general bug of the code. This occurs only when your validation set has no GT line totally. Please check your validation set and the file list. @ckadir