forked from facebookresearch/vissl
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Support for torchvision datasets in VISSL (take 2) (facebookresearch#180
) Summary: This PR is a revision of the first PR (facebookresearch#165) which was a draft to discuss the approach to integrate these datasets. Compared to the previous PR: 1. More pytorch datasets are included (CIFAR10, CIFAR100, STL10, MNIST) 2. The different datasets are proposed in benchmark/linear_image_classification/datasets To combine the datasets with the standard linear evaluation benchmark, we can use the following hydra syntax ``` python tools/run_distributed_engines.py config=benchmark/linear_image_classification/imagenet1k/eval_resnet_8gpu_transfer_in1k_linear config.MODEL.WEIGHTS_INIT.PARAMS_FILE=PATH +config/benchmark/linear_image_classification/datasets=cifar10 ``` Note that for MNIST, a wrapper dataset was needed to convert the images from 1 channel to 3 channels, and increase their size to 32x32 to at least match the downsampling by 32 of standard Resnet50. Pull Request resolved: facebookresearch#180 Reviewed By: prigoyal Differential Revision: D26453148 Pulled By: QuentinDuval fbshipit-source-id: 6ce341f1201641aa51364c2b31cdd40bac162ffb
- Loading branch information
1 parent
75d472b
commit 9e53d28
Showing
13 changed files
with
543 additions
and
4 deletions.
There are no files selected for viewing
47 changes: 47 additions & 0 deletions
47
configs/config/benchmark/linear_image_classification/datasets/cifar10.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
# @package _global_ | ||
config: | ||
DATA: | ||
NUM_DATALOADER_WORKERS: 4 | ||
TRAIN: | ||
DATA_SOURCES: [torchvision_dataset] | ||
LABEL_SOURCES: [torchvision_dataset] | ||
DATASET_NAMES: [CIFAR10] | ||
BATCHSIZE_PER_REPLICA: 256 | ||
TRANSFORMS: | ||
- name: RandomResizedCrop | ||
size: 32 | ||
- name: RandomHorizontalFlip | ||
- name: ToTensor | ||
- name: Normalize | ||
mean: [0.485, 0.456, 0.406] | ||
std: [0.229, 0.224, 0.225] | ||
MMAP_MODE: True | ||
COPY_TO_LOCAL_DISK: False | ||
COPY_DESTINATION_DIR: /tmp/cifar10/ | ||
TEST: | ||
DATA_SOURCES: [torchvision_dataset] | ||
LABEL_SOURCES: [torchvision_dataset] | ||
DATASET_NAMES: [CIFAR10] | ||
BATCHSIZE_PER_REPLICA: 256 | ||
TRANSFORMS: | ||
- name: ToTensor | ||
- name: Normalize | ||
mean: [0.485, 0.456, 0.406] | ||
std: [0.229, 0.224, 0.225] | ||
MMAP_MODE: True | ||
COPY_TO_LOCAL_DISK: False | ||
COPY_DESTINATION_DIR: /tmp/cifar10/ | ||
METERS: | ||
name: accuracy_list_meter | ||
accuracy_list_meter: | ||
num_meters: 1 | ||
topk_values: [1] | ||
MODEL: | ||
FEATURE_EVAL_SETTINGS: | ||
LINEAR_EVAL_FEAT_POOL_OPS_MAP: [ | ||
["res5", ["AdaptiveAvgPool2d", [[1, 1]]]], | ||
] | ||
HEAD: | ||
PARAMS: [ | ||
["eval_mlp", {"in_channels": 2048, "dims": [2048, 10]}], | ||
] |
47 changes: 47 additions & 0 deletions
47
configs/config/benchmark/linear_image_classification/datasets/cifar100.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
# @package _global_ | ||
config: | ||
DATA: | ||
NUM_DATALOADER_WORKERS: 4 | ||
TRAIN: | ||
DATA_SOURCES: [torchvision_dataset] | ||
LABEL_SOURCES: [torchvision_dataset] | ||
DATASET_NAMES: [CIFAR100] | ||
BATCHSIZE_PER_REPLICA: 256 | ||
TRANSFORMS: | ||
- name: RandomResizedCrop | ||
size: 32 | ||
- name: RandomHorizontalFlip | ||
- name: ToTensor | ||
- name: Normalize | ||
mean: [0.485, 0.456, 0.406] | ||
std: [0.229, 0.224, 0.225] | ||
MMAP_MODE: True | ||
COPY_TO_LOCAL_DISK: False | ||
COPY_DESTINATION_DIR: /tmp/cifar100/ | ||
TEST: | ||
DATA_SOURCES: [torchvision_dataset] | ||
LABEL_SOURCES: [torchvision_dataset] | ||
DATASET_NAMES: [CIFAR100] | ||
BATCHSIZE_PER_REPLICA: 256 | ||
TRANSFORMS: | ||
- name: ToTensor | ||
- name: Normalize | ||
mean: [0.485, 0.456, 0.406] | ||
std: [0.229, 0.224, 0.225] | ||
MMAP_MODE: True | ||
COPY_TO_LOCAL_DISK: False | ||
COPY_DESTINATION_DIR: /tmp/cifar100/ | ||
METERS: | ||
name: accuracy_list_meter | ||
accuracy_list_meter: | ||
num_meters: 1 | ||
topk_values: [1, 5] | ||
MODEL: | ||
FEATURE_EVAL_SETTINGS: | ||
LINEAR_EVAL_FEAT_POOL_OPS_MAP: [ | ||
["res5", ["AdaptiveAvgPool2d", [[1, 1]]]], | ||
] | ||
HEAD: | ||
PARAMS: [ | ||
["eval_mlp", {"in_channels": 2048, "dims": [2048, 100]}], | ||
] |
53 changes: 53 additions & 0 deletions
53
configs/config/benchmark/linear_image_classification/datasets/mnist.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
# @package _global_ | ||
config: | ||
DATA: | ||
NUM_DATALOADER_WORKERS: 4 | ||
TRAIN: | ||
DATA_SOURCES: [torchvision_dataset] | ||
LABEL_SOURCES: [torchvision_dataset] | ||
DATASET_NAMES: [MNIST] | ||
BATCHSIZE_PER_REPLICA: 256 | ||
TRANSFORMS: | ||
- name: MNISTImgPil2RGB | ||
size: 32 | ||
box: [2, 2] | ||
- name: RandomResizedCrop | ||
size: 32 | ||
- name: RandomHorizontalFlip | ||
- name: ToTensor | ||
- name: Normalize | ||
mean: [0.485, 0.456, 0.406] | ||
std: [0.229, 0.224, 0.225] | ||
MMAP_MODE: True | ||
COPY_TO_LOCAL_DISK: False | ||
COPY_DESTINATION_DIR: /tmp/mnist/ | ||
TEST: | ||
DATA_SOURCES: [torchvision_dataset] | ||
LABEL_SOURCES: [torchvision_dataset] | ||
DATASET_NAMES: [MNIST] | ||
BATCHSIZE_PER_REPLICA: 256 | ||
TRANSFORMS: | ||
- name: MNISTImgPil2RGB | ||
size: 32 | ||
box: [2, 2] | ||
- name: ToTensor | ||
- name: Normalize | ||
mean: [0.485, 0.456, 0.406] | ||
std: [0.229, 0.224, 0.225] | ||
MMAP_MODE: True | ||
COPY_TO_LOCAL_DISK: False | ||
COPY_DESTINATION_DIR: /tmp/mnist/ | ||
METERS: | ||
name: accuracy_list_meter | ||
accuracy_list_meter: | ||
num_meters: 1 | ||
topk_values: [1] | ||
MODEL: | ||
FEATURE_EVAL_SETTINGS: | ||
LINEAR_EVAL_FEAT_POOL_OPS_MAP: [ | ||
["res5", ["AdaptiveAvgPool2d", [[1, 1]]]], | ||
] | ||
HEAD: | ||
PARAMS: [ | ||
["eval_mlp", {"in_channels": 2048, "dims": [2048, 10]}], | ||
] |
45 changes: 45 additions & 0 deletions
45
configs/config/benchmark/linear_image_classification/datasets/stl10.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
# @package _global_ | ||
config: | ||
DATA: | ||
NUM_DATALOADER_WORKERS: 4 | ||
TRAIN: | ||
DATA_SOURCES: [torchvision_dataset] | ||
LABEL_SOURCES: [torchvision_dataset] | ||
DATASET_NAMES: [STL10] | ||
TRANSFORMS: | ||
- name: RandomResizedCrop | ||
size: 32 | ||
- name: RandomHorizontalFlip | ||
- name: ToTensor | ||
- name: Normalize | ||
mean: [0.485, 0.456, 0.406] | ||
std: [0.229, 0.224, 0.225] | ||
MMAP_MODE: True | ||
COPY_TO_LOCAL_DISK: False | ||
COPY_DESTINATION_DIR: /tmp/stl10/ | ||
TEST: | ||
DATA_SOURCES: [torchvision_dataset] | ||
LABEL_SOURCES: [torchvision_dataset] | ||
DATASET_NAMES: [STL10] | ||
TRANSFORMS: | ||
- name: ToTensor | ||
- name: Normalize | ||
mean: [0.485, 0.456, 0.406] | ||
std: [0.229, 0.224, 0.225] | ||
MMAP_MODE: True | ||
COPY_TO_LOCAL_DISK: False | ||
COPY_DESTINATION_DIR: /tmp/stl10/ | ||
METERS: | ||
name: accuracy_list_meter | ||
accuracy_list_meter: | ||
num_meters: 1 | ||
topk_values: [1] | ||
MODEL: | ||
FEATURE_EVAL_SETTINGS: | ||
LINEAR_EVAL_FEAT_POOL_OPS_MAP: [ | ||
["res5", ["AdaptiveAvgPool2d", [[1, 1]]]], | ||
] | ||
HEAD: | ||
PARAMS: [ | ||
["eval_mlp", {"in_channels": 2048, "dims": [2048, 10]}], | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.