Skip to content

Commit

Permalink
Merge branch 'merge-0-9-0' of https://github.com/AntreasAntoniou/GATE
Browse files Browse the repository at this point in the history
…into merge-0-9-0
  • Loading branch information
AntreasAntoniou committed Dec 15, 2023
2 parents a20fd50 + 190629e commit f42bbe6
Show file tree
Hide file tree
Showing 108 changed files with 638 additions and 333 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,7 @@ models--*
wandb/*
checkpoints/*


# Experiment logs
*.stderr
*.stdout
Expand Down
2 changes: 1 addition & 1 deletion gate/boilerplate/convenience.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@
import torch
import torch.nn as nn
import transformers
import wandb
from hydra_zen import instantiate
from torch.utils.data import Subset

import wandb
from gate.data.core import GATEDataset
from gate.models.core import GATEModel

Expand Down
2 changes: 1 addition & 1 deletion gate/boilerplate/decorators.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@
from typing import Any, Callable, Dict, Optional

import torch
import wandb
from hydra.core.config_store import ConfigStore
from hydra_zen import builds

import wandb
from gate.boilerplate.wandb_utils import (
log_wandb_3d_volumes_and_masks,
log_wandb_images,
Expand Down
6 changes: 2 additions & 4 deletions gate/boilerplate/wandb_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,8 @@
import torch
import torch.nn.functional as F
import torchvision.transforms as T
from PIL import Image

import wandb
from PIL import Image

logger = logging.getLogger(name=__name__)

Expand Down Expand Up @@ -235,9 +234,8 @@ def log_wandb_images(

import torch
import torchvision.transforms as T
from PIL import Image

import wandb
from PIL import Image


def log_wandb_image_classification(
Expand Down
6 changes: 4 additions & 2 deletions gate/data/few_shot/aircraft.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,10 @@
from gate.boilerplate.decorators import configurable
from gate.config.variables import DATASET_DIR
from gate.data.core import GATEDataset
from gate.data.few_shot.core import (FewShotClassificationMetaDataset,
key_mapper)
from gate.data.few_shot.core import (
FewShotClassificationMetaDataset,
key_mapper,
)

logger = logging.getLogger(__name__)

Expand Down
6 changes: 4 additions & 2 deletions gate/data/few_shot/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,10 @@
from torch.utils.data import Dataset
from tqdm.auto import tqdm

from gate.data.few_shot.utils import (FewShotSuperSplitSetOptions,
get_class_to_idx_dict)
from gate.data.few_shot.utils import (
FewShotSuperSplitSetOptions,
get_class_to_idx_dict,
)

logger = logging.getLogger(__name__)

Expand Down
6 changes: 4 additions & 2 deletions gate/data/few_shot/cubirds200.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,10 @@
from gate.boilerplate.decorators import configurable
from gate.config.variables import DATASET_DIR
from gate.data.core import GATEDataset
from gate.data.few_shot.core import (FewShotClassificationMetaDataset,
key_mapper)
from gate.data.few_shot.core import (
FewShotClassificationMetaDataset,
key_mapper,
)

logger = logging.getLogger(__name__)

Expand Down
6 changes: 4 additions & 2 deletions gate/data/few_shot/describable_textures.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,10 @@
from gate.boilerplate.decorators import configurable
from gate.config.variables import DATASET_DIR
from gate.data.core import GATEDataset
from gate.data.few_shot.core import (FewShotClassificationMetaDataset,
key_mapper)
from gate.data.few_shot.core import (
FewShotClassificationMetaDataset,
key_mapper,
)

logger = logging.getLogger(__name__)

Expand Down
6 changes: 4 additions & 2 deletions gate/data/few_shot/fungi.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,10 @@
from gate.boilerplate.decorators import configurable
from gate.config.variables import DATASET_DIR
from gate.data.core import GATEDataset
from gate.data.few_shot.core import (FewShotClassificationMetaDataset,
key_mapper)
from gate.data.few_shot.core import (
FewShotClassificationMetaDataset,
key_mapper,
)

logger = logging.getLogger(__name__)

Expand Down
6 changes: 4 additions & 2 deletions gate/data/few_shot/mini_imagenet.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,10 @@
from gate.boilerplate.decorators import configurable
from gate.config.variables import DATASET_DIR
from gate.data.core import GATEDataset
from gate.data.few_shot.core import (FewShotClassificationMetaDataset,
key_mapper)
from gate.data.few_shot.core import (
FewShotClassificationMetaDataset,
key_mapper,
)

logger = logging.getLogger(__name__)

Expand Down
6 changes: 4 additions & 2 deletions gate/data/few_shot/vggflowers.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,10 @@
from gate.boilerplate.decorators import configurable
from gate.config.variables import DATASET_DIR
from gate.data.core import GATEDataset
from gate.data.few_shot.core import (FewShotClassificationMetaDataset,
key_mapper)
from gate.data.few_shot.core import (
FewShotClassificationMetaDataset,
key_mapper,
)

logger = logging.getLogger(__name__)

Expand Down
6 changes: 4 additions & 2 deletions gate/data/image/segmentation/ade20k.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,10 @@
from gate.config.variables import DATASET_DIR
from gate.data.core import GATEDataset
from gate.data.image.segmentation.classes import ade20_classes as CLASSES
from gate.data.transforms.segmentation import (BaseDatasetTransforms,
KeySelectorTransforms)
from gate.data.transforms.segmentation import (
BaseDatasetTransforms,
KeySelectorTransforms,
)


def build_dataset(set_name: str, data_dir: Optional[str] = None) -> dict:
Expand Down
6 changes: 4 additions & 2 deletions gate/data/image/segmentation/cityscapes.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,10 @@
from gate.config.variables import DATASET_DIR
from gate.data.core import GATEDataset
from gate.data.image.segmentation.classes import ade20_classes as CLASSES
from gate.data.transforms.segmentation import (BaseDatasetTransforms,
KeySelectorTransforms)
from gate.data.transforms.segmentation import (
BaseDatasetTransforms,
KeySelectorTransforms,
)


def build_dataset(set_name: str, data_dir: Optional[str] = None) -> dict:
Expand Down
6 changes: 4 additions & 2 deletions gate/data/image/segmentation/coco_10k.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,10 @@
from gate.config.variables import DATASET_DIR
from gate.data.core import GATEDataset
from gate.data.image.segmentation.classes import cocostuff_10k_dict as CLASSES
from gate.data.transforms.segmentation import (BaseDatasetTransforms,
KeySelectorTransforms)
from gate.data.transforms.segmentation import (
BaseDatasetTransforms,
KeySelectorTransforms,
)


def build_dataset(
Expand Down
6 changes: 4 additions & 2 deletions gate/data/image/segmentation/coco_164k.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,10 @@
from gate.config.variables import DATASET_DIR
from gate.data.core import GATEDataset
from gate.data.image.segmentation.classes import cocostuff_164k_dict as CLASSES
from gate.data.transforms.segmentation import (BaseDatasetTransforms,
KeySelectorTransforms)
from gate.data.transforms.segmentation import (
BaseDatasetTransforms,
KeySelectorTransforms,
)

logger = logging.getLogger(__name__)

Expand Down
11 changes: 7 additions & 4 deletions gate/data/image/segmentation/nyu_depth_v2.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,13 @@
from gate.boilerplate.decorators import configurable
from gate.config.variables import DATASET_DIR
from gate.data.core import GATEDataset
from gate.data.image.segmentation.classes import \
nyu_depth_v2_classes as CLASSES
from gate.data.transforms.segmentation import (BaseDatasetTransforms,
KeySelectorTransforms)
from gate.data.image.segmentation.classes import (
nyu_depth_v2_classes as CLASSES,
)
from gate.data.transforms.segmentation import (
BaseDatasetTransforms,
KeySelectorTransforms,
)


def build_dataset(set_name: str, data_dir: Optional[str] = None) -> dict:
Expand Down
15 changes: 9 additions & 6 deletions gate/data/image_text/zero_shot/imagenet1k.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,15 @@
from gate.config.variables import DATASET_DIR
from gate.data.core import GATEDataset
from gate.data.image.classification.imagenet1k import build_dataset
from gate.data.image.classification.metadata.clip_imagenet_class_labels import \
imagenet_classes
from gate.data.image_text.zero_shot.metadata.clip_imagenet_prompts import \
imagenet_prompt_templates
from gate.data.tasks.zero_shot_classification import \
ZeroShotViaLabelDescriptionTask
from gate.data.image.classification.metadata.clip_imagenet_class_labels import (
imagenet_classes,
)
from gate.data.image_text.zero_shot.metadata.clip_imagenet_prompts import (
imagenet_prompt_templates,
)
from gate.data.tasks.zero_shot_classification import (
ZeroShotViaLabelDescriptionTask,
)


def generate_per_class_prompts():
Expand Down
9 changes: 7 additions & 2 deletions gate/data/medical/segmentation/automated_cardiac_diagnosis.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,14 @@
from gate.data.core import GATEDataset
from gate.data.image.segmentation.classes import acdc_labels as CLASSES
from gate.data.medical.segmentation.medical_decathlon import (
convert_to_b3hw, patient_normalization)
convert_to_b3hw,
patient_normalization,
)
from gate.data.transforms.segmentation import (
DualImageRandomCrop, MedicalImageSegmentationTransforms, PhotometricParams)
DualImageRandomCrop,
MedicalImageSegmentationTransforms,
PhotometricParams,
)


def build_dataset(set_name: str, data_dir: Optional[str] = None) -> Dataset:
Expand Down
10 changes: 7 additions & 3 deletions gate/data/medical/segmentation/medical_decathlon.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,14 @@
from gate.boilerplate.utils import enrichen_logger
from gate.config.variables import DATASET_DIR
from gate.data.core import GATEDataset
from gate.data.image.segmentation.classes import \
medical_decathlon_labels as CLASSES_DICT
from gate.data.image.segmentation.classes import (
medical_decathlon_labels as CLASSES_DICT,
)
from gate.data.transforms.segmentation import (
DualImageRandomCrop, MedicalImageSegmentationTransforms, PhotometricParams)
DualImageRandomCrop,
MedicalImageSegmentationTransforms,
PhotometricParams,
)

# Ignore all DeprecationWarnings
warnings.filterwarnings("ignore", category=DeprecationWarning)
Expand Down
5 changes: 3 additions & 2 deletions gate/data/video/classification/build_kinetics_400.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,9 @@
from gate.data.transforms.video import BaseVideoTransform, TrainVideoTransform
from gate.data.video.classification.build_gulp_sparsesample import DatasetNames
from gate.data.video.classification.kinetics_400 import prepare_kinetics_400
from gate.data.video.utils.loader.decord_sparsesample_dataset import \
DecordSparsesampleDataset
from gate.data.video.utils.loader.decord_sparsesample_dataset import (
DecordSparsesampleDataset,
)


def build_dataset(
Expand Down
5 changes: 3 additions & 2 deletions gate/data/video/regression/build_iwildcam_2022.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,9 @@
from gate.data.core import GATEDataset
from gate.data.transforms.video import BaseVideoTransform, TrainVideoTransform
from gate.data.video.regression.iwildcam_2022 import prepare_iwildcam_2022
from gate.data.video.utils.loader.iwildcam2022_dataset import \
IWildCam2022Dataset
from gate.data.video.utils.loader.iwildcam2022_dataset import (
IWildCam2022Dataset,
)


def build_dataset(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,11 @@
from torchvision.transforms import Compose

from . import utils as utils
from .transforms import (GroupNDarrayToPILImage, GroupPILImageToNDarray,
GroupSqueezeScale)
from .transforms import (
GroupNDarrayToPILImage,
GroupPILImageToNDarray,
GroupSqueezeScale,
)

logger = logging.getLogger(__name__)

Expand Down
4 changes: 3 additions & 1 deletion gate/data/video/utils/loader/iwildcam2022_dataset.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,9 @@
from torchvision.transforms import Resize

from gate.data.video.regression.iwildcam_2022 import (
filter_metadata_with_counts, read_all_train_metadata)
filter_metadata_with_counts,
read_all_train_metadata,
)

logger = logging.getLogger(__name__)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,9 @@
from accelerate import Accelerator
from huggingface_hub import snapshot_download

from ..loader.gulp_sparsesample_skeleton_dataset import \
GulpSparsesampleSkeletonDataset
from ..loader.gulp_sparsesample_skeleton_dataset import (
GulpSparsesampleSkeletonDataset,
)


def build_gulp_skeleton_dataset(
Expand Down
Loading

0 comments on commit f42bbe6

Please sign in to comment.