python_code stringlengths 0 4.04M | repo_name stringlengths 8 58 | file_path stringlengths 5 147 |
|---|---|---|
# Copyright (c) Meta Platforms, Inc. and affiliates.
# All rights reserved.
import torch
from transformers import (
PreTrainedModel,
PretrainedConfig,
AutoConfig,
AutoModel,
)
from transformers.modeling_outputs import BaseModelOutputWithPooling
class SwagConfig(PretrainedConfig):
model_type = "... | CiT-main | hfmodels/swag.py |
# Copyright (c) Meta Platforms, Inc. and affiliates.
# All rights reserved.
from .moco import MoCoModel, MoCoConfig
from .augreg import AugRegModel, AugRegConfig
from .swag import SwagModel, SwagConfig | CiT-main | hfmodels/__init__.py |
# Copyright (c) Meta Platforms, Inc. and affiliates.
# All rights reserved.
import torch
import sys
sys.path.append("moco-v3") # repo path to moco-v3
from transformers import (
PreTrainedModel,
PretrainedConfig,
AutoConfig,
AutoModel,
)
from torch import nn
from transformers.modeling_outputs import ... | CiT-main | hfmodels/moco.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.
# Copyright (c) Meta Platforms, Inc. All Rights Reserved
import numpy as np
import pickle
import re
import time
import sq... | CiT-main | scripts/make_yfcc100m_dataset.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.
# Copyright (c) Meta Platforms, Inc. All Rights Reserved
import numpy as np
import pickle
import re
from urllib.parse imp... | CiT-main | scripts/make_yfcc15m_dataset.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.
# Copyright (c) Meta Platforms, Inc. All Rights Reserved
import json
import os
import pickle
import zipfile
import numpy ... | CiT-main | clipeval/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.
# Copyright (c) Meta Platforms, Inc. All Rights Reserved
import torch
import json
import os
from sklearn import metrics
... | CiT-main | clipeval/eval_zeroshot.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 argparse
import time
import yaml
import torch
import utils.logger
from utils import main_utils, eval_utils
import... | AVID-CMA-main | eval-action-recg.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 argparse
import os
import random
import time
import warnings
import yaml
import torch
import torch.nn.parallel
im... | AVID-CMA-main | main-avid.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 argparse
import time
import yaml
import torch
from utils import main_utils, eval_utils
import utils.logger
import... | AVID-CMA-main | eval-action-recg-linear.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 csv
import numpy as np
import glob
from datasets.video_db import VideoDataset
DATA_PATH = '/data/datasets/AS240/d... | AVID-CMA-main | datasets/audioset.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.
#
from .audioset import AudioSet
from .kinetics import Kinetics
from .ucf import UCF
from .hmdb import HMDB | AVID-CMA-main | datasets/__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.
#
import torch
import numpy as np
import random
import librosa
from utils.videotransforms import video_transforms, volume_t... | AVID-CMA-main | datasets/preprocessing.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 random
import torch
import numpy as np
import torch.utils.data as data
from utils.ioutils import av_wrappers
from ... | AVID-CMA-main | datasets/video_db.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 os
from datasets.video_db import VideoDataset
DATA_PATH = '/data/datasets/hmdb/videos'
ANNO_PATH = '/data/dataset... | AVID-CMA-main | datasets/hmdb.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.
#
from datasets.video_db import VideoDataset
DATA_PATH = '/data/datasets/UCF101/data'
ANNO_PATH = '/data/datasets/UCF101/u... | AVID-CMA-main | datasets/ucf.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 os
import glob
import numpy as np
DATA_PATH = '/data/datasets/kinetics/'
from datasets.video_db import VideoDa... | AVID-CMA-main | datasets/kinetics.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.
#
| AVID-CMA-main | utils/__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.
#
import datetime
import sys
import torch
from torch import distributed as dist
class Logger(object):
def __init__(s... | AVID-CMA-main | utils/logger.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
from torch import distributed as dist
def _gather_from_all(tensor):
"""
Gather tensors from all gp... | AVID-CMA-main | utils/distributed_utils.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
from collections import deque
def accuracy(output, target, topk=(1,)):
"""Computes the accuracy over t... | AVID-CMA-main | utils/metrics_utils.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
class AliasMethod(object):
"""
From: https://hips.seas.harvard.edu/blog/2013/03/03/the-alias-metho... | AVID-CMA-main | utils/alias_method.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 os
import shutil
import torch
import numpy as np
import torch.distributed as dist
import datetime
from utils.logg... | AVID-CMA-main | utils/main_utils.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
from torch import nn
import torch.distributed as dist
import utils.logger
from utils import main_utils
impo... | AVID-CMA-main | utils/eval_utils.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.
#
| AVID-CMA-main | utils/ioutils/__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.
#
import av
import numpy as np
from fractions import Fraction
av.logging.set_level(0)
def av_open(inpt):
return av.ope... | AVID-CMA-main | utils/ioutils/av_wrappers.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 random
import torch
from utils.videotransforms.utils import functional as F
class Normalize(object):
"""Norm... | AVID-CMA-main | utils/videotransforms/tensor_transforms.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 numpy as np
from PIL import Image
import torch
from utils.videotransforms.utils import images as imageutils
cla... | AVID-CMA-main | utils/videotransforms/volume_transforms.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 numbers
import numpy as np
import PIL
def crop_clip(clip, min_h, min_w, h, w):
if isinstance(clip[0], np.nd... | AVID-CMA-main | utils/videotransforms/functional.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 numpy as np
import PIL
import torch
from utils.videotransforms.utils import images as imageutils
class ToStacke... | AVID-CMA-main | utils/videotransforms/stack_transforms.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 numbers
import random
import numpy as np
import PIL
import torchvision
import warnings
import math
from utils.vid... | AVID-CMA-main | utils/videotransforms/video_transforms.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.
#
def normalize(tensor, mean, std):
"""
Args:
tensor (Tensor): Tensor to normalize
Returns:
Te... | AVID-CMA-main | utils/videotransforms/utils/functional.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 numpy as np
def convert_img(img):
"""Converts (H, W, C) numpy.ndarray to (C, W, H) format
"""
if len... | AVID-CMA-main | utils/videotransforms/utils/images.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.
#
from .video import *
from .audio import *
from .av_wrapper import *
| AVID-CMA-main | models/__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.
#
import torch
import torch.nn as nn
import numpy as np
class Basic2DBlock(nn.Module):
def __init__(self, in_planes, ... | AVID-CMA-main | models/network_blocks.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
__all__ = [
'av_wrapper'
]
class Head(nn.Module):
def __init__(self, input... | AVID-CMA-main | models/av_wrapper.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.nn as nn
from .network_blocks import Basic2DBlock
__all__ = [
'Conv2D'
]
class Conv2D(nn.Module):
... | AVID-CMA-main | models/audio.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.nn as nn
from models.network_blocks import BasicR2P1DBlock
class R2Plus1D(nn.Module):
"""
Adapted ... | AVID-CMA-main | models/video.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.
#
from .avid import *
from .avid_cma import * | AVID-CMA-main | criterions/__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.
#
import torch
from torch import nn
from torch.nn import functional as F
import torch.distributed as dist
import pprint
fro... | AVID-CMA-main | criterions/avid.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
from torch import nn
import torch.distributed as dist
from utils.distributed_utils import _gather_from_all
... | AVID-CMA-main | criterions/nce.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 multiprocessing as mp
mp.set_start_method('spawn', force=True)
import torch
from torch import nn
from torch.nn im... | AVID-CMA-main | criterions/avid_cma.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.
#
# Evaluation script for object localization
import json
import argparse
import torch
import itertools
import numpy as np... | ActivityNet-Entities-main | scripts/eval_grd_anet_entities.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.
#
# Script to print stats on the NP annotation file
import numpy as np
import json
import csv
import sys
src_file = sys.a... | ActivityNet-Entities-main | scripts/anet_entities_np_stats.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.
#
# Based on
# https://github.com/jiasenlu/NeuralBabyTalk/blob/master/misc/bbox_transform.py
# Licensed under The MIT Licen... | ActivityNet-Entities-main | scripts/utils.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.
#
# Script to preprocess the raw annotation output to NP/object annotation files
import os
import sys
import json
import a... | ActivityNet-Entities-main | scripts/attr_prep_tag_NP.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.
#
# Script to print stats on the object annotation file
import numpy as np
import json
import csv
# import visdom
import s... | ActivityNet-Entities-main | scripts/anet_entities_object_stats.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 os
class Path(object):
"""
User-specific path configuration.
Please complete the /path/to/* paths to ... | astmt-master | mypath.py |
astmt-master | experiments/__init__.py | |
astmt-master | experiments/classification/__init__.py | |
astmt-master | experiments/classification/imagenet/__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.
#
import argparse
import os
import copy
import shutil
import time
import torch
import torch.nn as nn
import torch.nn.parall... | astmt-master | experiments/classification/imagenet/train.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
from torchvision import transforms
from torch.utils.data import DataLoader
from fblib.util.helpers import wo... | astmt-master | experiments/dense_predict/common_configs.py |
MAX_N_IMAGES_PER_GPU = {
'res26-8': 8,
'res26-16': 12,
'res50-8': 8,
'res50-16': 10,
'res101-8': 4,
'res101-16': 10,
'x50-8': 4,
'x50-16': 10,
'x101-8': 2,
'x101-16': 6,
}
| astmt-master | experiments/dense_predict/__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.
#
import os
import sys
import cv2
import argparse
import torch
import tarfile
from six.moves import urllib
from easydict imp... | astmt-master | experiments/dense_predict/pascal_resnet/config.py |
MAX_N_IMAGES_PER_GPU = {
'se_res26-8': 10,
'se_res26-16': 16,
'se_res50-8': 8,
'se_res50-16': 10,
'se_res101-8': 2,
'se_res101-16': 8,
}
| astmt-master | experiments/dense_predict/pascal_resnet/__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.
#
import os
import socket
import timeit
import cv2
from datetime import datetime
import imageio
import numpy as np
# PyTorc... | astmt-master | experiments/dense_predict/pascal_resnet/main.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 os
import sys
import cv2
import argparse
import torch
import tarfile
from six.moves import urllib
from easydict imp... | astmt-master | experiments/dense_predict/pascal_mnet/config.py |
MAX_N_IMAGES_PER_GPU = {
'mnetv2-8': 10,
'mnetv2-16': 16,
}
| astmt-master | experiments/dense_predict/pascal_mnet/__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.
#
import os
import socket
import timeit
import cv2
from datetime import datetime
import imageio
import numpy as np
# PyTorc... | astmt-master | experiments/dense_predict/pascal_mnet/main.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 os
import sys
import cv2
import argparse
import torch
import tarfile
from six.moves import urllib
from easydict imp... | astmt-master | experiments/dense_predict/nyud_resnet/config.py |
MAX_N_IMAGES_PER_GPU = {
'se_res26-8': 10,
'se_res26-16': 16,
'se_res50-8': 8,
'se_res50-16': 16,
'se_res101-8': 2,
'se_res101-16': 10,
}
| astmt-master | experiments/dense_predict/nyud_resnet/__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.
#
import os
import socket
import timeit
import cv2
from datetime import datetime
import imageio
import scipy.io as sio
impor... | astmt-master | experiments/dense_predict/nyud_resnet/main.py |
import os
PROJECT_ROOT_DIR = os.path.dirname(os.path.abspath(__file__)) | astmt-master | fblib/__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.
#
import torch
import torch.nn as nn
import torch.nn.functional as F
class AttentionModuleFree(nn.Module):
"""
Att... | astmt-master | fblib/layers/attention.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.nn as nn
import torch.nn.functional as F
class Normalize(object):
"""Given mean: (R, G, B) and std: (R,... | astmt-master | fblib/layers/image_features.py |
astmt-master | fblib/layers/__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.
#
from torch.autograd import Function
class ReverseLayerF(Function):
@staticmethod
def forward(ctx, x, alpha):
... | astmt-master | fblib/layers/reverse_grad.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 torch.nn.modules.module import Module
import numpy... | astmt-master | fblib/layers/loss.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 numpy as np
import torch
from torch.nn import functional as F
def logit(x):
return np.log(x/(1-x+1e-08)+1e-08... | astmt-master | fblib/layers/misc_layers.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.
#
from torch import nn
from fblib.util.custom_container import SequentialMultiTask
class SELayer(nn.Module):
"""
S... | astmt-master | fblib/layers/squeeze.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
from torch.autograd import Variable
from torchvision import models
from graphviz import Digraph
def make_do... | astmt-master | fblib/util/pdf_visualizer.py |
astmt-master | fblib/util/__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.
#
import torch
import collections
import re
from torch._six import string_classes, int_classes
_use_shared_memory = False
r... | astmt-master | fblib/util/custom_collate.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 cv2
import numpy as np
# set random seed in each worker
worker_seed = lambda x: np.random.seed((torch... | astmt-master | fblib/util/helpers.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.
#
from collections import OrderedDict
from torch.nn.modules.container import Sequential
class SequentialMultiTask(Sequenti... | astmt-master | fblib/util/custom_container.py |
astmt-master | fblib/util/classification/__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.
#
import time
import random
class AverageMeter(object):
"""Computes and stores the average and current value"""
d... | astmt-master | fblib/util/classification/utils.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
from torchvision import utils as vutils
import fblib.util.pdf_visualizer as viz
from fblib.util.mypath impor... | astmt-master | fblib/util/mtl_tools/multitask_visualizer.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.
#
def imagenet_categ_names():
return { 0: 'tench, Tinca tinca',
1: 'goldfish, Carassius auratus',
... | astmt-master | fblib/util/db_info/imagenet_categ.py |
astmt-master | fblib/util/db_info/__init__.py | |
astmt-master | fblib/util/model_resources/__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.
#
import torch
# ---- Public functions
def compute_gflops(net, in_shape=(1, 3, 224, 224), tasks=None):
net = add_flop... | astmt-master | fblib/util/model_resources/flops.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.
#
def count_parameters(model):
return sum(p.numel() for p in model.parameters() if p.requires_grad)
| astmt-master | fblib/util/model_resources/num_parameters.py |
astmt-master | fblib/util/dense_predict/__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.
#
def lr_poly(base_lr, iter_, max_iter=100, power=0.9):
return base_lr * ((1 - float(iter_) / max_iter) ** power)
cl... | astmt-master | fblib/util/dense_predict/utils.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
def traverse_graph(var):
"""
Args:
var: output Variable
"""
... | astmt-master | fblib/util/optimizer_mtl/select_used_modules.py |
astmt-master | fblib/util/optimizer_mtl/__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.
#
import os
from fblib.util.mypath import Path
import numpy as np
import torch.utils.data as data
import cv2
class FSVGTA... | astmt-master | fblib/dataloaders/fsv.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 os
import os.path
from pycocotools.coco import COCO
import torch.utils.data as data
from PIL import Image
import n... | astmt-master | fblib/dataloaders/coco.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.utils.data as data
class CombineIMDBs(data.Dataset):
"""
Combine two datasets, for example to creat... | astmt-master | fblib/dataloaders/combine_im_dbs.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 os
import sys
import tarfile
import cv2
import numpy as np
import torch.utils.data as data
from six.moves import u... | astmt-master | fblib/dataloaders/msra10k.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 os
import sys
import tarfile
import json
import cv2
import numpy as np
import scipy.io as sio
import torch.utils.d... | astmt-master | fblib/dataloaders/pascal_context.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 os
import sys
import tarfile
import cv2
from PIL import Image
import numpy as np
import torch.utils.data as data
i... | astmt-master | fblib/dataloaders/nyud.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 numpy.random as random
import numpy as np
import torch
import cv2
import math
import fblib.util.helpers as helpers
... | astmt-master | fblib/dataloaders/custom_transforms.py |
from .bsds import BSDS500
from .coco import COCOSegmentation
from .fsv import FSVGTA
from .nyud import NYUD_MT, NYUDRaw
from .pascal_context import PASCALContext
from .pascal_voc import VOC12
from .sbd import SBD
from .msra10k import MSRA
from .pascal_sal import PASCALS
__all__ = ['BSDS500', 'COCOSegmentation', 'FSVGT... | astmt-master | fblib/dataloaders/__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.
#
import os
import sys
import errno
import cv2
import hashlib
import tarfile
import numpy as np
import scipy.io as sio
impo... | astmt-master | fblib/dataloaders/sbd.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.
#
from __future__ import print_function
import torch.utils.data as data
from PIL import Image
import os
import os.path
impor... | astmt-master | fblib/dataloaders/mnist_multitask.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 os
import sys
import tarfile
from PIL import Image
import numpy as np
from glob import glob
import scipy.io as sio... | astmt-master | fblib/dataloaders/bsds.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 os
import sys
import errno
import cv2
import hashlib
import tarfile
import numpy as np
import torch.utils.data as ... | astmt-master | fblib/dataloaders/pascal_voc.py |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.