Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

training on coco dataset #28

Open
wcwang07 opened this issue Jan 16, 2019 · 1 comment
Open

training on coco dataset #28

wcwang07 opened this issue Jan 16, 2019 · 1 comment

Comments

@wcwang07
Copy link

has anyone ran into issue training on CocoDataset , I have modified on line 220:

elif args.dataset_type == 'coco':
221 # Image preprocessing, normalization for the pretrained resnet
222 transform = transforms.Compose([
223 transforms.RandomCrop(224),
224 transforms.RandomHorizontalFlip(),
225 transforms.ToTensor(),
226 transforms.Normalize((0.485, 0.456, 0.406),
227 (0.229, 0.224, 0.225))])
228 # Load vocabulary wrapper
229 with open('/home/ubuntu/data/coco/vocab.pkl', 'rb') as f:
230 vocab = pickle.load(f)
231 dataset = CocoDataset(dataset_path, json='/home/ubuntu/data/coco/annotations/captions_train2014.json', vocab=vocab,transform=transform)
232 label_file = '/home/ubuntu/data/coco-labels-file.txt'

when i tried to run

337 train(train_loader, net, criterion, optimizer,
338 device=DEVICE, debug_steps=args.debug_steps, epoch=epoch)

got the elements mistach

File "train_ssd.py", line 121, in train
images, boxes, labels = data
ValueError: not enough values to unpack (expected 3, got 2)

tensor data[0] has shape (1,3,224,224)
tensor data[1] has shape (1,15)

i think we are missing data[2]

Any insight is helpful, thank you in advance.

@qfgaohao
Copy link
Owner

qfgaohao commented Mar 4, 2019

Hi @wcwang07 , "CocoDetection" returns "image" and "targets" instead of "image", "boxes", "labels". You can split "targets" into "boxes" and "labels" to make it work. Plz see "coco.loadAnns" to get the format of "targets".

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants