pytorch-multi-label-classifier icon indicating copy to clipboard operation
pytorch-multi-label-classifier copied to clipboard

Data not tensor error

Open slowsheep1 opened this issue 6 years ago • 0 comments

Traceback (most recent call last): File "multi_label_classifier.py", line 337, in main() File "multi_label_classifier.py", line 330, in main train(model, criterion, train_set, val_set, opt, (rid2name, id2rid)) File "multi_label_classifier.py", line 170, in train output, loss, loss_list = forward_batch(model, criterion, inputs, targets, opt, "Train") File "multi_label_classifier.py", line 57, in forward_batch target_vars.append(Variable(targets[index])) TypeError: Variable data has to be a tensor, but got tuple

I received the above error. Can you please help me understand it. I used label.txt and data.txt in the format given and my dataset is PNGs of 1024x1024. I am trying to train with Resnet50 with load size of 256 and input size of 224. My labels are 8 binary variables with unique names e.g. no_one, yes_one, ... , no_eight, yes_eight. Each label is some combination of the eight attribute values e.g. ["no_one","yes_two",...,"no_seven","no_eight"].

slowsheep1 avatar Aug 19 '19 15:08 slowsheep1