python_code
stringlengths
0
4.04M
repo_name
stringlengths
7
58
file_path
stringlengths
5
147
# 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. # from torch import nn from functools import partial from einops.layers.torch import Rearrange, Reduce import torch.nn as n...
alma-main
crlapi/sl/architectures/mlpmixer.py
# 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 torch import torch.nn as nn import torch.nn.functional as F import torchvision import numpy as np import time im...
alma-main
crlapi/sl/architectures/firefly_vgg/models.py
# 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. # # *** MODULES taken from original code https://github.com/klightz/Firefly import numpy as np import time import torch...
alma-main
crlapi/sl/architectures/firefly_vgg/sp/net.py
# 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. # # *** MODULES taken from original code https://github.com/klightz/Firefly from .conv import Conv2d from .net import SpN...
alma-main
crlapi/sl/architectures/firefly_vgg/sp/__init__.py
# 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. # # *** MODULES taken from original code https://github.com/klightz/Firefly import numpy as np import torch import torch...
alma-main
crlapi/sl/architectures/firefly_vgg/sp/module.py
# 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. # # *** MODULES taken from original code https://github.com/klightz/Firefly import math import numpy as np import torch...
alma-main
crlapi/sl/architectures/firefly_vgg/sp/conv.py
# 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 sys import copy import time from pydoc import locate import numpy as np import torch import torch.nn as nn import...
alma-main
crlapi/sl/clmodels/firefly.py
# 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 torch import torch.nn as nn import torch.nn.functional as F from crlapi.core import CLModel from crlapi.sl.clmodel...
alma-main
crlapi/sl/clmodels/adaboost.py
# 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 torch import torch.nn as nn import torch.nn.functional as F from crlapi.core import CLModel from crlapi.sl.clmodel...
alma-main
crlapi/sl/clmodels/agg_ensemble.py
# 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 torch import torch.nn as nn import torch.nn.functional as F from crlapi.core import CLModel from crlapi.sl.clmodel...
alma-main
crlapi/sl/clmodels/bagging.py
# 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 torch import torch.nn as nn import torch.nn.functional as F from crlapi.core import CLModel from crlapi.sl.clmodel...
alma-main
crlapi/sl/clmodels/boosting.py
# 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 copy import numpy as np from pydoc import locate from random import shuffle from crlapi.core import CLModel from f...
alma-main
crlapi/sl/clmodels/core.py
# 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 torch import torch.nn as nn import torch.nn.functional as F from crlapi.core import CLModel from crlapi.sl.clmodel...
alma-main
crlapi/sl/clmodels/ensemble.py
# 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 torch import torch.nn as nn import torch.nn.functional as F from crlapi.core import CLModel from crlapi.sl.clmodel...
alma-main
crlapi/sl/clmodels/debug_ensemble.py
# 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 torch import torch.nn as nn import torch.nn.functional as F from crlapi.core import CLModel from crlapi.sl.clmodel...
alma-main
crlapi/sl/clmodels/k_ensemble.py
# 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 copy import torch import numpy as np import torch.nn.functional as F from crlapi.core import CLModel from crlapi....
alma-main
crlapi/sl/clmodels/finetune_grow.py
# 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 torch import torch.nn as nn import torch.nn.functional as F from crlapi.core import CLModel from crlapi.sl.clmodel...
alma-main
crlapi/sl/clmodels/finetune.py
#!/usr/bin/env python3 # 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 json import re from datetime import datetime import requests def get_ad_archive_id(data):...
Ad-Library-API-Script-Repository-main
python/fb_ads_library_api.py
#!/usr/bin/env python3 # 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 datetime import json from collections import Counter def get_operators(): """ Feel...
Ad-Library-API-Script-Repository-main
python/fb_ads_library_api_operators.py
#!/usr/bin/env python3 # 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. from iso3166 import countries supported_countries = [ "AT", "BE", "BG", "CA", ...
Ad-Library-API-Script-Repository-main
python/fb_ads_library_api_utils.py
#!/usr/bin/env python3 # 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 sys from fb_ads_library_api import FbAdsLibraryTraversal from fb_ads_library...
Ad-Library-API-Script-Repository-main
python/fb_ads_library_api_cli.py
import argparse from utils.train_utils import add_flags_from_config config_args = { 'training_config': { 'lr': (0.01, 'learning rate'), 'dropout': (0.0, 'dropout probability'), 'cuda': (-1, 'which cuda device to use (-1 for cpu training)'), 'epochs': (5000, 'maximum number of epoch...
hgcn-master
config.py
from __future__ import print_function from __future__ import division
hgcn-master
__init__.py
from __future__ import division from __future__ import print_function import datetime import json import logging import os import pickle import time import numpy as np import optimizers import torch from config import parser from models.base_models import NCModel, LPModel from utils.data_utils import load_data from u...
hgcn-master
train.py
"""Attention layers (some modules are copied from https://github.com/Diego999/pyGAT.""" import numpy as np import torch import torch.nn as nn import torch.nn.functional as F class DenseAtt(nn.Module): def __init__(self, in_features, dropout): super(DenseAtt, self).__init__() self.dropout = dropout...
hgcn-master
layers/att_layers.py
hgcn-master
layers/__init__.py
"""Hyperbolic layers.""" import math import torch import torch.nn as nn import torch.nn.functional as F import torch.nn.init as init from torch.nn.modules.module import Module from layers.att_layers import DenseAtt def get_dim_act_curv(args): """ Helper function to get dimension and activation at every laye...
hgcn-master
layers/hyp_layers.py
"""Euclidean layers.""" import math import torch import torch.nn as nn import torch.nn.functional as F from torch.nn.modules.module import Module from torch.nn.parameter import Parameter def get_dim_act(args): """ Helper function to get dimension and activation at every layer. :param args: :return: ...
hgcn-master
layers/layers.py
"""Hyperboloid manifold.""" import torch from manifolds.base import Manifold from utils.math_utils import arcosh, cosh, sinh class Hyperboloid(Manifold): """ Hyperboloid manifold class. We use the following convention: -x0^2 + x1^2 + ... + xd^2 = -K c = 1 / K is the hyperbolic curvature. """...
hgcn-master
manifolds/hyperboloid.py
"""Poincare ball manifold.""" import torch from manifolds.base import Manifold from utils.math_utils import artanh, tanh class PoincareBall(Manifold): """ PoicareBall Manifold class. We use the following convention: x0^2 + x1^2 + ... + xd^2 < 1 / c Note that 1/sqrt(c) is the Poincare ball radius. ...
hgcn-master
manifolds/poincare.py
from .base import ManifoldParameter from .euclidean import Euclidean from .hyperboloid import Hyperboloid from .poincare import PoincareBall
hgcn-master
manifolds/__init__.py
"""Base manifold.""" from torch.nn import Parameter class Manifold(object): """ Abstract class to define operations on a manifold. """ def __init__(self): super().__init__() self.eps = 10e-8 def sqdist(self, p1, p2, c): """Squared distance between pairs of points.""" ...
hgcn-master
manifolds/base.py
"""Euclidean manifold.""" from manifolds.base import Manifold class Euclidean(Manifold): """ Euclidean Manifold class. """ def __init__(self): super(Euclidean, self).__init__() self.name = 'Euclidean' def normalize(self, p): dim = p.size(-1) p.view(-1, dim).renor...
hgcn-master
manifolds/euclidean.py
"""Math utils functions.""" import torch def cosh(x, clamp=15): return x.clamp(-clamp, clamp).cosh() def sinh(x, clamp=15): return x.clamp(-clamp, clamp).sinh() def tanh(x, clamp=15): return x.clamp(-clamp, clamp).tanh() def arcosh(x): return Arcosh.apply(x) def arsinh(x): return Arsinh.a...
hgcn-master
utils/math_utils.py
import os import numpy as np import torch import torch.nn.functional as F import torch.nn.modules.loss def format_metrics(metrics, split): """Format metric in metric dict for logging.""" return " ".join( ["{}_{}: {:.4f}".format(split, metric_name, metric_val) for metric_name, metric_val in metric...
hgcn-master
utils/train_utils.py
hgcn-master
utils/__init__.py
import os import pickle as pkl import sys import time import networkx as nx import numpy as np from tqdm import tqdm from utils.data_utils import load_data_lp def hyperbolicity_sample(G, num_samples=50000): curr_time = time.time() hyps = [] for i in tqdm(range(num_samples)): curr_time = time.tim...
hgcn-master
utils/hyperbolicity.py
"""Data utils functions for pre-processing and data loading.""" import os import pickle as pkl import sys import networkx as nx import numpy as np import scipy.sparse as sp import torch def load_data(args, datapath): if args.task == 'nc': data = load_data_nc(args.dataset, args.use_feats, datapath, args.s...
hgcn-master
utils/data_utils.py
from sklearn.metrics import average_precision_score, accuracy_score, f1_score def acc_f1(output, labels, average='binary'): preds = output.max(1)[1].type_as(labels) if preds.is_cuda: preds = preds.cpu() labels = labels.cpu() accuracy = accuracy_score(preds, labels) f1 = f1_score(preds, ...
hgcn-master
utils/eval_utils.py
"""Base model class.""" import numpy as np from sklearn.metrics import roc_auc_score, average_precision_score import torch import torch.nn as nn import torch.nn.functional as F from layers.layers import FermiDiracDecoder import layers.hyp_layers as hyp_layers import manifolds import models.encoders as encoders from m...
hgcn-master
models/base_models.py
"""Graph decoders.""" import manifolds import torch.nn as nn import torch.nn.functional as F from layers.att_layers import GraphAttentionLayer from layers.layers import GraphConvolution, Linear class Decoder(nn.Module): """ Decoder abstract class for node classification tasks. """ def __init__(self,...
hgcn-master
models/decoders.py
hgcn-master
models/__init__.py
"""Graph encoders.""" import numpy as np import torch import torch.nn as nn import torch.nn.functional as F import manifolds from layers.att_layers import GraphAttentionLayer import layers.hyp_layers as hyp_layers from layers.layers import GraphConvolution, Linear, get_dim_act import utils.math_utils as pmath class...
hgcn-master
models/encoders.py
from torch.optim import Adam from .radam import RiemannianAdam
hgcn-master
optimizers/__init__.py
"""Riemannian adam optimizer geoopt implementation (https://github.com/geoopt/).""" import torch.optim from manifolds import Euclidean, ManifoldParameter # in order not to create it at each iteration _default_manifold = Euclidean() class OptimMixin(object): def __init__(self, *args, stabilize=None, **kwargs): ...
hgcn-master
optimizers/radam.py
#!/usr/bin/env python3 # 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 pathlib import Path import setuptools requirements = [ r for r in Path("requ...
AugLy-main
setup.py
# Configuration file for the Sphinx documentation builder. # # This file only contains a selection of the most common options. For a full # list see the documentation: # https://www.sphinx-doc.org/en/master/usage/configuration.html # -- Path setup -------------------------------------------------------------- # If ex...
AugLy-main
docs/source/conf.py
#!/usr/bin/env python3 # 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.
AugLy-main
augly/__init__.py
#!/usr/bin/env python3 # 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 random from typing import Any, Callable, Dict, List, Optional, Tuple import nump...
AugLy-main
augly/video/transforms.py
#!/usr/bin/env python3 # 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. from augly.video.composition import Compose, OneOf from augly.video.functional import ( add_no...
AugLy-main
augly/video/__init__.py
#!/usr/bin/env python3 # 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 functools import math import os import shutil import tempfile from typing import Any, Calla...
AugLy-main
augly/video/functional.py
#!/usr/bin/env python3 # 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 functools import os import shutil import tempfile from typing import Callable, Dict, List, ...
AugLy-main
augly/video/utils.py
#!/usr/bin/env python3 # 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 random import shutil from typing import Any, Dict, List, Optional from augly.video.helpers...
AugLy-main
augly/video/composition.py
AugLy-main
augly/video/augmenters/__init__.py
#!/usr/bin/env python3 # 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. """ Implementation of base class for FFMPEG-based video augmenters - Method to override: - `g...
AugLy-main
augly/video/augmenters/ffmpeg/base_augmenter.py
#!/usr/bin/env python3 # 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 List, Union from augly.video.augmenters.ffmpeg.base_augmenter impo...
AugLy-main
augly/video/augmenters/ffmpeg/aspect_ratio.py
#!/usr/bin/env python3 # 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. from typing import List from augly.utils import is_image_file, is_video_file, pathmgr from augly....
AugLy-main
augly/video/augmenters/ffmpeg/overlay.py
#!/usr/bin/env python3 # 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. from typing import List from augly.video.augmenters.ffmpeg.base_augmenter import BaseVidgearFFMPE...
AugLy-main
augly/video/augmenters/ffmpeg/grayscale.py
#!/usr/bin/env python3 # 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. from typing import List from augly.video.augmenters.ffmpeg.base_augmenter import BaseVidgearFFMPE...
AugLy-main
augly/video/augmenters/ffmpeg/fps.py
#!/usr/bin/env python3 # 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 logging from dataclasses import dataclass from enum import Enum from math import ceil from ...
AugLy-main
augly/video/augmenters/ffmpeg/concat.py
#!/usr/bin/env python3 # 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. from typing import List from augly.video.augmenters.ffmpeg.base_augmenter import BaseVidgearFFMPE...
AugLy-main
augly/video/augmenters/ffmpeg/speed.py
#!/usr/bin/env python3 # 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. from augly.video.augmenters.ffmpeg.aspect_ratio import VideoAugmenterByAspectRatio from augly.vide...
AugLy-main
augly/video/augmenters/ffmpeg/__init__.py
#!/usr/bin/env python3 # 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. from typing import List, Optional from augly.video.augmenters.ffmpeg.base_augmenter import BaseVi...
AugLy-main
augly/video/augmenters/ffmpeg/trim.py
#!/usr/bin/env python3 # 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. from typing import List from augly.video.augmenters.ffmpeg.base_augmenter import BaseVidgearFFMPE...
AugLy-main
augly/video/augmenters/ffmpeg/color_jitter.py
#!/usr/bin/env python3 # 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. from typing import List from augly.video.augmenters.ffmpeg.base_augmenter import BaseVidgearFFMPE...
AugLy-main
augly/video/augmenters/ffmpeg/crop.py
#!/usr/bin/env python3 # 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. from typing import List from augly.video.augmenters.ffmpeg.base_augmenter import BaseVidgearFFMPE...
AugLy-main
augly/video/augmenters/ffmpeg/no_audio.py
#!/usr/bin/env python3 # 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. from typing import List from augly.video.augmenters.ffmpeg.base_augmenter import BaseVidgearFFMPE...
AugLy-main
augly/video/augmenters/ffmpeg/hflip.py
#!/usr/bin/env python3 # 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. from typing import List from augly.video.augmenters.ffmpeg.base_augmenter import BaseVidgearFFMPE...
AugLy-main
augly/video/augmenters/ffmpeg/loops.py
#!/usr/bin/env python3 # 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. from typing import List, Tuple from augly.utils import validate_rgb_color from augly.video.augmen...
AugLy-main
augly/video/augmenters/ffmpeg/pad.py
#!/usr/bin/env python3 # 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. from typing import List from augly.video.augmenters.ffmpeg.base_augmenter import BaseVidgearFFMPE...
AugLy-main
augly/video/augmenters/ffmpeg/blur.py
#!/usr/bin/env python3 # 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. from typing import List, Union from augly.video.augmenters.ffmpeg.base_augmenter import BaseVidge...
AugLy-main
augly/video/augmenters/ffmpeg/resize.py
#!/usr/bin/env python3 # 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. from typing import List from augly.utils import pathmgr from augly.video.augmenters.ffmpeg.base_a...
AugLy-main
augly/video/augmenters/ffmpeg/stack.py
#!/usr/bin/env python3 # 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. from typing import List from augly.video.augmenters.ffmpeg.base_augmenter import BaseVidgearFFMPE...
AugLy-main
augly/video/augmenters/ffmpeg/noise.py
#!/usr/bin/env python3 # 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. from typing import List from augly.utils import pathmgr from augly.video.augmenters.ffmpeg.base_a...
AugLy-main
augly/video/augmenters/ffmpeg/audio_swap.py
#!/usr/bin/env python3 # 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. from typing import List from augly.video.augmenters.ffmpeg.base_augmenter import BaseVidgearFFMPE...
AugLy-main
augly/video/augmenters/ffmpeg/vflip.py
#!/usr/bin/env python3 # 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. from typing import List from augly.video.augmenters.ffmpeg.base_augmenter import BaseVidgearFFMPE...
AugLy-main
augly/video/augmenters/ffmpeg/brightness.py
#!/usr/bin/env python3 # 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. from typing import List from augly.video.augmenters.ffmpeg.base_augmenter import BaseVidgearFFMPE...
AugLy-main
augly/video/augmenters/ffmpeg/resolution.py
#!/usr/bin/env python3 # 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 List from augly.video.augmenters.ffmpeg.base_augmenter import Base...
AugLy-main
augly/video/augmenters/ffmpeg/rotate.py
#!/usr/bin/env python3 # 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. from typing import List from augly.video.augmenters.ffmpeg.base_augmenter import BaseVidgearFFMPE...
AugLy-main
augly/video/augmenters/ffmpeg/quality.py
#!/usr/bin/env python3 # 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. from typing import List from augly.video.augmenters.ffmpeg.base_augmenter import BaseVidgearFFMPE...
AugLy-main
augly/video/augmenters/ffmpeg/contrast.py
#!/usr/bin/env python3 # 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. """ Implementation of base class for video distractors - Interface: - `augment(self, video_te...
AugLy-main
augly/video/augmenters/cv2/base_augmenter.py
#!/usr/bin/env python3 # 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 random from typing import Iterator, List, Optional, Tuple import cv2 import numpy as np fr...
AugLy-main
augly/video/augmenters/cv2/shapes.py
#!/usr/bin/env python3 # 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 logging import cv2 import numpy as np from augly.video.augmenters.cv2.base_augmenter impor...
AugLy-main
augly/video/augmenters/cv2/dots.py
#!/usr/bin/env python3 # 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. from augly.video.augmenters.cv2.base_augmenter import BaseCV2Augmenter from augly.video.augmenters...
AugLy-main
augly/video/augmenters/cv2/__init__.py
#!/usr/bin/env python3 # 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 pickle import random import string from typing import Any, Iterator, List, Optional, Tuple ...
AugLy-main
augly/video/augmenters/cv2/text.py
#!/usr/bin/env python3 # 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. from copy import deepcopy from typing import Any, Dict, List, Optional, Tuple from augly import u...
AugLy-main
augly/video/helpers/metadata.py
#!/usr/bin/env python3 # 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. from typing import Any, Dict, List, Optional, Tuple import numpy as np from augly.image import in...
AugLy-main
augly/video/helpers/intensity.py
#!/usr/bin/env python3 # 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 os import shutil import tempfile from typing import Any, Dict, List, Optional ...
AugLy-main
augly/video/helpers/ffmpeg.py
#!/usr/bin/env python3 # 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. from augly.video.helpers.ffmpeg import ( add_silent_audio, combine_frames_and_audio_to_fil...
AugLy-main
augly/video/helpers/__init__.py
#!/usr/bin/env python3 # 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 os import shutil import tempfile from typing import Any, Dict, List, Optional, ...
AugLy-main
augly/video/helpers/utils.py
#!/usr/bin/env python3 # 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. from augly.tests.base_configs import AudioAugConfig, ImageAugConfig, VideoAugConfig __all__ = [ ...
AugLy-main
augly/tests/__init__.py
#!/usr/bin/env python3 # 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 dataclasses import dataclass from typing import Optional, Sequence, Tuple from aug...
AugLy-main
augly/tests/base_configs.py
AugLy-main
augly/tests/image_tests/__init__.py
#!/usr/bin/env python3 # 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 unittest from augly import image as imaugs from augly.tests.image_tests.base_unit_test imp...
AugLy-main
augly/tests/image_tests/functional_unit_test.py
#!/usr/bin/env python3 # 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 unittest import torch import torchvision.transforms as transforms # @manual from augly im...
AugLy-main
augly/tests/image_tests/pytorch_test.py
#!/usr/bin/env python3 # 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 tempfile import unittest from typing import Any, Callable, Dict, List, Optional ...
AugLy-main
augly/tests/image_tests/base_unit_test.py
#!/usr/bin/env python3 # 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 json import random import unittest from augly import image as imaugs from augly.tests.imag...
AugLy-main
augly/tests/image_tests/transforms_unit_test.py
#!/usr/bin/env python3 # 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 unittest import numpy as np from augly import audio as audaugs class IntensityAudioUnitT...
AugLy-main
augly/tests/audio_tests/intensity_unit_test.py
AugLy-main
augly/tests/audio_tests/__init__.py
#!/usr/bin/env python3 # 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 unittest from augly import audio as audaugs from augly.tests.audio_tests.base_unit_test im...
AugLy-main
augly/tests/audio_tests/functional_unit_test.py