Skip to content

Data not tensor error #9

@slowsheep1

Description

@slowsheep1

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"].

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions