python_code stringlengths 0 4.04M | repo_name stringlengths 8 58 | file_path stringlengths 5 147 |
|---|---|---|
# Copyright (c) Facebook, Inc. and its affiliates.
import copy
import itertools
import logging
import numpy as np
import pickle
import random
import torch.utils.data as data
from torch.utils.data.sampler import Sampler
from detectron2.utils.serialize import PicklableWrapper
__all__ = ["MapDataset", "DatasetFromList",... | banmo-main | third_party/detectron2_old/detectron2/data/common.py |
# Copyright (c) Facebook, Inc. and its affiliates.
import contextlib
import datetime
import io
import json
import logging
import numpy as np
import os
import shutil
import pycocotools.mask as mask_util
from fvcore.common.timer import Timer
from iopath.common.file_io import file_lock
from PIL import Image
from detectro... | banmo-main | third_party/detectron2_old/detectron2/data/datasets/coco.py |
# Copyright (c) Facebook, Inc. and its affiliates.
from .coco import register_coco_instances # noqa
from .coco_panoptic import register_coco_panoptic_separated # noqa
| banmo-main | third_party/detectron2_old/detectron2/data/datasets/register_coco.py |
# Copyright (c) Facebook, Inc. and its affiliates.
import functools
import json
import logging
import multiprocessing as mp
import numpy as np
import os
from itertools import chain
import pycocotools.mask as mask_util
from PIL import Image
from detectron2.structures import BoxMode
from detectron2.utils.comm import get... | banmo-main | third_party/detectron2_old/detectron2/data/datasets/cityscapes.py |
# Copyright (c) Facebook, Inc. and its affiliates.
import json
import logging
import os
from detectron2.data import DatasetCatalog, MetadataCatalog
from detectron2.data.datasets.builtin_meta import CITYSCAPES_CATEGORIES
from detectron2.utils.file_io import PathManager
"""
This file contains functions to register the ... | banmo-main | third_party/detectron2_old/detectron2/data/datasets/cityscapes_panoptic.py |
# Copyright (c) Facebook, Inc. and its affiliates.
# Autogen with
# with open("lvis_v1_val.json", "r") as f:
# a = json.load(f)
# c = a["categories"]
# for x in c:
# del x["image_count"]
# del x["instance_count"]
# LVIS_CATEGORIES = repr(c) + " # noqa"
# with open("/tmp/lvis_categories.py", "wt") as f:
# ... | banmo-main | third_party/detectron2_old/detectron2/data/datasets/lvis_v1_categories.py |
# Copyright (c) Facebook, Inc. and its affiliates.
from .coco import load_coco_json, load_sem_seg, register_coco_instances
from .coco_panoptic import register_coco_panoptic, register_coco_panoptic_separated
from .lvis import load_lvis_json, register_lvis_instances, get_lvis_instances_meta
from .pascal_voc import load_v... | banmo-main | third_party/detectron2_old/detectron2/data/datasets/__init__.py |
# Copyright (c) Facebook, Inc. and its affiliates.
import logging
import os
from fvcore.common.timer import Timer
from detectron2.data import DatasetCatalog, MetadataCatalog
from detectron2.structures import BoxMode
from detectron2.utils.file_io import PathManager
from .builtin_meta import _get_coco_instances_meta
fr... | banmo-main | third_party/detectron2_old/detectron2/data/datasets/lvis.py |
# Copyright (c) Facebook, Inc. and its affiliates.
import copy
import json
import os
from detectron2.data import DatasetCatalog, MetadataCatalog
from detectron2.utils.file_io import PathManager
from .coco import load_coco_json, load_sem_seg
__all__ = ["register_coco_panoptic", "register_coco_panoptic_separated"]
d... | banmo-main | third_party/detectron2_old/detectron2/data/datasets/coco_panoptic.py |
# -*- coding: utf-8 -*-
# Copyright (c) Facebook, Inc. and its affiliates.
"""
This file registers pre-defined datasets at hard-coded paths, and their metadata.
We hard-code metadata for common datasets. This will enable:
1. Consistency check when loading the datasets
2. Use models on these standard datasets directl... | banmo-main | third_party/detectron2_old/detectron2/data/datasets/builtin.py |
# -*- coding: utf-8 -*-
# Copyright (c) Facebook, Inc. and its affiliates.
import numpy as np
import os
import xml.etree.ElementTree as ET
from typing import List, Tuple, Union
from detectron2.data import DatasetCatalog, MetadataCatalog
from detectron2.structures import BoxMode
from detectron2.utils.file_io import Pa... | banmo-main | third_party/detectron2_old/detectron2/data/datasets/pascal_voc.py |
# Copyright (c) Facebook, Inc. and its affiliates.
# Autogen with
# with open("lvis_v0.5_val.json", "r") as f:
# a = json.load(f)
# c = a["categories"]
# for x in c:
# del x["image_count"]
# del x["instance_count"]
# LVIS_CATEGORIES = repr(c) + " # noqa"
# fmt: off
LVIS_CATEGORIES = [{'frequency': 'r', 'i... | banmo-main | third_party/detectron2_old/detectron2/data/datasets/lvis_v0_5_categories.py |
# -*- coding: utf-8 -*-
# Copyright (c) Facebook, Inc. and its affiliates.
"""
Note:
For your custom dataset, there is no need to hard-code metadata anywhere in the code.
For example, for COCO-format dataset, metadata will be obtained automatically
when calling `load_coco_json`. For other dataset, metadata may also be... | banmo-main | third_party/detectron2_old/detectron2/data/datasets/builtin_meta.py |
# -*- coding: utf-8 -*-
# Copyright (c) Facebook, Inc. and its affiliates.
"""
Implement many useful :class:`Augmentation`.
"""
import numpy as np
import sys
from typing import Tuple
from fvcore.transforms.transform import (
BlendTransform,
CropTransform,
HFlipTransform,
NoOpTransform,
PadTransform,... | banmo-main | third_party/detectron2_old/detectron2/data/transforms/augmentation_impl.py |
# -*- coding: utf-8 -*-
# Copyright (c) Facebook, Inc. and its affiliates.
import inspect
import numpy as np
import pprint
from typing import Any, List, Optional, Tuple, Union
from fvcore.transforms.transform import Transform, TransformList
"""
See "Data Augmentation" tutorial for an overview of the system:
https://d... | banmo-main | third_party/detectron2_old/detectron2/data/transforms/augmentation.py |
# Copyright (c) Facebook, Inc. and its affiliates.
from fvcore.transforms.transform import Transform, TransformList # order them first
from fvcore.transforms.transform import *
from .transform import *
from .augmentation import *
from .augmentation_impl import *
__all__ = [k for k in globals().keys() if not k.startsw... | banmo-main | third_party/detectron2_old/detectron2/data/transforms/__init__.py |
# -*- coding: utf-8 -*-
# Copyright (c) Facebook, Inc. and its affiliates.
"""
See "Data Augmentation" tutorial for an overview of the system:
https://detectron2.readthedocs.io/tutorials/augmentation.html
"""
import numpy as np
import torch
import torch.nn.functional as F
from fvcore.transforms.transform import (
... | banmo-main | third_party/detectron2_old/detectron2/data/transforms/transform.py |
# Copyright (c) Facebook, Inc. and its affiliates.
from .distributed_sampler import InferenceSampler, RepeatFactorTrainingSampler, TrainingSampler
from .grouped_batch_sampler import GroupedBatchSampler
__all__ = [
"GroupedBatchSampler",
"TrainingSampler",
"InferenceSampler",
"RepeatFactorTrainingSample... | banmo-main | third_party/detectron2_old/detectron2/data/samplers/__init__.py |
# Copyright (c) Facebook, Inc. and its affiliates.
import numpy as np
from torch.utils.data.sampler import BatchSampler, Sampler
class GroupedBatchSampler(BatchSampler):
"""
Wraps another sampler to yield a mini-batch of indices.
It enforces that the batch only contain elements from the same group.
It... | banmo-main | third_party/detectron2_old/detectron2/data/samplers/grouped_batch_sampler.py |
# Copyright (c) Facebook, Inc. and its affiliates.
import itertools
import math
from collections import defaultdict
from typing import Optional
import torch
from torch.utils.data.sampler import Sampler
from detectron2.utils import comm
class TrainingSampler(Sampler):
"""
In training, we only care about the "... | banmo-main | third_party/detectron2_old/detectron2/data/samplers/distributed_sampler.py |
# -*- coding: utf-8 -*-
# Copyright (c) Facebook, Inc. and its affiliates.
import datetime
import itertools
import logging
import os
import tempfile
import time
from collections import Counter
import torch
from fvcore.common.checkpoint import PeriodicCheckpointer as _PeriodicCheckpointer
from fvcore.common.param_sched... | banmo-main | third_party/detectron2_old/detectron2/engine/hooks.py |
# Copyright (c) Facebook, Inc. and its affiliates.
from .launch import *
from .train_loop import *
__all__ = [k for k in globals().keys() if not k.startswith("_")]
# prefer to let hooks and defaults live in separate namespaces (therefore not in __all__)
# but still make them available here
from .hooks import *
from... | banmo-main | third_party/detectron2_old/detectron2/engine/__init__.py |
# -*- coding: utf-8 -*-
# Copyright (c) Facebook, Inc. and its affiliates.
import logging
import numpy as np
import time
import weakref
from typing import Dict, List, Optional
import torch
from torch.nn.parallel import DataParallel, DistributedDataParallel
import detectron2.utils.comm as comm
from detectron2.utils.ev... | banmo-main | third_party/detectron2_old/detectron2/engine/train_loop.py |
# Copyright (c) Facebook, Inc. and its affiliates.
import logging
from datetime import timedelta
import torch
import torch.distributed as dist
import torch.multiprocessing as mp
from detectron2.utils import comm
__all__ = ["DEFAULT_TIMEOUT", "launch"]
DEFAULT_TIMEOUT = timedelta(minutes=30)
def _find_free_port():
... | banmo-main | third_party/detectron2_old/detectron2/engine/launch.py |
# -*- coding: utf-8 -*-
# Copyright (c) Facebook, Inc. and its affiliates.
"""
This file contains components with some default boilerplate logic user may need
in training / testing. They will not work for everyone, but many users may find them useful.
The behavior of functions/classes in this file is subject to chang... | banmo-main | third_party/detectron2_old/detectron2/engine/defaults.py |
from __future__ import print_function
import sys
sys.path.insert(0,'../')
import cv2
import pdb
import argparse
import numpy as np
import torch
import torch.nn as nn
import torch.nn.parallel
import torch.backends.cudnn as cudnn
import torch.optim as optim
import torch.utils.data
from torch.autograd import Variable
impo... | banmo-main | third_party/vcnplus/auto_gen.py |
"""
# ==============================
# flowlib.py
# library for optical flow processing
# Author: Ruoteng Li
# Date: 6th Aug 2016
# ==============================
"""
import png
from flowutils.util_flow import readPFM
import numpy as np
import matplotlib.colors as cl
import matplotlib.pyplot as plt
from PIL import Imag... | banmo-main | third_party/vcnplus/flowutils/flowlib.py |
"""
Taken from https://github.com/ClementPinard/FlowNetPytorch
"""
import pdb
import torch
import torch.nn.functional as F
def EPE(input_flow, target_flow, mask, sparse=False, mean=True):
#mask = target_flow[:,2]>0
target_flow = target_flow[:,:2]
EPE_map = torch.norm(target_flow-input_flow,2,1)
batch_... | banmo-main | third_party/vcnplus/flowutils/multiscaleloss.py |
import errno
import os
import shutil
import sys
import traceback
import zipfile
if sys.version_info[0] == 2:
import urllib2
else:
import urllib.request
def add_image(log,tag,img,step):
"""
for torch tensorboard
"""
timg = img[0]
timg = (timg-timg.min())/(timg.max()-timg.min())
if... | banmo-main | third_party/vcnplus/flowutils/io.py |
import math
import png
import struct
import array
import numpy as np
import cv2
import pdb
from io import *
UNKNOWN_FLOW_THRESH = 1e9;
UNKNOWN_FLOW = 1e10;
# Middlebury checks
TAG_STRING = 'PIEH' # use this when WRITING the file
TAG_FLOAT = 202021.25 # check for this when READING the file
def readPFM(file):
... | banmo-main | third_party/vcnplus/flowutils/util_flow.py |
banmo-main | third_party/vcnplus/flowutils/__init__.py | |
gpuid = 1
import pdb
import sys
import torch
import numpy as np
import cv2
def write_calib(K,bl,shape,maxd,path):
str1 = 'camera.A=[%f 0 %f; 0 %f %f; 0 0 1]'%(K[0,0], K[0,2], K[1,1],K[1,2])
str2 = 'camera.height=%d'%(shape[0])
str3 = 'camera.width=%d' %(shape[1])
str4 = 'camera.zmax=%f'%(maxd)
str5 ... | banmo-main | third_party/vcnplus/flowutils/dydepth.py |
import pdb
import math
import numpy as np
import cv2
import torch
import torch.nn.functional as F
import torch.nn as nn
def gaussian2D(shape, sigma=1):
m, n = [(ss - 1.) / 2. for ss in shape]
y, x = np.ogrid[-m:m+1,-n:n+1]
h = np.exp(-(x * x + y * y) / (2 * sigma * sigma))
h[h < np.finfo(h.dtype).eps ... | banmo-main | third_party/vcnplus/flowutils/detlib.py |
#! /usr/bin/env python2
"""
I/O script to save and load the data coming with the MPI-Sintel low-level
computer vision benchmark.
For more details about the benchmark, please visit www.mpi-sintel.de
CHANGELOG:
v1.0 (2015/02/03): First release
Copyright (c) 2015 Jonas Wulff
Max Planck Institute for Intelligent System... | banmo-main | third_party/vcnplus/flowutils/sintel_io.py |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import torchvision.models as models
import torch
import torch.nn as nn
import os
from .networks.msra_resnet import get_pose_net
from .networks.dlav0 import get_pose_net as get_dlav0
from .networks.pose_dla_dcn... | banmo-main | third_party/vcnplus/models/det.py |
# ------------------------------------------------------------------------------
# Portions of this code are from
# CornerNet (https://github.com/princeton-vl/CornerNet)
# Copyright (c) 2018, University of Michigan
# Licensed under the BSD 3-Clause License
# -------------------------------------------------------------... | banmo-main | third_party/vcnplus/models/det_losses.py |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import torch
import torch.nn as nn
def _sigmoid(x):
y = torch.clamp(x.sigmoid_(), min=1e-4, max=1-1e-4)
return y
def _gather_feat(feat, ind, mask=None):
dim = feat.size(2)
ind = ind.unsqueeze(2)... | banmo-main | third_party/vcnplus/models/det_utils.py |
banmo-main | third_party/vcnplus/models/__init__.py | |
"""
Copyright (C) 2019 NVIDIA Corporation. All rights reserved.
Licensed under the CC BY-NC-SA 4.0 license (https://creativecommons.org/licenses/by-nc-sa/4.0/legalcode).
This file incorporates work covered by the following copyright and permission notice:
Copyright (c) 2018 Ignacio Rocco
Permission is here... | banmo-main | third_party/vcnplus/models/feature_extraction.py |
from __future__ import print_function
import torch
import torch.nn as nn
import torch.utils.data
from torch.autograd import Variable
import torch.nn.functional as F
import math
import numpy as np
import pdb
#import kornia
class residualBlock(nn.Module):
expansion = 1
def __init__(self, in_channels, n_filters,... | banmo-main | third_party/vcnplus/models/submodule.py |
import pdb
import torch.nn as nn
import math
import torch
from torch.nn.parameter import Parameter
import torch.nn.functional as F
from torch.nn import Module
from torch.nn.modules.conv import _ConvNd
from torch.nn.modules.utils import _quadruple
from torch.autograd import Variable
from torch.nn import Conv2d
def conv... | banmo-main | third_party/vcnplus/models/conv4d.py |
import torch
import torch.nn as nn
import torch.nn.functional as F
from torch.autograd import Variable
import numpy as np
import math
import pdb
import time
import cv2
from .submodule import pspnet, bfmodule, bfmodule_feat, conv, compute_geo_costs, get_skew_mat, get_intrinsics, F_ngransac
from .conv4d import sepConv4d... | banmo-main | third_party/vcnplus/models/VCNplus.py |
# ------------------------------------------------------------------------------
# Copyright (c) Microsoft
# Licensed under the MIT License.
# Written by Bin Xiao (Bin.Xiao@microsoft.com)
# Modified by Dequan Wang and Xingyi Zhou
# ------------------------------------------------------------------------------
from __f... | banmo-main | third_party/vcnplus/models/networks/resnet_dcn.py |
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import os
import math
import logging
import numpy as np
from os.path import join
import torch
from torch import nn
import torch.nn.functional as F
import torch.utils.model_zoo as model_zoo
from .DCNv2.DCN.dcn... | banmo-main | third_party/vcnplus/models/networks/pose_dla_dcn.py |
# ------------------------------------------------------------------------------
# Copyright (c) Microsoft
# Licensed under the MIT License.
# Written by Bin Xiao (Bin.Xiao@microsoft.com)
# Modified by Xingyi Zhou
# ------------------------------------------------------------------------------
from __future__ import a... | banmo-main | third_party/vcnplus/models/networks/msra_resnet.py |
# ------------------------------------------------------------------------------
# This code is base on
# CornerNet (https://github.com/princeton-vl/CornerNet)
# Copyright (c) 2018, University of Michigan
# Licensed under the BSD 3-Clause License
# ----------------------------------------------------------------------... | banmo-main | third_party/vcnplus/models/networks/large_hourglass.py |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import math
from os.path import join
import torch
from torch import nn
import torch.utils.model_zoo as model_zoo
import numpy as np
BatchNorm = nn.BatchNorm2d
d... | banmo-main | third_party/vcnplus/models/networks/dlav0.py |
#!/usr/bin/env python
import os
import glob
import torch
from torch.utils.cpp_extension import CUDA_HOME
from torch.utils.cpp_extension import CppExtension
from torch.utils.cpp_extension import CUDAExtension
from setuptools import find_packages
from setuptools import setup
requirements = ["torch", "torchvision"]
... | banmo-main | third_party/vcnplus/models/networks/DCNv2/setup.py |
#!/usr/bin/env python
from __future__ import absolute_import
from __future__ import print_function
from __future__ import division
import time
import torch
import torch.nn as nn
from torch.autograd import gradcheck
from dcn_v2 import dcn_v2_conv, DCNv2, DCN
from dcn_v2 import dcn_v2_pooling, DCNv2Pooling, DCNPooling
... | banmo-main | third_party/vcnplus/models/networks/DCNv2/DCN/testcpu.py |
#!/usr/bin/env python
from __future__ import absolute_import
from __future__ import print_function
from __future__ import division
import time
import torch
import torch.nn as nn
from torch.autograd import gradcheck
from dcn_v2 import dcn_v2_conv, DCNv2, DCN
from dcn_v2 import dcn_v2_pooling, DCNv2Pooling, DCNPooling
... | banmo-main | third_party/vcnplus/models/networks/DCNv2/DCN/testcuda.py |
#!/usr/bin/env python
from __future__ import absolute_import
from __future__ import print_function
from __future__ import division
import math
import torch
from torch import nn
from torch.autograd import Function
from torch.nn.modules.utils import _pair
from torch.autograd.function import once_differentiable
import _... | banmo-main | third_party/vcnplus/models/networks/DCNv2/DCN/dcn_v2.py |
from .dcn_v2 import *
| banmo-main | third_party/vcnplus/models/networks/DCNv2/DCN/__init__.py |
# Copyright (c) Facebook, Inc. and its affiliates. All rights reserved.
import sys
sys.path.insert(0,'third_party')
sys.path.insert(0,'./')
import numpy as np
import trimesh
import torch
import cv2
import pdb
from scipy.spatial.transform import Rotation as R
from utils.io import mkdir_p
import argparse
parser = argpa... | banmo-main | scripts/misc/generate_traj.py |
# Copyright (c) Facebook, Inc. and its affiliates. All rights reserved.
# python scripts/add_cam_noise.py cam-files/cse-ama/ 30
import cv2
import numpy as np
import pdb
import sys
import glob
import os
cam_dir=sys.argv[1]
std_rot=float(sys.argv[2]) # deg
seqname=cam_dir.split('/')[-2]
std=np.pi/180*std_rot
odir='%s... | banmo-main | scripts/misc/add_cam_noise.py |
# Copyright (c) Facebook, Inc. and its affiliates. All rights reserved.
# from: https://gist.github.com/adewes/5884820
import random
def get_random_color(pastel_factor = 0.5):
return [(x+pastel_factor)/(1.0+pastel_factor) for x in [random.uniform(0,1.0) for i in [1,2,3]]]
def color_distance(c1,c2):
return sum... | banmo-main | scripts/misc/random_colors.py |
# Copyright (c) Facebook, Inc. and its affiliates. All rights reserved.
import sys, os
sys.path.append(os.path.dirname(os.path.dirname(sys.path[0])))
os.environ["PYOPENGL_PLATFORM"] = "egl" #opengl seems to only work with TPU
sys.path.insert(0,'third_party')
import subprocess
import imageio
import glob
from utils.io ... | banmo-main | scripts/visualize/render_vis.py |
# Copyright (c) Facebook, Inc. and its affiliates. All rights reserved.
import sys, os
sys.path.append(os.path.dirname(os.path.dirname(sys.path[0])))
os.environ["PYOPENGL_PLATFORM"] = "egl" #opengl seems to only work with TPU
curr_dir = os.path.abspath(os.getcwd())
sys.path.insert(0,curr_dir)
import pdb
import glob
imp... | banmo-main | scripts/visualize/render_root_txt.py |
# Copyright (c) Facebook, Inc. and its affiliates. All rights reserved.
import sys, os
import pdb
sys.path.append(os.path.dirname(os.path.dirname(sys.path[0])))
os.environ["PYOPENGL_PLATFORM"] = "egl" #opengl seems to only work with TPU
curr_dir = os.path.abspath(os.getcwd())
sys.path.insert(0,curr_dir)
import subproc... | banmo-main | scripts/visualize/render_root.py |
# Copyright (c) Facebook, Inc. and its affiliates. All rights reserved.
"""
bash scripts/render_nvs.sh
"""
from absl import flags, app
import sys
sys.path.insert(0,'')
sys.path.insert(0,'third_party')
import numpy as np
import torch
import os
import glob
import pdb
import cv2
import trimesh
from scipy.spatial.transfor... | banmo-main | scripts/visualize/nvs.py |
# Copyright (c) Facebook, Inc. and its affiliates. All rights reserved.
"""
bash scripts/render_nvs.sh
"""
from absl import flags, app
import sys
sys.path.insert(0,'')
sys.path.insert(0,'third_party')
import numpy as np
import torch
import os
import glob
import pdb
import cv2
import trimesh
from scipy.spatial.transfor... | banmo-main | scripts/visualize/nvs_iter.py |
# Copyright (c) Facebook, Inc. and its affiliates. All rights reserved.
# TODO: pass ft_cse to use fine-tuned feature
# TODO: pass fine_steps -1 to use fine samples
from absl import flags, app
import sys
sys.path.insert(0,'')
sys.path.insert(0,'third_party')
import numpy as np
from matplotlib import pyplot as plt
impor... | banmo-main | scripts/visualize/match.py |
# Copyright (c) Facebook, Inc. and its affiliates. All rights reserved.
"""
python scripts/ama-process/ama2davis.py --path ./database/T_swing/
"""
import pdb
import cv2
import numpy as np
import os
import glob
import argparse
import sys
from shutil import copyfile
sys.path.insert(0,'')
from utils.io import mkdir_p
p... | banmo-main | scripts/ama-process/ama2davis.py |
# Copyright (c) Facebook, Inc. and its affiliates. All rights reserved.
import numpy as np
import cv2
import pdb
pmat = np.loadtxt('/private/home/gengshany/data/AMA/T_swing/calibration/Camera1.Pmat.cal')
K,R,T,_,_,_,_=cv2.decomposeProjectionMatrix(pmat)
print(K/K[-1,-1])
print(R)
print(T/T[-1])
pdb.set_trace()
| banmo-main | scripts/ama-process/read_cam.py |
# Copyright (c) Facebook, Inc. and its affiliates. All rights reserved.
import sys
sys.path.insert(0,'third_party')
sys.path.insert(0,'./')
import numpy as np
import trimesh
import torch
import cv2
import pdb
from scipy.spatial.transform import Rotation as R
from nnutils.geom_utils import obj_to_cam, pinhole_cam, ren... | banmo-main | scripts/synthetic/render_synthetic.py |
# Copyright (c) Facebook, Inc. and its affiliates. All rights reserved.
# python scripts/eval_root.py cam-files/adult7-b25/ cam-files/adult-masked-cam/ 1000
import sys, os
sys.path.append(os.path.dirname(os.path.dirname(sys.path[0])))
os.environ["PYOPENGL_PLATFORM"] = "egl" #opengl seems to only work with TPU
curr_dir... | banmo-main | scripts/eval/eval_root.py |
# Copyright (c) Facebook, Inc. and its affiliates. All rights reserved.
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import pdb
import os.path as osp
import sys
sys.path.insert(0,'third_party')
import numpy as np
from absl import flags, app
import torc... | banmo-main | dataloader/vidbase.py |
banmo-main | dataloader/__init__.py | |
# Copyright (c) Facebook, Inc. and its affiliates. All rights reserved.
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import os.path as osp
import numpy as np
import scipy.io as sio
from absl import flags, app
import random
import torch
from torch.utils... | banmo-main | dataloader/frameloader.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 setuptools import setup, find_packages
setup(
name='clutrr',
version='1.0.0',
description='Comp... | clutrr-main | setup.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.
#
"""
# Clean the templates from mturk annotated data
# Input = mturk annotated file (amt_mturk.csv)
# Output = placeho... | clutrr-main | clutrr/template_mturk.py |
clutrr-main | clutrr/__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.
#
"""
# Generate story-summary pairs
from clutrr.actors.ancestry import Ancestry
from clutrr.relations.builder import ... | clutrr-main | clutrr/generator.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.
#
"""
## Note: With these current args (max level 3, min_child = max_child = 4), its only possible to generate
## upto ... | clutrr-main | clutrr/args.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.
#
"""
# main file which defines the tasks
from clutrr.args import get_args
from clutrr.generator import generate_rows
f... | clutrr-main | clutrr/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.
#
"""
# Main Puzzle class which maintains the state of a single puzzle
import uuid
import random
from clutrr.utils.util... | clutrr-main | clutrr/relations/puzzle.py |
clutrr-main | clutrr/relations/__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 copy
import random
class Templator:
"""
Templator base class
"""
def __init__(self, templ... | clutrr-main | clutrr/relations/templator.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.
#
"""
# New builder class which makes use of our new data generation
import random
import itertools as it
import copy
... | clutrr-main | clutrr/relations/builder.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.
#
"""
# File which was used in data collection from AMT using ParlAI-Mturk.
# Wrapper to communicate with backend datab... | clutrr-main | clutrr/utils/data_backend.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.
#
"""
# Split the test files into their own task specific files
# Not required in actual data generation
import pandas ... | clutrr-main | clutrr/utils/test_splitter.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.
#
"""
# file to create and maintain an index.html file which will contain a table of datasets for easy maintainance
imp... | clutrr-main | clutrr/utils/web.py |
clutrr-main | clutrr/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 itertools as it
import numpy as np
import csv
import pandas as pd
import random
def pairwise(iterable):
... | clutrr-main | clutrr/utils/utils.py |
clutrr-main | clutrr/actors/__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 numpy as np
import names
import copy
import random
from clutrr.actors.actor import Actor, Entity
from clut... | clutrr-main | clutrr/actors/ancestry.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
class Actor:
"""
male or female actor
"""
def __init__(self, gender='male', name=... | clutrr-main | clutrr/actors/actor.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 json
import yaml
class Store:
def __init__(self,args):
attribute_store = args.attri... | clutrr-main | clutrr/store/store.py |
clutrr-main | clutrr/store/__init__.py | |
# Copyright (c) Meta Platforms, Inc. and affiliates.
import subprocess
from subprocess import check_output
import os
import embeddings
class VecMap:
"""
wrapper for vecmap https://github.com/artetxem/vecmap
assumes vecmap is in the directory ./vecmap
"""
def __init__(self, srcvec, tgtvec, dictpath,... | coocmap-main | baselines.py |
# Copyright (c) Meta Platforms, Inc. and affiliates.
from typing import Optional
import collections
import numpy as np
import pandas as pd
from tokenizers import Tokenizer
# faithfully recreate the protocol of vecmap with minimal code modifications
def vecmap_evaluate(sim: np.ndarray, tokenizer1: Tokenizer, tokeniz... | coocmap-main | evaluation.py |
# Copyright (c) Meta Platforms, Inc. and affiliates.
# Copyright (C) 2016-2018 Mikel Artetxe <artetxem@gmail.com>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the Licen... | coocmap-main | embeddings.py |
# Copyright (c) Meta Platforms, Inc. and affiliates.
import os
from dataclasses import dataclass
import wandb
import shutil
import pandas as pd
import numpy as np
import data
import match
import evaluation
import embeddings
# experimental parameters
defaults = dict(
lan1='./europarl-v7.hu-en.en',
lan2='./eur... | coocmap-main | test_coocmap.py |
# Copyright (c) Meta Platforms, Inc. and affiliates.
import itertools
import os
import sys
import subprocess
import time
# import lzma # needed for BUCC20Corpus
import numpy as np
from tokenizers import Token, Tokenizer
from tokenizers.models import BPE, WordLevel
from tokenizers.trainers import BpeTrainer, WordLevel... | coocmap-main | data.py |
# Copyright (c) Meta Platforms, Inc. and affiliates.
from collections import Counter
import numpy as np
import embeddings
np.set_printoptions(formatter={'float': lambda x: "{0:0.3f}".format(x)})
MAX_SVD_DIM = 5000 # maximum SVD to avoid long compute time
### initialization methods ###
def vecmap_unsup(x, z, norm_proc... | coocmap-main | match.py |
import os
import subprocess
from dataclasses import dataclass
import lzma
import wandb
import argparse
import shutil
import pandas as pd
import numpy as np
import data
import match
import evaluation
import embeddings
# from baselines import VecMap
os.environ['WANDB_IGNORE_GLOBS'] = 'lan1/*,lan2/*'
os.environ["OMP_NU... | coocmap-main | experiments/test_accvsize_cooc.py |
import os
import subprocess
from dataclasses import dataclass
import lzma
import wandb
import argparse
import shutil
import pandas as pd
import numpy as np
import data
import match
import evaluation
import embeddings
# from baselines import VecMap
os.environ['WANDB_IGNORE_GLOBS'] = 'lan1/*,lan2/*'
os.environ["OMP_NU... | coocmap-main | experiments/test_accvsize.py |
import os
import subprocess
from dataclasses import dataclass
import lzma
import wandb
import argparse
import shutil
import pandas as pd
import numpy as np
import data
import match
import evaluation
import embeddings
# from baselines import VecMap
os.environ['WANDB_IGNORE_GLOBS'] = 'lan1/*,lan2/*'
os.environ["OMP_NU... | coocmap-main | experiments/test_dropclip.py |
import os
import subprocess
from dataclasses import dataclass
import lzma
import wandb
import argparse
import shutil
import pandas as pd
import numpy as np
import data
import match
import evaluation
import embeddings
# from baselines import VecMap
os.environ['WANDB_IGNORE_GLOBS'] = 'lan1/*,lan2/*'
os.environ["OMP_NU... | coocmap-main | experiments/test_accvdim.py |
import os
from dataclasses import dataclass
import wandb
import shutil
import pandas as pd
import numpy as np
import data
import match
import evaluation
import embeddings
# experimental parameters
defaults = dict(
lan1='./europarl-v7.hu-en.en',
lan2='./europarl-v7.hu-en.hu',
eval='en-hu',
size1=20,
... | coocmap-main | experiments/test_coocmap.py |
import os
import subprocess
from dataclasses import dataclass
import lzma
import wandb
import argparse
import shutil
import pandas as pd
import numpy as np
import data
import match
import evaluation
import embeddings
# from baselines import VecMap
os.environ['WANDB_IGNORE_GLOBS'] = 'lan1/*,lan2/*'
os.environ["OMP_NU... | coocmap-main | experiments/test_matching.py |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.