python_code stringlengths 0 4.04M | repo_name stringlengths 7 58 | file_path stringlengths 5 147 |
|---|---|---|
#!/usr/bin/env python
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved
import argparse
import builtins
import math
import os
import random
import shutil
import time
import warnings
import torch
import torch.nn as nn
import torch.nn.parallel
import torch.backends.cudnn as cudnn
import torch.distri... | asym-siam-main | main_moco.py |
#!/usr/bin/env python
# Copyright (c) Facebook, Inc. and its 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.
import argparse
import builtins
import math
import os
import random
import shutil
import time
import w... | asym-siam-main | main_lincls.py |
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved
| asym-siam-main | moco/__init__.py |
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved
import torch
import torch.nn as nn
class MoCo(nn.Module):
"""
Build a MoCo model with: a query encoder, a key encoder, and a queue
https://arxiv.org/abs/1911.05722
"""
def __init__(
self,
base_encoder,
... | asym-siam-main | moco/builder.py |
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved
from PIL import ImageFilter
import random
import numpy as np
"""
# --------------------------------------------------------------------------- #
# ScaleMix #
# ---------------------... | asym-siam-main | moco/loader.py |
# Copyright 2017-present, Facebook, Inc.
# All rights reserved.
#
# This source code is licensed under the BSD-style license found in the
# LICENSE file in the root directory of this source tree. An additional grant
# of patent rights can be found in the PATENTS file in the same directory.
import argparse, json, os
"... | clevr-dataset-gen-main | image_generation/collect_scenes.py |
# Copyright 2017-present, Facebook, Inc.
# All rights reserved.
#
# This source code is licensed under the BSD-style license found in the
# LICENSE file in the root directory of this source tree. An additional grant
# of patent rights can be found in the PATENTS file in the same directory.
from __future__ import print... | clevr-dataset-gen-main | image_generation/render_images.py |
# Copyright 2017-present, Facebook, Inc.
# All rights reserved.
#
# This source code is licensed under the BSD-style license found in the
# LICENSE file in the root directory of this source tree. An additional grant
# of patent rights can be found in the PATENTS file in the same directory.
import sys, random, os
impor... | clevr-dataset-gen-main | image_generation/utils.py |
# Copyright 2017-present, Facebook, Inc.
# All rights reserved.
#
# This source code is licensed under the BSD-style license found in the
# LICENSE file in the root directory of this source tree. An additional grant
# of patent rights can be found in the PATENTS file in the same directory.
import json, os, math
from c... | clevr-dataset-gen-main | question_generation/question_engine.py |
# Copyright 2017-present, Facebook, Inc.
# All rights reserved.
#
# This source code is licensed under the BSD-style license found in the
# LICENSE file in the root directory of this source tree. An additional grant
# of patent rights can be found in the PATENTS file in the same directory.
from __future__ import print... | clevr-dataset-gen-main | question_generation/generate_questions.py |
# Copyright (c) Facebook, Inc. and its affiliates.
import setuptools
with open("README.md", "r") as fh:
long_description = fh.read()
setuptools.setup(
name="c3dm", # Replace with your own username
version="1.0.0",
author="Facebook AI Research",
author_email="romansh@fb.com",
description="""Co... | c3dm-main | setup.py |
# Copyright (c) Facebook, Inc. and its affiliates.
import matplotlib
matplotlib.use('Agg')
import matplotlib.pyplot as plt
import os
import torch
from torch import nn as nn
import torch.nn.functional as Fu
import numpy as np
from tools.utils import NumpySeedFix, auto_init_args
from tools.vis_utils import get_visdom_... | c3dm-main | c3dm/c3dpo.py |
# Copyright (c) Facebook, Inc. and its affiliates.
import argparse
import inspect
import copy
import os
import yaml
import ast
import numpy as np
from tools.attr_dict import nested_attr_dict
from tools.utils import auto_init_args
def convert_to_stringval(cfg_,squeeze=None,stringify_vals=False):
out = {}
conv... | c3dm-main | c3dm/config.py |
# Copyright (c) Facebook, Inc. and its affiliates.
import torch
from torch import nn
from torch.nn import Parameter
import torch.nn.functional as Fu
import torchvision
from torchvision import models
from visdom import Visdom
import numpy as np
from tools.utils import auto_init_args
import torchvision
import collecti... | c3dm-main | c3dm/hypercolumnet.py |
c3dm-main | c3dm/__init__.py | |
# Copyright (c) Facebook, Inc. and its affiliates.
import copy
from functools import lru_cache
import math
import os
import yaml
import numpy as np
import torch
import torch.nn.functional as Fu
from pytorch3d.renderer import cameras
from pytorch3d.transforms import so3
from visdom import Visdom
import c3dpo
from h... | c3dm-main | c3dm/model.py |
#!/usr/bin/env python3
# Copyright (c) Facebook, Inc. and its affiliates.
import matplotlib
matplotlib.use('Agg')
import matplotlib.pyplot as plt
import copy, os, sys, time
import itertools as itt
import yaml
# torch imports
import numpy as np
import torch
from dataset.batch_samplers import SceneBatchSampler
from ... | c3dm-main | c3dm/experiment.py |
# Copyright (c) Facebook, Inc. and its affiliates.
import torch
import torch.nn.functional as Fu
def image_meshgrid(bounds,resol):
"""
bounds in 3x2
resol in 3x1
"""
# he,wi,de = resol
# minw,maxw = bounds[0]
# minh,maxh = bounds[1]
# mind,maxd = bounds[2]
axis = [ ((torch.arange(sz).float())/(sz-1))*(b[1]... | c3dm-main | c3dm/tools/pcl_unproject.py |
# Copyright (c) Facebook, Inc. and its affiliates.
import torch
import torch.nn.functional as Fu
import numpy as np
import collections
import warnings
def clamp_depth(X, min_depth):
xy, depth = X[:,0:2], X[:,2:]
depth = torch.clamp(depth, min_depth)
return torch.cat((xy,depth), dim=1)
def calc_ray_projection(X, Y... | c3dm-main | c3dm/tools/functions.py |
# Copyright (c) Facebook, Inc. and its affiliates.
from tools.utils import auto_init_args
import torch
import torch.nn.functional as Fu
from torch.nn import Parameter
from tools.utils import Timer
class TensorAccumulator(torch.nn.Module):
def __init__(self, db_size=30000, db_dim=3, perc_replace=0.01):
super().__in... | c3dm-main | c3dm/tools/tensor_accumulator.py |
# -*- coding: utf-8 -*-
# Copyright (c) Facebook, Inc. and its affiliates.
"""Pretty-print tabular data."""
from __future__ import print_function
from __future__ import unicode_literals
from collections import namedtuple
from platform import python_version_tuple
import re
import math
if python_version_tuple() >= (... | c3dm-main | c3dm/tools/tabulate.py |
# Copyright (c) Facebook, Inc. and its affiliates.
import torch
import torch.nn.functional as Fu
def find_camera_T(K, X, Y):
n = X.shape[2]
ba = X.shape[0]
append1 = lambda x: \
torch.cat((x,x.new_ones(x.shape[0],1,x.shape[2])), dim=1)
# projection rays
r = torch.bmm(torch.inverse(K), a... | c3dm-main | c3dm/tools/test_orth2pers.py |
# Copyright (c) Facebook, Inc. and its affiliates.
import copy
def nested_attr_dict(dct):
if type(dct) in (dict,AttrDict):
dct = AttrDict(dct)
for k,v in dct.items():
dct[k] = nested_attr_dict(v)
return dct
class AttrDict(dict):
def __getattr__(self, name):
if name in... | c3dm-main | c3dm/tools/attr_dict.py |
c3dm-main | c3dm/tools/__init__.py | |
# Copyright (c) Facebook, Inc. and its affiliates.
import pickle
import torch
import glob
import os
def load_stats(flstats):
try:
stats, _ = pickle.load(open(flstats,'rb')) # dont load the config
except Exception as e:
print("Cant load stats! %s" % flstats)
stats = None
return stat... | c3dm-main | c3dm/tools/model_io.py |
# Copyright (c) Facebook, Inc. and its affiliates.
import matplotlib
matplotlib.use('Agg')
import matplotlib.pyplot as plt
import os
import time
import sys
import copy
import torch
from tqdm import tqdm
from tools.stats import Stats
from tools.utils import pprint_dict, has_method, get_net_input
def cache_preds(mod... | c3dm-main | c3dm/tools/cache_preds.py |
# Copyright (c) Facebook, Inc. and its affiliates.
import torch
import math
import torch.nn.functional as Fu
def so3_6d_to_rot(d6):
"""
d6 ... batch x 6
Follows Sec. B in the appendix of:
https://arxiv.org/pdf/1812.07035.pdf
"""
a1, a2 = d6[:, :3], d6[:, 3:]
b1 = Fu.normalize(a1, dim=1)... | c3dm-main | c3dm/tools/so3.py |
# Copyright (c) Facebook, Inc. and its affiliates.
from tools.attr_dict import AttrDict
import inspect
import io
import os
import tarfile
import time
import urllib.request
import zipfile
import numpy as np
def pprint_dict(d, indent=3):
for key, value in d.items():
print(' ' * indent + str(key),end='', flush=True)... | c3dm-main | c3dm/tools/utils.py |
# Copyright (c) Facebook, Inc. and its affiliates.
import torch
import torch.nn as nn
from torchvision import models
import torch.nn.functional as F
Fu = F
from torch.autograd import Variable
import numpy as np
from math import exp
from tools.functions import avg_l2_dist, avg_l2_huber, image_meshgrid, huber, logexplo... | c3dm-main | c3dm/tools/loss_models.py |
# Copyright (c) Facebook, Inc. and its affiliates.
import os
import numpy as np
import sys
import time
import pickle
import matplotlib
import matplotlib.pyplot as plt
import copy
from matplotlib import colors as mcolors
from itertools import cycle
from collections.abc import Iterable
from tools.vis_utils import get_v... | c3dm-main | c3dm/tools/stats.py |
# Copyright (c) Facebook, Inc. and its affiliates.
import numpy as np
import copy
import io
import os
from matplotlib import cm
import matplotlib.pyplot as plt
from PIL import Image
from PIL import ImageFont
from PIL import ImageDraw
import torch
from tools.utils import NumpySeedFix
from visdom import Visdom
imp... | c3dm-main | c3dm/tools/vis_utils.py |
# Copyright (c) Facebook, Inc. and its affiliates.
from visdom import Visdom
from tools.vis_utils import get_visdom_connection, denorm_image_trivial
import plotly.graph_objects as go
from plotly.subplots import make_subplots
import numpy as np
import os
from PIL import Image
fig = make_subplots(
rows = ... | c3dm-main | c3dm/tools/visdom_plotly.py |
# Copyright (c) Facebook, Inc. and its affiliates.
import time
import torch
import torch.nn.functional as Fu
import numpy as np
import collections
from tools.functions import safe_sqrt
from tools.pcl_unproject import depth2pcl
def in_hull(p, hull, extendy=False):
"""
Test if points in `p` are in `hull`
`p` shoul... | c3dm-main | c3dm/tools/eval_functions.py |
# Copyright (c) Facebook, Inc. and its affiliates.
import os
import copy
import io
import gzip
import urllib.request
from dataset.dataset_configs import (
IMAGE_ROOTS, MASK_ROOTS, DEPTH_ROOTS, DATASET_ROOT, DATASET_CFG,
IMAGE_URLS, MASK_URLS, DEPTH_URLS
)
from dataset.keypoints_dataset import KeypointsDataset
from... | c3dm-main | c3dm/dataset/dataset_zoo.py |
# Copyright (c) Facebook, Inc. and its affiliates.
import numpy as np
import torch
from tools.utils import Timer
from torch.utils.data.sampler import Sampler
from torch._six import int_classes as _int_classes
class SceneBatchSampler(Sampler):
def __init__(self, sampler, batch_size, drop_last, \
train=True,... | c3dm-main | c3dm/dataset/batch_samplers.py |
# Copyright (c) Facebook, Inc. and its affiliates.
import torch
import numpy as np
import copy
from model import load_nrsfm_model
from tools.cache_preds import cache_preds
def run_c3dpo_model_on_dset(dset, nrsfm_exp_dir):
print('caching c3dpo outputs')
# make a dataset copy without any random sampling
# and ima... | c3dm-main | c3dm/dataset/c3dpo_annotate.py |
# Copyright (c) Facebook, Inc. and its affiliates.
from collections import defaultdict
import json
import os
import numpy as np
import torch
import trimesh
from visdom import Visdom
from dataset.dataset_configs import IMAGE_ROOTS
from dataset.keypoints_dataset import load_depth, load_mask
from tools.eval_functions i... | c3dm-main | c3dm/dataset/eval_zoo.py |
# Copyright (c) Facebook, Inc. and its affiliates.
import torch
import os
import sys
import json
import copy
import glob
import pickle, gzip
import numpy as np
import torch
from PIL import Image
from torch.utils import data
from tools.utils import NumpySeedFix, auto_init_args
class KeypointsDataset(data.Dataset)... | c3dm-main | c3dm/dataset/keypoints_dataset.py |
# Copyright (c) Facebook, Inc. and its affiliates.
import copy
# list of root folders containing the dataset images
IMAGE_ROOTS = {
'freicars_clickp_filtd': ('./dataset_root/freicars/',),
'freicars_clickp_filtd_dbg': ('./dataset_root/freicars/',),
'cub_birds_hrnet_v2': ('./dataset_root/cub_birds/',),
... | c3dm-main | c3dm/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.
"""
from setuptools import find_packages, setup
install_requires = [
"numpy",
"pandas",
"Pillow",
"pytorch-lightning",
"pyyam... | CovidPrognosis-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.
"""
from pathlib import Path
import numpy as np
import pytest
import yaml
from covidprognosis.data import (
CheXpertDataset,
CombinedXray... | CovidPrognosis-main | tests/conftest.py |
CovidPrognosis-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 pytest
import torchvision.transforms as tvt
from covidprognosis.data.transforms import Compose
from .conftest import fetch_dataset
@... | CovidPrognosis-main | tests/test_xray_datasets.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 covidprognosis.data.transforms as cpt
import numpy as np
import pytest
import torch
import torchvision.transforms as tvt
from scipy.ndi... | CovidPrognosis-main | tests/test_transforms.py |
import covidprognosis.data
import covidprognosis.models
import covidprognosis.plmodules
| CovidPrognosis-main | covidprognosis/__init__.py |
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved
# Code adapted from https://github.com/facebookresearch/moco
from typing import Tuple
import torch
import torch.nn as nn
from torch import Tensor
class MoCo(nn.Module):
"""
Build a MoCo model with: a query encoder, a key encoder, and a qu... | CovidPrognosis-main | covidprognosis/models/moco_model.py |
from .moco_model import MoCo
| CovidPrognosis-main | covidprognosis/models/__init__.py |
from .xray_datamodule import XrayDataModule
| CovidPrognosis-main | covidprognosis/plmodules/__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 os
from argparse import ArgumentParser
from typing import Callable, List, Optional, Union
import covidprognosis as cp
import numpy as ... | CovidPrognosis-main | covidprognosis/plmodules/xray_datamodule.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 Callable, Dict, List, Tuple, Union
import numpy as np
import torch
from scipy.ndimage import gaussian_filter
class XRayT... | CovidPrognosis-main | covidprognosis/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 os
from pathlib import Path
from typing import Callable, Dict, List, Optional, Union
import numpy as np
import pandas as pd
from PIL i... | CovidPrognosis-main | covidprognosis/data/base_dataset.py |
from .base_dataset import BaseDataset
from .chexpert import CheXpertDataset
from .combined_datasets import CombinedXrayDataset
from .mimic_cxr import MimicCxrJpgDataset
from .nih_chest_xrays import NIHChestDataset
| CovidPrognosis-main | covidprognosis/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 os
from typing import Callable, Dict, List, Optional, Union
import numpy as np
import pandas as pd
from .base_dataset ... | CovidPrognosis-main | covidprognosis/data/chexpert.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
from typing import Callable, List, Optional, Union
from .base_dataset import BaseDataset
from .chexpert import CheXpertDataset
from... | CovidPrognosis-main | covidprognosis/data/combined_datasets.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 Callable, Dict, List, Optional, Union
import numpy as np
import pandas as pd
from .base_dataset ... | CovidPrognosis-main | covidprognosis/data/nih_chest_xrays.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 Callable, Dict, List, Optional, Union
import numpy as np
import pandas as pd
from .base_dataset ... | CovidPrognosis-main | covidprognosis/data/mimic_cxr.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.utils.data._utils.collate import default_collate
def collate_fn(batch):
"""Collate function to handle X-ray metadata."""
... | CovidPrognosis-main | covidprognosis/data/collate_fn.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 argparse import ArgumentParser
import covidprognosis as cp
import pytorch_lightning as pl
import torch
import torchvision.models as mode... | CovidPrognosis-main | cp_examples/moco_pretrain/moco_module.py |
CovidPrognosis-main | cp_examples/moco_pretrain/__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 os
from argparse import ArgumentParser
from pathlib import Path
import pytorch_lightning as pl
import yaml
from covidprognosis.data.tr... | CovidPrognosis-main | cp_examples/moco_pretrain/train_moco.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 argparse import ArgumentParser
from pathlib import Path
import math
import pytorch_lightning as pl
import torch
import torch.nn as nn
im... | CovidPrognosis-main | cp_examples/mip_finetune/mip_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 logging
import os
from argparse import ArgumentParser
from pathlib import Path
from warnings import warn
import numpy as np
import pyt... | CovidPrognosis-main | cp_examples/mip_finetune/train_mip.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 argparse import ArgumentParser
from pathlib import Path
import pytorch_lightning as pl
import requests
import torch
import torchvision.m... | CovidPrognosis-main | cp_examples/sip_finetune/sip_finetune.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 argparse import ArgumentParser
from pathlib import Path
from warnings import warn
import numpy as np
import pyt... | CovidPrognosis-main | cp_examples/sip_finetune/train_sip.py |
# 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.
import argparse
import datetime
import numpy as np
import time
import json
import os
from pathlib import Path
import to... | ConvNeXt-V2-main | main_pretrain.py |
# 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.
import argparse
import os
import uuid
from pathlib import Path
import main_finetune as trainer
import submitit
def par... | ConvNeXt-V2-main | submitit_finetune.py |
# 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.
import os
from torchvision import datasets, transforms
from timm.data.constants import \
IMAGENET_DEFAULT_MEAN, IMA... | ConvNeXt-V2-main | datasets.py |
# 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.
import math
from typing import Iterable, Optional
import torch
from timm.data import Mixup
from timm.utils import accu... | ConvNeXt-V2-main | engine_finetune.py |
# 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.
import math
import sys
from typing import Iterable
import torch
import utils
def train_one_epoch(model: torch.nn.Modul... | ConvNeXt-V2-main | engine_pretrain.py |
# 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.
import os
import math
import time
from collections import defaultdict, deque
import datetime
import numpy as np
from tim... | ConvNeXt-V2-main | utils.py |
# 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.
import argparse
import os
import uuid
from pathlib import Path
import main_pretrain as trainer
import submitit
def par... | ConvNeXt-V2-main | submitit_pretrain.py |
# 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.
import argparse
import datetime
import numpy as np
import time
import json
import os
from pathlib import Path
import to... | ConvNeXt-V2-main | main_finetune.py |
# 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.
import torch
from torch import optim as optim
from timm.optim.adafactor import Adafactor
from timm.optim.adahessian imp... | ConvNeXt-V2-main | optim_factory.py |
# 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.
import torch
import torch.nn as nn
import torch.nn.functional as F
from timm.models.layers import trunc_normal_, DropPath... | ConvNeXt-V2-main | models/convnextv2.py |
# 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.
import torch
import torch.nn as nn
from timm.models.layers import trunc_normal_
from .utils import (
LayerNorm,
... | ConvNeXt-V2-main | models/convnextv2_sparse.py |
# 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.
import torch
import torch.nn as nn
from MinkowskiEngine import (
MinkowskiConvolution,
MinkowskiDepthwiseConvol... | ConvNeXt-V2-main | models/fcmae.py |
# 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.
import numpy.random as random
import torch
import torch.nn as nn
import torch.nn.functional as F
from MinkowskiEngine i... | ConvNeXt-V2-main | models/utils.py |
"""
Copyright (c) Meta Platforms, Inc. and affiliates.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to... | Data_Acquisition_for_ML_Benchmark-main | src/dam.py |
"""
Copyright (c) Meta Platforms, Inc. and affiliates.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to... | Data_Acquisition_for_ML_Benchmark-main | src/buyer.py |
"""
Copyright (c) Meta Platforms, Inc. and affiliates.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to... | Data_Acquisition_for_ML_Benchmark-main | src/marketengine.py |
"""
Copyright (c) Meta Platforms, Inc. and affiliates.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to... | Data_Acquisition_for_ML_Benchmark-main | src/visualize_acc_cost.py |
"""
Copyright (c) Meta Platforms, Inc. and affiliates.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to... | Data_Acquisition_for_ML_Benchmark-main | src/evaluator_acc_cost.py |
import matplotlib # noqa
matplotlib.use('Agg') # noqa
import matplotlib.pyplot as plt
plt.rcParams['axes.facecolor'] = 'white'
import numpy as np
import matplotlib.ticker as ticker
import json
import seaborn as sn
import pandas as pd
from matplotlib.colors import LogNorm
import seaborn as sns
from matplotlib.colors... | Data_Acquisition_for_ML_Benchmark-main | src/visualizetools.py |
"""
Copyright (c) Meta Platforms, Inc. and affiliates.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to... | Data_Acquisition_for_ML_Benchmark-main | src/example.py |
"""
Copyright (c) Meta Platforms, Inc. and affiliates.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to... | Data_Acquisition_for_ML_Benchmark-main | src/utils.py |
"""
Copyright (c) Meta Platforms, Inc. and affiliates.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to... | Data_Acquisition_for_ML_Benchmark-main | src/seller.py |
"""
Copyright (c) Meta Platforms, Inc. and affiliates.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to... | Data_Acquisition_for_ML_Benchmark-main | src/helper.py |
"""
Copyright (c) Meta Platforms, Inc. and affiliates.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to... | Data_Acquisition_for_ML_Benchmark-main | src/pricefunction.py |
"""
Copyright (c) Meta Platforms, Inc. and affiliates.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to... | Data_Acquisition_for_ML_Benchmark-main | src/evaluator.py |
"""
Copyright (c) Meta Platforms, Inc. and affiliates.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to... | Data_Acquisition_for_ML_Benchmark-main | src/evaluator_submission.py |
#!/usr/bin/env python
# Copyright (c) Facebook, Inc. and its affiliates.
# coding: utf-8
# In[1]:
import os, sys
import time
sys.path.insert(0, '..')
import numpy as np
import matplotlib.pyplot as plt
from matplotlib.cbook import flatten
import lib
import torch, torch.nn as nn
import torch.nn.functional as F
from s... | Augur-main | train/augur_node_trainer.py |
from __future__ import print_function, division
import imgaug as ia
import augmenters as iaa
import parameters as iap
#from skimage import
import numpy as np
from scipy import ndimage, misc
from skimage import data
import matplotlib.pyplot as plt
from matplotlib import gridspec
import six
import six.moves as sm
def ma... | imgaug-master | generate_example_images.py |
imgaug-master | __init__.py | |
from setuptools import setup, find_packages
try:
import cv2
except ImportError as e:
raise Exception("Could not find package 'cv2' (OpenCV). It cannot be automatically installed, so you will have to manually install it.")
long_description = """A library for image augmentation in machine learning experiments, ... | imgaug-master | setup.py |
"""
Tests to measure the performance of each augmenter.
Run these checks from the project directory (i.e. parent directory) via
python check_performance.py
"""
from __future__ import print_function, division
#import sys
#import os
#sys.path.append(os.path.join(os.path.dirname(__file__), '..'))
import imgaug as ia... | imgaug-master | tests/check_performance.py |
"""
Tests to visually inspect the results of the library's functionality.
Run these checks from the project directory (i.e. parent directory) via
python check_visually.py
"""
from __future__ import print_function, division
#import sys
#import os
#sys.path.append(os.path.join(os.path.dirname(__file__), '..'))
impo... | imgaug-master | tests/check_visually.py |
"""
Script to verify all examples in the readme.
Run from the project directory (i.e. parent) with
python test_readme_examples.py
"""
from __future__ import print_function, division
#import sys
#import os
#sys.path.append(os.path.join(os.path.dirname(__file__), '..'))
import numpy as np
from scipy import misc
de... | imgaug-master | tests/test_readme_examples.py |
"""
Automatically running tests for this library.
Run these from the project directory (i.e. parent directory) via
python test.py
"""
from __future__ import print_function, division
#import sys
#import os
#sys.path.append(os.path.join(os.path.dirname(__file__), '..'))
import imgaug as ia
from imgaug import augmen... | imgaug-master | tests/test.py |
# -*- coding: utf-8 -*-
"""Wrapper functions and classes around scikit-images AffineTransformation.
Simplifies augmentation of images in machine learning.
Example usage:
img_width = 32 # width of the images
img_height = 32 # height of the images
images = ... # e.g. load via scipy.misc.imload(fi... | imgaug-master | old_version/ImageAugmenter.py |
"""Tests functionality of the ImageAugmenter class."""
from __future__ import print_function
# make sure that ImageAugmenter can be imported from parent directory
if __name__ == '__main__' and __package__ is None:
from os import sys, path
sys.path.append(path.dirname(path.dirname(path.abspath(__file__))))
imp... | imgaug-master | old_version/tests/TestImageAugmenter.py |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.