Dataloader for coco

i need to change the datasets here to coco

in method

build_dataset(is_train, args):

i tried to write this line

elif args.data_set == ‘coco’:
dataset = ??? (args.data_path, train=is_train, year=2017,
category=args.inat_category, transform=transform)

    nb_classes = 1000

but couldn’t know what is the replacement of question marks

Does using an out-of-the-box version of COCO work? torchvision.datasets — Torchvision master documentation

does data_loader need specific settings or just change name of IMNET to COCO
elif args.data_set == ‘COCO’:
if not args.use_mcloader:
root = os.path.join(args.data_path, ‘train’ if is_train else ‘val’)
dataset = datasets.ImageFolder(root, transform=transform)
dataset = ClassificationDataset(
‘train’ if is_train else ‘val’,
nb_classes = 80

It depends on if the datasets are expected to produce the same kind of labels/annotations (e.g., are you doing classification or object detection)? If you are just doing classification I guess you can just use an ImageFolder provided the organization of the dataset is classes separated by folders.

excuse me another question do you mean the result of training the model will depend on the items that i specify detection of classifications ? if yes can you give me an example please

Taking another look at the source code, it looks like it is intended for classification. However, I’m not sure COCO is really a classification dataset but really a detection dataset. Do you have a link to the dataset you are using or can you describe the organization of the images/folders?

1 Like

I’m confusing in it … it suppose to use a model doing detection but i freeze layers to not make a classification as i need features of images not classify them … so should i use detection for coco .
datasets i have contains two folders (train and val)

You might want to take a look at the finetuning object detection tutorial: TorchVision Object Detection Finetuning Tutorial — PyTorch Tutorials 1.8.1+cu102 documentation as that provides a walkthrough of the scenario you are describing