python_code
stringlengths
0
4.04M
repo_name
stringlengths
8
58
file_path
stringlengths
5
147
#!/usr/bin/env python3 # -*- coding: utf-8 -*- # Copyright (c) Meta Platforms, Inc. and affiliates. # All rights reserved. # # This source code is licensed under the license found in the # LICENSE file in the root directory of this source tree. # # Reference (https://ieeexplore.ieee.org/document/9625818) """Encoder m...
AudioDec-main
models/autoencoder/modules/encoder.py
#!/usr/bin/env python3 # -*- coding: utf-8 -*- # Copyright (c) Meta Platforms, Inc. and affiliates. # All rights reserved. # # This source code is licensed under the license found in the # LICENSE file in the root directory of this source tree. # # Reference (https://ieeexplore.ieee.org/document/9625818) """Residual ...
AudioDec-main
models/autoencoder/modules/residual_unit.py
#!/usr/bin/env python3 # -*- coding: utf-8 -*- # Copyright (c) Meta Platforms, Inc. and affiliates. # All rights reserved. # # This source code is licensed under the license found in the # LICENSE file in the root directory of this source tree. """Projector modules.""" import torch import inspect from layers.conv_l...
AudioDec-main
models/autoencoder/modules/projector.py
#!/usr/bin/env python3 # -*- coding: utf-8 -*- # Copyright (c) Meta Platforms, Inc. and affiliates. # All rights reserved. # # This source code is licensed under the license found in the # LICENSE file in the root directory of this source tree. # # Reference (https://github.com/kan-bayashi/ParallelWaveGAN/) # Referenc...
AudioDec-main
models/vocoder/UnivNet.py
#!/usr/bin/env python3 # -*- coding: utf-8 -*- # Copyright (c) Meta Platforms, Inc. and affiliates. # All rights reserved. # # This source code is licensed under the license found in the # LICENSE file in the root directory of this source tree. # # Reference (https://github.com/kan-bayashi/ParallelWaveGAN/) # Referenc...
AudioDec-main
models/vocoder/HiFiGAN.py
#!/usr/bin/env python3 # -*- coding: utf-8 -*- # Copyright (c) Meta Platforms, Inc. and affiliates. # All rights reserved. # # This source code is licensed under the license found in the # LICENSE file in the root directory of this source tree. # # Reference (https://github.com/kan-bayashi/ParallelWaveGAN/) # Referenc...
AudioDec-main
models/vocoder/modules/multi_fusion.py
#!/usr/bin/env python3 # -*- coding: utf-8 -*- # Copyright (c) Meta Platforms, Inc. and affiliates. # All rights reserved. # # This source code is licensed under the license found in the # LICENSE file in the root directory of this source tree. # # Reference (https://github.com/kan-bayashi/ParallelWaveGAN/) # Referenc...
AudioDec-main
models/vocoder/modules/residual_block.py
#!/usr/bin/env python3 # -*- coding: utf-8 -*- # Copyright (c) Meta Platforms, Inc. and affiliates. # All rights reserved. # # This source code is licensed under the license found in the # LICENSE file in the root directory of this source tree. # # Reference (https://github.com/kan-bayashi/ParallelWaveGAN/) # Referenc...
AudioDec-main
models/vocoder/modules/discriminator.py
#!/usr/bin/env python3 # -*- coding: utf-8 -*- # Copyright (c) Meta Platforms, Inc. and affiliates. # All rights reserved. # # This source code is licensed under the license found in the # LICENSE file in the root directory of this source tree. # # Reference (https://github.com/kan-bayashi/ParallelWaveGAN/) """Traini...
AudioDec-main
trainer/vocoder.py
#!/usr/bin/env python3 # -*- coding: utf-8 -*- # Copyright (c) Meta Platforms, Inc. and affiliates. # All rights reserved. # # This source code is licensed under the license found in the # LICENSE file in the root directory of this source tree. # # Reference (https://github.com/kan-bayashi/ParallelWaveGAN/) """Templa...
AudioDec-main
trainer/trainerGAN.py
#!/usr/bin/env python3 # -*- coding: utf-8 -*- # Copyright (c) Meta Platforms, Inc. and affiliates. # All rights reserved. # # This source code is licensed under the license found in the # LICENSE file in the root directory of this source tree. # # Reference (https://github.com/kan-bayashi/ParallelWaveGAN/) """Traini...
AudioDec-main
trainer/autoencoder.py
#!/usr/bin/env python3 # -*- coding: utf-8 -*- # Copyright (c) Meta Platforms, Inc. and affiliates. # All rights reserved. # # This source code is licensed under the license found in the # LICENSE file in the root directory of this source tree. # # Reference (https://github.com/kan-bayashi/ParallelWaveGAN/) """Traini...
AudioDec-main
trainer/denoise.py
from .dataset import * # NOQA from .collater import * # NOQA from .utils import * # NOQA
AudioDec-main
dataloader/__init__.py
#!/usr/bin/env python3 # -*- coding: utf-8 -*- # Copyright (c) Meta Platforms, Inc. and affiliates. # All rights reserved. # # This source code is licensed under the license found in the # LICENSE file in the root directory of this source tree. # # Reference (https://github.com/kan-bayashi/ParallelWaveGAN/) """PyTorc...
AudioDec-main
dataloader/dataset.py
#!/usr/bin/env python3 # -*- coding: utf-8 -*- # Copyright (c) Meta Platforms, Inc. and affiliates. # All rights reserved. # # This source code is licensed under the license found in the # LICENSE file in the root directory of this source tree. # # Reference (https://github.com/kan-bayashi/ParallelWaveGAN/) """Custom...
AudioDec-main
dataloader/collater.py
#!/usr/bin/env python3 # -*- coding: utf-8 -*- # Copyright (c) Meta Platforms, Inc. and affiliates. # All rights reserved. # # This source code is licensed under the license found in the # LICENSE file in the root directory of this source tree. # # Reference (https://github.com/kan-bayashi/ParallelWaveGAN/) import os...
AudioDec-main
dataloader/utils.py
""" Copyright (c) Facebook, Inc. and its affiliates. This source code is licensed under the MIT license found in the LICENSE file in the root directory of this source tree. """ import argparse import inspect import copy import os import ast import yaml import numpy as np def convert_to_stringval(cfg_, squeeze=None,...
c3dpo_nrsfm-main
config.py
""" Copyright (c) Facebook, Inc. and its affiliates. This source code is licensed under the MIT license found in the LICENSE file in the root directory of this source tree. """ from dataset.dataset_configs import STICKS from tools.so3 import so3_exponential_map, rand_rot from tools.functions import masked_kp_mean, \ ...
c3dpo_nrsfm-main
model.py
""" Copyright (c) Facebook, Inc. and its affiliates. This source code is licensed under the MIT license found in the LICENSE file in the root directory of this source tree. """ import os import time import copy import json import numpy as np import torch from dataset.dataset_zoo import dataset_zoo from dataset.eval...
c3dpo_nrsfm-main
experiment.py
""" Copyright (c) Facebook, Inc. and its affiliates. This source code is licensed under the MIT license found in the LICENSE file in the root directory of this source tree. """ import torch from dataset.dataset_zoo import dataset_zoo from dataset.eval_zoo import eval_zoo from experiment import init_model_from_dir fr...
c3dpo_nrsfm-main
evaluate.py
""" Copyright (c) Facebook, Inc. and its affiliates. This source code is licensed under the MIT license found in the LICENSE file in the root directory of this source tree. """ import os import torch from PIL import Image from dataset.dataset_configs import STICKS from experiment import init_model_from_dir from tool...
c3dpo_nrsfm-main
demo.py
""" Copyright (c) Facebook, Inc. and its affiliates. This source code is licensed under the MIT license found in the LICENSE file in the root directory of this source tree. """ import torch def masked_kp_mean(kp_loc, kp_vis): visibility_mass = torch.clamp(kp_vis.sum(1), 1e-4) kp_mean = (kp_loc*kp_vis[:, Non...
c3dpo_nrsfm-main
tools/functions.py
""" Copyright (c) Facebook, Inc. and its affiliates. This source code is licensed under the MIT license found in the LICENSE file in the root directory of this source tree. """ from PIL import Image import tempfile import numpy as np import os import matplotlib import matplotlib.pyplot as plt class VideoWriter: ...
c3dpo_nrsfm-main
tools/video_writer.py
""" Copyright (c) Facebook, Inc. and its affiliates. This source code is licensed under the MIT license found in the LICENSE file in the root directory of this source tree. """ def nested_attr_dict(dct): if type(dct) in (dict, AttrDict): dct = AttrDict(dct) for k, v in dct.items(): dc...
c3dpo_nrsfm-main
tools/attr_dict.py
""" Copyright (c) Facebook, Inc. and its affiliates. This source code is licensed under the MIT license found in the LICENSE file in the root directory of this source tree. """ import pickle import torch import glob import os import yaml def load_stats(flstats): try: stats, _ = pickle.load(open(flstats,...
c3dpo_nrsfm-main
tools/model_io.py
""" Copyright (c) Facebook, Inc. and its affiliates. This source code is licensed under the MIT license found in the LICENSE file in the root directory of this source tree. """ from torch._six import container_abcs, string_classes, int_classes import re import time import sys import torch from tqdm import tqdm from...
c3dpo_nrsfm-main
tools/cache_preds.py
""" Copyright (c) Facebook, Inc. and its affiliates. This source code is licensed under the MIT license found in the LICENSE file in the root directory of this source tree. """ import torch import math import torch.nn.functional as Fu def rand_rot(N, dtype=None, max_rot_angle=float(math.pi), axes=(1, 1...
c3dpo_nrsfm-main
tools/so3.py
""" Copyright (c) Facebook, Inc. and its affiliates. This source code is licensed under the MIT license found in the LICENSE file in the root directory of this source tree. """ from tools.attr_dict import AttrDict import inspect import time import numpy as np import hashlib import torch def pprint_dict(d, indent=3)...
c3dpo_nrsfm-main
tools/utils.py
""" Copyright (c) Facebook, Inc. and its affiliates. This source code is licensed under the MIT license found in the LICENSE file in the root directory of this source tree. """ import numpy as np import time import matplotlib import matplotlib.pyplot as plt from matplotlib import colors as mcolors from itertools impo...
c3dpo_nrsfm-main
tools/stats.py
""" Copyright (c) Facebook, Inc. and its affiliates. This source code is licensed under the MIT license found in the LICENSE file in the root directory of this source tree. """ import numpy as np import io import matplotlib.pyplot as plt from mpl_toolkits.mplot3d import axes3d from matplotlib import cm from PIL impor...
c3dpo_nrsfm-main
tools/vis_utils.py
""" Copyright (c) Facebook, Inc. and its affiliates. This source code is licensed under the MIT license found in the LICENSE file in the root directory of this source tree. """ import os import copy from dataset.dataset_configs import IMAGE_ROOTS, DATASET_ROOT from dataset.keypoints_dataset import KeypointsDataset ...
c3dpo_nrsfm-main
dataset/dataset_zoo.py
""" Copyright (c) Facebook, Inc. and its affiliates. This source code is licensed under the MIT license found in the LICENSE file in the root directory of this source tree. """ import copy import numpy as np from tabulate import tabulate from tqdm import tqdm def eval_zoo(dataset_name, include_debug_vars=False): ...
c3dpo_nrsfm-main
dataset/eval_zoo.py
""" Copyright (c) Facebook, Inc. and its affiliates. This source code is licensed under the MIT license found in the LICENSE file in the root directory of this source tree. """ import os import json import copy import numpy as np import torch import pickle from torch.utils import data from tools.utils import NumpyS...
c3dpo_nrsfm-main
dataset/keypoints_dataset.py
""" Copyright (c) Facebook, Inc. and its affiliates. This source code is licensed under the MIT license found in the LICENSE file in the root directory of this source tree. """ EXP_ROOT = './data/exps/c3dpo/' DATASET_ROOT = './data/datasets/c3dpo/' DATASET_URL = { 'pascal3d_val': 'https://dl.fbaipublicf...
c3dpo_nrsfm-main
dataset/dataset_configs.py
""" Copyright (c) Facebook, Inc. and its affiliates. This source code is licensed under the MIT license found in the LICENSE file in the root directory of this source tree. """ import os import matplotlib.pyplot as plt import torch import numpy as np from tools.video_writer import VideoWriter from tools.vis_utils imp...
c3dpo_nrsfm-main
visuals/rotating_shape_video.py
#!/usr/bin/env python # Copyright (c) Facebook, Inc. and its affiliates. # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. import setuptools with open("README.md", "r") as fh: long_description = fh.read() def parse_requirements_file(pat...
active-mri-acquisition-main
setup.py
# Copyright (c) Facebook, Inc. and its affiliates. # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. import nox @nox.session() def lint(session): session.install("--upgrade", "setuptools", "pip") session.install("-r", "requirements/de...
active-mri-acquisition-main
noxfile.py
# Copyright (c) Facebook, Inc. and its affiliates. # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. from . import data, envs, experimental __all__ = ["data", "envs", "experimental"]
active-mri-acquisition-main
activemri/__init__.py
# Copyright (c) Facebook, Inc. and its affiliates. # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. from . import cvpr19_models __all__ = ["cvpr19_models"]
active-mri-acquisition-main
activemri/experimental/__init__.py
# Copyright (c) Facebook, Inc. and its affiliates. # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. from . import data, models, options, util __all__ = ["data", "models", "options", "util"]
active-mri-acquisition-main
activemri/experimental/cvpr19_models/__init__.py
# Copyright (c) Facebook, Inc. and its affiliates. # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. import ignite.engine import logging import os import tempfile import types import torch import torch.nn.functional as F import torch.optim as ...
active-mri-acquisition-main
activemri/experimental/cvpr19_models/trainer.py
# Copyright (c) Facebook, Inc. and its affiliates. # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. from . import base_options class TrainOptions(base_options.BaseOptions): def initialize(self, parser): parser = base_options.Base...
active-mri-acquisition-main
activemri/experimental/cvpr19_models/options/train_options.py
# Copyright (c) Facebook, Inc. and its affiliates. # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. from . import base_options, train_options # noqa:F401
active-mri-acquisition-main
activemri/experimental/cvpr19_models/options/__init__.py
# Copyright (c) Facebook, Inc. and its affiliates. # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. import argparse import torch class BaseOptions: def __init__(self): self.initialized = False self.parser = None def...
active-mri-acquisition-main
activemri/experimental/cvpr19_models/options/base_options.py
# Copyright (c) Facebook, Inc. and its affiliates. # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. from . import common __all__ = ["common"]
active-mri-acquisition-main
activemri/experimental/cvpr19_models/util/__init__.py
# Copyright (c) Facebook, Inc. and its affiliates. # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. import logging import os from typing import Dict, Optional import matplotlib.pyplot as plt import numpy as np import skimage.measure import to...
active-mri-acquisition-main
activemri/experimental/cvpr19_models/util/common.py
# Copyright (c) Facebook, Inc. and its affiliates. # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. """ cvpr19_models.models.reconstruction.py ====================================== MRI Reconstruction model as described in `Zhang, Zizhao, et a...
active-mri-acquisition-main
activemri/experimental/cvpr19_models/models/reconstruction.py
# Copyright (c) Facebook, Inc. and its affiliates. # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. from . import evaluator, fft_utils, reconstruction # noqa: F401
active-mri-acquisition-main
activemri/experimental/cvpr19_models/models/__init__.py
# Copyright (c) Facebook, Inc. and its affiliates. # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. import torch import torch.nn as nn import torch.nn.functional as F def roll(x, shift, dim): if isinstance(shift, (tuple, list)): ...
active-mri-acquisition-main
activemri/experimental/cvpr19_models/models/fft_utils.py
# Copyright (c) Facebook, Inc. and its affiliates. # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. """ cvpr19_models.models.evaluator.py ================================= Active acquisition model as described in `Zhang, Zizhao, et al. "Reduci...
active-mri-acquisition-main
activemri/experimental/cvpr19_models/models/evaluator.py
# Copyright (c) Facebook, Inc. and its affiliates. # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. import json import os import numpy as np import torch import torch.utils.data import activemri.experimental.cvpr19_models.models.fft_utils as...
active-mri-acquisition-main
activemri/experimental/cvpr19_models/data/dicom_data_loader.py
# Copyright (c) Facebook, Inc. and its affiliates. # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. import os import pathlib import numpy as np import torch import torch.utils.data from . import dicom_data_loader, masking_utils, raw_data_loa...
active-mri-acquisition-main
activemri/experimental/cvpr19_models/data/base_data_loader.py
# Copyright (c) Facebook, Inc. and its affiliates. # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. from . import base_data_loader def create_data_loaders(options, is_test=False): if not is_test: train_loader, valid_loader = bas...
active-mri-acquisition-main
activemri/experimental/cvpr19_models/data/__init__.py
# Copyright (c) Facebook, Inc. and its affiliates. # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. import logging import numpy as np import torch def get_mask_func(mask_type, which_dataset, rnl_params=None): # Whether the number of lin...
active-mri-acquisition-main
activemri/experimental/cvpr19_models/data/masking_utils.py
# Copyright (c) Facebook, Inc. and its affiliates. # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. import pathlib import h5py import numpy as np import torch import torch.utils.data def ifftshift(x, dim=None): if dim is None: d...
active-mri-acquisition-main
activemri/experimental/cvpr19_models/data/raw_data_loader.py
# Copyright (c) Facebook, Inc. and its affiliates. # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. from typing import Any, Dict, Optional import fastmri.models import torch import activemri.models # noinspection PyAbstractClass class Unet...
active-mri-acquisition-main
activemri/models/fastmri_unet_wrapper.py
# Copyright (c) Facebook, Inc. and its affiliates. # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. import abc from typing import Any, Dict, Optional import torch.nn class Reconstructor(torch.nn.Module): def __init__(self, **kwargs): ...
active-mri-acquisition-main
activemri/models/__init__.py
# Copyright (c) Facebook, Inc. and its affiliates. # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. from typing import Any, Dict import torch import activemri.experimental.cvpr19_models.models.reconstruction as cvpr19_reconstruction import a...
active-mri-acquisition-main
activemri/models/cvpr19_reconstructor.py
# Copyright (c) Facebook, Inc. and its affiliates. # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. """ activemri.baselines.ddqn.py ======================================= Baseline implementation of Double DQN, as described in *Van Hasselt, Ha...
active-mri-acquisition-main
activemri/baselines/ddqn.py
# Copyright (c) Facebook, Inc. and its affiliates. # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. from typing import Any, Dict, List, Optional, Tuple import numpy as np import activemri.baselines as baselines import activemri.envs as envs ...
active-mri-acquisition-main
activemri/baselines/evaluation.py
# Copyright (c) Facebook, Inc. and its affiliates. # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. import abc from typing import Any, Dict, List class Policy: """ A basic policy interface. """ def __init__(self, *args, **kwargs): ...
active-mri-acquisition-main
activemri/baselines/__init__.py
# Copyright (c) Facebook, Inc. and its affiliates. # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. """ activemri.baselines.simple_baselines.py ======================================= Simple baselines for active MRI acquisition. """ from typin...
active-mri-acquisition-main
activemri/baselines/simple_baselines.py
# Copyright (c) Facebook, Inc. and its affiliates. # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. import os import tempfile from typing import Dict, Optional import numpy as np import torch class ReplayMemory: """Replay memory of tran...
active-mri-acquisition-main
activemri/baselines/replay_buffer.py
# Copyright (c) Facebook, Inc. and its affiliates. # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. from typing import Any, Dict, List import torch import activemri.experimental.cvpr19_models.models.evaluator as cvpr19_evaluator from . impo...
active-mri-acquisition-main
activemri/baselines/cvpr19_evaluator.py
# Copyright (c) Facebook, Inc. and its affiliates. # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. """ activemri.envs.envs.py ==================================== Gym-like environment for active MRI acquisition. """ import functools import js...
active-mri-acquisition-main
activemri/envs/envs.py
# Copyright (c) Facebook, Inc. and its affiliates. # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. import importlib import json import pathlib from typing import Dict, Tuple import numpy as np import skimage.metrics import torch def get_u...
active-mri-acquisition-main
activemri/envs/util.py
# Copyright (c) Facebook, Inc. and its affiliates. # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. __all__ = [ "ActiveMRIEnv", "MICCAI2020Env", "FastMRIEnv", "SingleCoilKneeEnv", "MultiCoilKneeEnv", ] from .envs import ( ...
active-mri-acquisition-main
activemri/envs/__init__.py
# Copyright (c) Facebook, Inc. and its affiliates. # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. """ activemri.envs.masks.py ==================================== Utilities to generate and manipulate active acquisition masks. """ from typing...
active-mri-acquisition-main
activemri/envs/masks.py
# Copyright (c) Facebook, Inc. and its affiliates. # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. """ activemri.data.transforms.py ==================================== Transform functions to process fastMRI data for reconstruction models. ""...
active-mri-acquisition-main
activemri/data/transforms.py
# Copyright (c) Facebook, Inc. and its affiliates. # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. import pathlib from typing import Callable, List, Optional, Tuple import fastmri import h5py import numpy as np import torch.utils.data # --...
active-mri-acquisition-main
activemri/data/singlecoil_knee_data.py
# Copyright (c) Facebook, Inc. and its affiliates. # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. from typing import Any, Dict, List import numpy as np import torch from . import singlecoil_knee_data from . import transforms __all__ = ["s...
active-mri-acquisition-main
activemri/data/__init__.py
active-mri-acquisition-main
tests/__init__.py
# Copyright (c) Facebook, Inc. and its affiliates. # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. import functools import numpy as np import pytest # noqa: F401 import torch import activemri.envs.envs as envs import activemri.envs.util as...
active-mri-acquisition-main
tests/core/test_envs.py
# Copyright (c) Facebook, Inc. and its affiliates. # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. import numpy as np import pytest # noqa: F401 import torch import activemri.envs.masks as masks def test_update_masks_from_indices(): m...
active-mri-acquisition-main
tests/core/test_masks.py
active-mri-acquisition-main
tests/core/__init__.py
# Copyright (c) Facebook, Inc. and its affiliates. # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. import pytest # noqa: F401 import torch import activemri.baselines as baselines def test_random(): policy = baselines.RandomPolicy() ...
active-mri-acquisition-main
tests/core/test_baselines.py
# Copyright (c) Facebook, Inc. and its affiliates. # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. import json from typing import Dict import numpy as np import torch import activemri.envs.envs as envs cfg_json_str = """ { "data_locati...
active-mri-acquisition-main
tests/core/mocks.py
# Copyright (c) Facebook, Inc. and its affiliates. # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. import json import os import pytest # noqa: F401 import activemri.envs.util def test_all_configs(): configs_root = "configs/" for ...
active-mri-acquisition-main
tests/fastmri/test_configs.py
# Copyright (c) Facebook, Inc. and its affiliates. # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. import numpy as np import pytest # noqa: F401 import activemri.envs.envs as envs class TestMICCAIEnv: env = envs.MICCAI2020Env() d...
active-mri-acquisition-main
tests/fastmri/test_envs.py
# Copyright (c) Facebook, Inc. and its affiliates. # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. # Configuration file for the Sphinx documentation builder. # # This file only contains a selection of the most common options. For a full # lis...
active-mri-acquisition-main
docs/conf.py
# Copyright (c) Facebook, Inc. and its affiliates. # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. import argparse import os import pickle from typing import cast import numpy as np import torch import activemri.baselines as baselines impo...
active-mri-acquisition-main
examples/run_evaluation.py
# Copyright (c) Facebook, Inc. and its affiliates. # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. import argparse import activemri.baselines.ddqn as ddqn import activemri.envs as envs if __name__ == "__main__": parser = argparse.Argume...
active-mri-acquisition-main
examples/test_ddqn.py
# Copyright (c) Facebook, Inc. and its affiliates. # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. import argparse import torch import activemri.baselines as mri_baselines import activemri.envs as envs if __name__ == "__main__": parser...
active-mri-acquisition-main
examples/train_ddqn.py
#!/usr/bin/env python3 # Copyright (c) Meta Platforms, Inc. and affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. """ This is the main script used for training Classy Vision jobs. This can be used for training on your local machin...
ClassyVision-main
classy_train.py
#!/usr/bin/env python3 # Copyright (c) Meta Platforms, Inc. and affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. import os import re import sys from setuptools import find_namespace_packages, find_packages, setup if __name__ =...
ClassyVision-main
setup.py
#!/usr/bin/env python3 # Copyright (c) Meta Platforms, Inc. and affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. import functools import torch from classy_vision.hub import ClassyHubInterface dependencies = ["torch", "torchvisi...
ClassyVision-main
hubconf.py
#!/usr/bin/env python3 # Copyright (c) Meta Platforms, Inc. and affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. import unittest import torch from classy_vision.generic.util import convert_to_one_hot class TestUtils(unittest.Te...
ClassyVision-main
test/losses_generic_utils_test.py
#!/usr/bin/env python3 # Copyright (c) Meta Platforms, Inc. and affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. import os import unittest import torch from classy_vision.models import ClassyBlock class TestClassyStatelessBlock...
ClassyVision-main
test/models_classy_block_stateless_test.py
#!/usr/bin/env python3 # Copyright (c) Meta Platforms, Inc. and affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. import unittest import torch from classy_vision.models import build_model, EfficientNet class TestEfficientNetMode...
ClassyVision-main
test/models_efficientnet_test.py
#!/usr/bin/env python3 # Copyright (c) Meta Platforms, Inc. and affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. import copy import torch import torch.nn as nn from classy_vision.hooks import ClassyHook from classy_vision.hooks.p...
ClassyVision-main
test/hooks_precise_batch_norm_hook_test.py
#!/usr/bin/env python3 # Copyright (c) Meta Platforms, Inc. and affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. import torch from classy_vision import meters from classy_vision.meters import RecallAtKMeter from test.generic.meter...
ClassyVision-main
test/meters_recall_meter_test.py
#!/usr/bin/env python3 # Copyright (c) Meta Platforms, Inc. and affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. import unittest import unittest.mock as mock from classy_vision.hooks import ProfilerHook from test.generic.config_u...
ClassyVision-main
test/hooks_profiler_hook_test.py
#!/usr/bin/env python3 # Copyright (c) Meta Platforms, Inc. and affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. import tempfile import unittest from itertools import product from typing import Any, Dict, List import torch from c...
ClassyVision-main
test/generic_distributed_util_test.py
#!/usr/bin/env python3 # Copyright (c) Meta Platforms, Inc. and affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. import copy import unittest import torch from classy_vision.losses import BarronLoss, build_loss class TestBarronL...
ClassyVision-main
test/losses_barron_loss_test.py
#!/usr/bin/env python3 # Copyright (c) Meta Platforms, Inc. and affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. import copy import unittest from classy_vision.optim.param_scheduler import build_param_scheduler from classy_vision...
ClassyVision-main
test/optim_param_scheduler_composite_test.py
#!/usr/bin/env python3 # Copyright (c) Meta Platforms, Inc. and affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. import copy import unittest from classy_vision.hooks import build_hook, build_hooks, ClassyHook, register_hook @re...
ClassyVision-main
test/hooks_classy_hook_test.py
#!/usr/bin/env python3 # Copyright (c) Meta Platforms, Inc. and affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. import copy import unittest import torch from classy_vision.losses import build_loss, LabelSmoothingCrossEntropyLoss...
ClassyVision-main
test/losses_label_smoothing_cross_entropy_loss_test.py
#!/usr/bin/env python3 # Copyright (c) Meta Platforms, Inc. and affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. import unittest from classy_vision.optim.rmsprop_tf import RMSPropTF from test.generic.optim_test_util import TestOp...
ClassyVision-main
test/optim_rmsprop_tf_test.py
#!/usr/bin/env python3 # Copyright (c) Meta Platforms, Inc. and affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. import torch from classy_vision import meters from classy_vision.meters import VideoAccuracyMeter from test.generic.m...
ClassyVision-main
test/meters_video_accuracy_meter_test.py
#!/usr/bin/env python3 # Copyright (c) Meta Platforms, Inc. and affiliates. # # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. import unittest from unittest.mock import Mock from classy_vision.dataset import build_dataset from classy_vision.ho...
ClassyVision-main
test/optim_param_scheduler_test.py