IntelLabs / MART

Modular Adversarial Robustness Toolkit
BSD 3-Clause "New" or "Revised" License
16 stars 0 forks source link

Add FiftyOne datamodule #209

Closed lumurillo closed 12 months ago

lumurillo commented 1 year ago

What does this PR do?

Add a new datamodule that loads FiftyOne datasets. This implementation let MART delegate the data handling to FiftyOne, where the user can do data curation tasks.

This data handling would be agnostic to MART, because at the end here is adapted a torchvision dataset.

I set this implementation to be optional. The user can install the fiftyone dependencies by running:

pip install -e .[fiftyone]

Important:

Type of change

Please check all relevant options.

Testing

Please describe the tests that you ran to verify your changes. Consider listing any relevant details of your test configuration.

Before submitting

Did you have fun?

Make sure you had fun coding 🙃

mzweilin commented 1 year ago

FiftyOne commands to load (index) datasets.

Use COCO-2017 as an example. Unfortunately, FiftyOne does not support person-keypoints annotations yet.

Download and load zoo datasets

fiftyone zoo datasets load \
coco-2017 \
-s train \
-n coco-2017-instances-train \
-k include_id=true label_types=detections,segmentations

fiftyone zoo datasets load \
coco-2017 \
-s validation \
-n coco-2017-instances-validation \
-k include_id=true label_types=detections,segmentations

Load local datasets

fiftyone datasets create \
--name coco-2017-instances-validation \
--dataset-dir /raid/datasets/coco/ \
--type fiftyone.types.COCODetectionDataset \
--kwargs \
data_path="val2017" \
labels_path=/raid/datasets/coco/annotations/instances_val2017.json \
persistent=true \
include_id=true

Use the FiftyOne datamodule

datamodule:
  train_dataset:
    dataset_name: coco-2017-instances-train
    gt_field: segmentations
  val_dataset:
    dataset_name: coco-2017-instances-validation
    gt_field: segmentations
lumurillo commented 1 year ago

FiftyOne commands to load (index) datasets.

Use COCO-2017 as an example. Unfortunately, FiftyOne does not support person-keypoints annotations yet.

Download and load zoo datasets

fiftyone zoo datasets load \
coco-2017 \
-s train \
-n coco-2017-instances-train \
-k include_id=true label_types=detections,segmentations

fiftyone zoo datasets load \
coco-2017 \
-s validation \
-n coco-2017-instances-validation \
-k include_id=true label_types=detections,segmentations

Load local datasets

fiftyone datasets create \
--name coco-2017-instances-validation \
--dataset-dir /raid/datasets/coco/ \
--type fiftyone.types.COCODetectionDataset \
--kwargs \
data_path="val2017" \
labels_path=/raid/datasets/coco/annotations/instances_val2017.json \
persistent=true \
include_id=true

Use the FiftyOne datamodule

datamodule:
  train_dataset:
    dataset_name: coco-2017-instances-train
    gt_field: segmentations
  val_dataset:
    dataset_name: coco-2017-instances-validation
    gt_field: segmentations

Is this for the for the example documentation?