1
train_dataset = dset.CocoDetection(root = path2data,
                                 annFile = path2json)

After this function, I want to get these three outputs using train_dataset but it doesn't work.

train_image, train_label, train_segm = train_dataset[6]

I am currently getting two outputs as a result of train_dataset image and traget.

I need train_image, train_label, train_segm to perform the operations I want to use in the future.

Vitalizzare
  • 4,496
  • 7
  • 13
  • 32
zeynep
  • 19
  • 2

1 Answers1

0

Don't think you can get there in a single step.

As the getitem code in https://pytorch.org/vision/stable/_modules/torchvision/datasets/coco.html#CocoDetection.__getitem__ indicated, the loader gives you only image and target (annotationIds).

You then have to convert the annotationIds into segments using something along the lines of COCO annotations to masks - For instance segmentation model training

Arsene Lupin
  • 343
  • 2
  • 11
  • I'm having problems with gluoncv. After the index is created in the document I left below train_image, train_label, train_segm = train_dataset[6] 3 outputs can be obtained using this expression. after i create index with dset.CocoDetection img, target = train_dataset[6] I can get output like this. I have to fix this problem so I can continue with gluoncv. https://cv.gluon.ai/build/examples_instance/train_mask_rcnn_coco.html#data-loader – zeynep Oct 17 '22 at 09:12