python_code
stringlengths
0
4.04M
repo_name
stringlengths
8
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. # import os import sys import tarfile import cv2 from PIL import Image import numpy as np import torch.utils.data as data f...
astmt-master
fblib/dataloaders/pascal_sal.py
astmt-master
fblib/networks/__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 math import torch import torch.nn as nn from fblib.util.mypath import Path try: from torch.hub imp...
astmt-master
fblib/networks/classification/mobilenet_v2.py
astmt-master
fblib/networks/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 os import math from collections import OrderedDict import torch import torch.nn as nn from fblib.util.mypath imp...
astmt-master
fblib/networks/classification/se_mobilenet_v2.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 copy import deepcopy import math import torch.nn.functional as F try: from itertools impor...
astmt-master
fblib/networks/classification/resnext.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 math from collections import OrderedDict import torch import torch.nn as nn import torch.utils.model_zoo...
astmt-master
fblib/networks/classification/resnet.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 math import torch import torch.nn as nn from collections import OrderedDict from fblib.util.mypath impo...
astmt-master
fblib/networks/classification/se_resnet.py
astmt-master
fblib/networks/torch2pytorch/__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 torch import torch.nn as nn from functools import reduce from fblib.util.mypath import Path class Lamb...
astmt-master
fblib/networks/torch2pytorch/resnext_101_32x4d.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 torch import torch.nn as nn from functools import reduce from fblib.util.mypath import Path class Lamb...
astmt-master
fblib/networks/torch2pytorch/resnext_50_32x4d.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 numpy as np from copy import deepcopy import torch import torch.nn as nn from torch.nn import init from ...
astmt-master
fblib/networks/deeplab_single_task/deeplab_resnet.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 copy import deepcopy import torch import torch.nn as nn from torch.nn import init from torch.nn i...
astmt-master
fblib/networks/deeplab_single_task/deeplab_se_resnet.py
astmt-master
fblib/networks/deeplab_single_task/__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 math import torch import torch.nn as nn import torch.nn.functional as F import fblib.networks.classific...
astmt-master
fblib/networks/deeplab_single_task/deeplab_mobilenet_v2.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 torch.nn import functional as F import torch affine_par = True class AtrousSpatialPyramidPoo...
astmt-master
fblib/networks/deeplab_single_task/classifiers.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 math from copy import deepcopy from collections import OrderedDict import torch import torch.nn as nn f...
astmt-master
fblib/networks/deeplab_single_task/resnet.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 math from copy import deepcopy import numpy as np import torch import torch.nn as nn from torch.nn import init fro...
astmt-master
fblib/networks/deeplab_single_task/deeplab_resnext.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 math import torch import torch.nn as nn import torch.nn.functional as F from torch.autograd import grad from fbli...
astmt-master
fblib/networks/deeplab_multi_task/deeplab_se_mobilenet_v2_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. # from copy import deepcopy import torch import torch.nn as nn from torch.nn import init from torch.nn import functional as...
astmt-master
fblib/networks/deeplab_multi_task/deeplab_se_resnet_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 torch import torch.nn as nn import torch.nn.functional as F from fblib.networks.deeplab_multi_task.classifiers_mul...
astmt-master
fblib/networks/deeplab_multi_task/decoders.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 class Discriminator(nn.Module): def __init__(self, in_channels, n_classes): super(Disc...
astmt-master
fblib/networks/deeplab_multi_task/discriminators.py
astmt-master
fblib/networks/deeplab_multi_task/__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 from torch.nn import functional as F from torch.nn import init from fblib.layers.squeez...
astmt-master
fblib/networks/deeplab_multi_task/classifiers_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 numpy as np def jaccard(gt, pred, void_pixels=None): assert(gt.shape == pred.shape) if void_pixels is N...
astmt-master
fblib/evaluation/jaccard.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 warnings import cv2 import os.path import numpy as np import glob import json def eval_albedo(loader, folder): ...
astmt-master
fblib/evaluation/eval_albedo.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 json from fblib.util.mypath import Path def sync_and_evaluate_one_folder(database, save_di...
astmt-master
fblib/evaluation/eval_edges.py
astmt-master
fblib/evaluation/__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 warnings import cv2 import os.path import glob import json import numpy as np from PIL import Image VOC_CATEGORY_N...
astmt-master
fblib/evaluation/eval_semseg.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 json from fblib.util.mypath import Path def exists_dir(dir_in): fold_lst = os.listdir...
astmt-master
fblib/evaluation/parse_eval_results.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 warnings import cv2 import glob import json import os.path import numpy as np from PIL import Image PART_CATEGORY_...
astmt-master
fblib/evaluation/eval_human_parts.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 warnings import cv2 import os.path import numpy as np import glob import json def normal_ize(arr): arr_norm =...
astmt-master
fblib/evaluation/eval_normals.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 warnings import cv2 import os.path import numpy as np import glob import json from PIL import Image import fblib.e...
astmt-master
fblib/evaluation/eval_sal.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 warnings import cv2 import os.path import numpy as np import glob import json import scipy.io as sio def eval_dep...
astmt-master
fblib/evaluation/eval_depth.py
# Copyright (c) Meta Platforms, Inc. and affiliates. # All rights reserved. # This source code is licensed under the license found in the # LICENSE file in the root directory of this source tree. import argparse import json import os import random import shutil import pandas as pd import tqdm if __name__ == "__main...
active_indexing-main
prepare_disc.py
# Copyright (c) Meta Platforms, Inc. and affiliates. # All rights reserved. # This source code is licensed under the license found in the # LICENSE file in the root directory of this source tree. import argparse import os import tqdm import json import torch from torch import device from torchvision import transform...
active_indexing-main
extract_fts.py
# Copyright (c) Meta Platforms, Inc. and affiliates. # All rights reserved. # This source code is licensed under the license found in the # LICENSE file in the root directory of this source tree. import numpy as np from augly.image import functional as aug_functional import torch from torchvision import transforms f...
active_indexing-main
activeindex/utils_img.py
# Copyright (c) Meta Platforms, Inc. and affiliates. # All rights reserved. # This source code is licensed under the license found in the # LICENSE file in the root directory of this source tree. import torch import torch.nn as nn import torch.nn.functional as F class JND(nn.Module): """ https://ieeexplore.ieee....
active_indexing-main
activeindex/attenuations.py
# Copyright (c) Meta Platforms, Inc. and affiliates. # All rights reserved. # This source code is licensed under the license found in the # LICENSE file in the root directory of this source tree. import argparse import json import os import random from typing import Any, Dict, List, NamedTuple, Tuple import augly.im...
active_indexing-main
activeindex/augment_queries.py
active_indexing-main
activeindex/__init__.py
# Copyright (c) Meta Platforms, Inc. and affiliates. # All rights reserved. # This source code is licensed under the license found in the # LICENSE file in the root directory of this source tree. import argparse import json import time from typing import Callable import faiss import numpy as np import torch from tor...
active_indexing-main
activeindex/engine.py
# Copyright (c) Meta Platforms, Inc. and affiliates. # All rights reserved. # This source code is licensed under the license found in the # LICENSE file in the root directory of this source tree. import functools import logging import os import faiss from PIL import Image, ImageFile ImageFile.LOAD_TRUNCATED_IMAGES =...
active_indexing-main
activeindex/utils.py
# Copyright (c) Meta Platforms, Inc. and affiliates. # All rights reserved. # This source code is licensed under the license found in the # LICENSE file in the root directory of this source tree. import argparse import os import random import faiss import tqdm import numpy as np import pandas as pd import torch imp...
active_indexing-main
activeindex/main.py
Active-3D-Vision-and-Touch-main
__init__.py
#!/usr/bin/env python # Copyright (c) Facebook, Inc. and its affiliates. # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. import setuptools setuptools.setup( name="pterotactyl", version="0.1.0", author="Facebook AI Research", ...
Active-3D-Vision-and-Touch-main
setup.py
# Copyright (c) Facebook, Inc. and its affiliates. # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree.
Active-3D-Vision-and-Touch-main
pterotactyl/__init__.py
# Copyright (c) Facebook, Inc. and its affiliates. # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree.
Active-3D-Vision-and-Touch-main
pterotactyl/objects/__init__.py
Active-3D-Vision-and-Touch-main
pterotactyl/objects/hand/__init__.py
# Copyright (c) Facebook, Inc. and its affiliates. # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. import os import numpy as np import torch from pterotactyl.utility import utils BASE_MESH_SIZE = 1824 BASE_CHART_SIZE = 25 # replay buffer u...
Active-3D-Vision-and-Touch-main
pterotactyl/policies/replay.py
# Copyright (c) Facebook, Inc. and its affiliates. # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. import os import random import numpy as np import torch import torch.utils.data from pterotactyl.utility import utils from pterotactyl.utility...
Active-3D-Vision-and-Touch-main
pterotactyl/policies/environment.py
# Copyright (c) Facebook, Inc. and its affiliates. # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. import torch.nn as nn import torch from pterotactyl.utility import utils class Latent_Model(nn.Module): def __init__(self, args): ...
Active-3D-Vision-and-Touch-main
pterotactyl/policies/supervised/model.py
# Copyright (c) Facebook, Inc. and its affiliates. # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. import os import json import argparse from collections import namedtuple from tqdm import tqdm from torch.utils.data import DataLoader import t...
Active-3D-Vision-and-Touch-main
pterotactyl/policies/supervised/train.py
# Copyright (c) Facebook, Inc. and its affiliates. # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. import random import torch import torch.nn as nn import torch.optim as optim from pterotactyl.policies.DDQN import model from pterotactyl.poli...
Active-3D-Vision-and-Touch-main
pterotactyl/policies/DDQN/ddqn.py
# Copyright (c) Facebook, Inc. and its affiliates. # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. import math import torch.nn as nn import torch from torch.nn.parameter import Parameter import torch.nn.functional as F import numpy as np fro...
Active-3D-Vision-and-Touch-main
pterotactyl/policies/DDQN/model.py
# Copyright (c) Facebook, Inc. and its affiliates. # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. import os from torch.utils.tensorboard import SummaryWriter from torch.utils.data import DataLoader import torch import argparse from submitit....
Active-3D-Vision-and-Touch-main
pterotactyl/policies/DDQN/train.py
# Copyright (c) Facebook, Inc. and its affiliates. # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. import os import random from tqdm import tqdm from torch.utils.data import DataLoader import torch import argparse import numpy as np from subm...
Active-3D-Vision-and-Touch-main
pterotactyl/policies/NearestNeighbor/train.py
# Copyright (c) Facebook, Inc. and its affiliates. # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. import numpy as np import random # class for getting radnom samples from the space of action class random_sampler: def __init__(self, args...
Active-3D-Vision-and-Touch-main
pterotactyl/policies/baselines/baselines.py
# Copyright (c) Facebook, Inc. and its affiliates. # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. from tqdm import tqdm import os from torch.utils.data import DataLoader import torch import argparse from pterotactyl.policies import environm...
Active-3D-Vision-and-Touch-main
pterotactyl/policies/baselines/even.py
# Copyright (c) Facebook, Inc. and its affiliates. # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. from tqdm import tqdm import os from torch.utils.data import DataLoader import torch import argparse from pterotactyl.policies import environm...
Active-3D-Vision-and-Touch-main
pterotactyl/policies/baselines/greedy.py
Active-3D-Vision-and-Touch-main
pterotactyl/policies/baselines/__init__.py
# Copyright (c) Facebook, Inc. and its affiliates. # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. import os from tqdm import tqdm from torch.utils.data import DataLoader import torch import argparse from pterotactyl.policies import environm...
Active-3D-Vision-and-Touch-main
pterotactyl/policies/baselines/rand.py
# Copyright (c) Facebook, Inc. and its affiliates. # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. import os import random from tqdm import tqdm import numpy as np from torch.utils.data import DataLoader import torch import argparse from subm...
Active-3D-Vision-and-Touch-main
pterotactyl/policies/dataset_specific/MFBA.py
# Copyright (c) Facebook, Inc. and its affiliates. # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. import os import random from tqdm.notebook import tqdm import numpy as np from torch.utils.data import DataLoader import torch import argparse ...
Active-3D-Vision-and-Touch-main
pterotactyl/policies/dataset_specific/LEBA.py
Active-3D-Vision-and-Touch-main
pterotactyl/simulator/__init__.py
# Copyright (c) Facebook, Inc. and its affiliates. # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. import os os.environ["PYOPENGL_PLATFORM"] = "egl" import numpy as np from scipy.spatial.transform import Rotation as R import pyrender import t...
Active-3D-Vision-and-Touch-main
pterotactyl/simulator/rendering/vision_renderer.py
Active-3D-Vision-and-Touch-main
pterotactyl/simulator/rendering/__init__.py
# Copyright (c) Facebook, Inc. and its affiliates. # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. import os os.environ["PYOPENGL_PLATFORM"] = "egl" import numpy as np import cv2 import pyrender import trimesh from scipy.spatial.transform im...
Active-3D-Vision-and-Touch-main
pterotactyl/simulator/rendering/tacto_renderer.py
# Copyright (c) Facebook, Inc. and its affiliates. # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. import os os.environ["PYOPENGL_PLATFORM"] = "egl" import numpy as np import pyrender from pterotactyl.utility import utils class Renderer: ...
Active-3D-Vision-and-Touch-main
pterotactyl/simulator/rendering/touch_renderer.py
Active-3D-Vision-and-Touch-main
pterotactyl/simulator/physics/__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 trimesh from scipy.spatial.transform import Rotation as R from scipy.spatial import ConvexHull from pt...
Active-3D-Vision-and-Touch-main
pterotactyl/simulator/physics/grasping.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 pybullet as pb import numpy as np import trimesh import torch from scipy.spatial.transform import Rotation as R...
Active-3D-Vision-and-Touch-main
pterotactyl/simulator/scene/instance.py
Active-3D-Vision-and-Touch-main
pterotactyl/simulator/scene/__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 numpy as np import pybullet_utils.bullet_client as bc import pybullet as pb import pybullet_data import torch f...
Active-3D-Vision-and-Touch-main
pterotactyl/simulator/scene/sampler.py
# Copyright (c) Facebook, Inc. and its affiliates. # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree.
Active-3D-Vision-and-Touch-main
pterotactyl/object_data/__init__.py
Active-3D-Vision-and-Touch-main
pterotactyl/reconstruction/__init__.py
# Copyright (c) Facebook, Inc. and its affiliates. # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. import math import torch.nn as nn import torch import numpy as np from torch.nn.parameter import Parameter import torch.nn.functional as F # ...
Active-3D-Vision-and-Touch-main
pterotactyl/reconstruction/autoencoder/model.py
# Copyright (c) Facebook, Inc. and its affiliates. # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. import os import torch import numpy as np from tqdm import tqdm import argparse import random from PIL import Image from torch.utils.tensorboar...
Active-3D-Vision-and-Touch-main
pterotactyl/reconstruction/autoencoder/train.py
Active-3D-Vision-and-Touch-main
pterotactyl/reconstruction/touch/__init__.py
# Copyright (c) Facebook, Inc. and its affiliates. # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. import torch import torch.nn as nn # CNN block class DoubleConv(nn.Module): def __init__(self, in_channels, out_channels, last=False): ...
Active-3D-Vision-and-Touch-main
pterotactyl/reconstruction/touch/model.py
# Copyright (c) Facebook, Inc. and its affiliates. # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. import os import torch from tqdm import tqdm import argparse from torch.utils.tensorboard import SummaryWriter import torch.optim as optim from...
Active-3D-Vision-and-Touch-main
pterotactyl/reconstruction/touch/train.py
# Copyright (c) Facebook, Inc. and its affiliates. # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. import math import torch.nn as nn import torch import numpy as np from torch.nn.parameter import Parameter import torch.nn.functional as F from...
Active-3D-Vision-and-Touch-main
pterotactyl/reconstruction/vision/model.py
# Copyright (c) Facebook, Inc. and its affiliates. # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. import os import torch import numpy as np from tqdm import tqdm import argparse from torch.utils.tensorboard import SummaryWriter import torch...
Active-3D-Vision-and-Touch-main
pterotactyl/reconstruction/vision/train.py
Active-3D-Vision-and-Touch-main
pterotactyl/pretrained/__init__.py
Active-3D-Vision-and-Touch-main
pterotactyl/utility/__init__.py
# Copyright (c) Facebook, Inc. and its affiliates. # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. import os import random from glob import glob from tqdm import tqdm import numpy as np import torch from torchvision import transforms import ...
Active-3D-Vision-and-Touch-main
pterotactyl/utility/data_loaders.py
# Copyright (c) Facebook, Inc. and its affiliates. # This source code is licensed under the MIT license found in the # LICENSE file in the root directory of this source tree. import random import os from PIL import Image import math import json import numpy as np import torch import torch.nn.functional as F import ma...
Active-3D-Vision-and-Touch-main
pterotactyl/utility/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 os os.environ["PYOPENGL_PLATFORM"] = "egl" import numpy as np import trimesh from scipy.spatial.transform import Rotatio...
Active-3D-Vision-and-Touch-main
pterotactyl/utility/pretty_render.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 numpy as np from tqdm import tqdm from glob import glob import random from pathlib import Path import torch im...
Active-3D-Vision-and-Touch-main
pterotactyl/utility/data_making.py
import nltk import textstat from nltk.tree import Tree import benepar, spacy import json import numpy as np nlp = spacy.load('en_core_web_md') nlp.add_pipe(benepar.BeneparComponent("benepar_en3")) import torch, transformers tokenizer = transformers.AutoTokenizer.from_pretrained('../training/checkpoint-all-nli-100000')...
dadc-limit-main
analysis/complexity.py
import nltk import json from tqdm import tqdm import numpy as np def compute_stats(contexts, hypotheses, labels): high_overlap_rates_entailment = [] high_overlap_rates_contradiction = [] for context, hypothesis, label in tqdm(zip(contexts, hypotheses, labels)): context_tokens = nltk.word_tokenize(c...
dadc-limit-main
analysis/artifacts.py
import nltk import json import numpy as np from sacrebleu.metrics import BLEU from tqdm import tqdm from collections import defaultdict import random def interbleu(hypotheses, labels): bleu = BLEU() avg_score = 0.0 total = 0.0 random.shuffle(hypotheses) for hypothesis1_idx, hypothesis1 in tqdm(enum...
dadc-limit-main
analysis/diversity.py
# Copyright (c) Meta Platforms, Inc. All Rights Reserved import argparse import os import numpy as np import torch from human_body_prior.body_model.body_model import BodyModel from human_body_prior.tools.rotation_tools import aa2matrot, local2global_pose from tqdm import tqdm from utils import utils_transform def m...
AGRoL-main
prepare_data.py
# Copyright (c) Meta Platforms, Inc. All Rights Reserved import math import os import random import numpy as np import torch from data_loaders.dataloader import load_data, TestDataset from human_body_prior.body_model.body_model import BodyModel as BM from model.networks import PureMLP from tqdm import tqdm from u...
AGRoL-main
test.py
# Copyright (c) Meta Platforms, Inc. All Rights Reserved import json import os import random import numpy as np import torch from data_loaders.dataloader import get_dataloader, load_data, TrainDataset from model.networks import PureMLP from runner.train_mlp import train_step from runner.training_loop import TrainLoo...
AGRoL-main
train.py
# MIT License # Copyright (c) 2021 OpenAI # # This code is based on https://github.com/openai/guided-diffusion # MIT License # Copyright (c) 2022 Guy Tevet # # This code is based on https://github.com/GuyTevet/motion-diffusion-model # Copyright (c) Meta Platforms, Inc. All Rights Reserved import functools import os ...
AGRoL-main
runner/training_loop.py
# Copyright (c) Meta Platforms, Inc. All Rights Reserved import torch def update_lr_multistep( nb_iter, total_iter, max_lr, min_lr, optimizer, lr_anneal_steps ): if nb_iter > lr_anneal_steps: current_lr = min_lr else: current_lr = max_lr for param_group in optimizer.param_groups: ...
AGRoL-main
runner/train_mlp.py
# Copyright (c) Meta Platforms, Inc. All Rights Reserved # Metric functions with same inputs import numpy as np import torch def pred_jitter( predicted_position, predicted_angle, predicted_root_angle, gt_position, gt_angle, gt_root_angle, upper_index, lower_index, fps, ): pred...
AGRoL-main
utils/metrics.py
import os SMPL_DATA_PATH = "./body_models/smpl" SMPL_KINTREE_PATH = os.path.join(SMPL_DATA_PATH, "kintree_table.pkl") SMPL_MODEL_PATH = os.path.join(SMPL_DATA_PATH, "SMPL_NEUTRAL.pkl") JOINT_REGRESSOR_TRAIN_EXTRA = os.path.join(SMPL_DATA_PATH, "J_regressor_extra.npy") ROT_CONVENTION_TO_ROT_NUMBER = { "legacy": ...
AGRoL-main
utils/config.py
# MIT License # Copyright (c) 2022 Guy Tevet # # This code is based on https://github.com/GuyTevet/motion-diffusion-model # Copyright (c) Meta Platforms, Inc. All Rights Reserved from diffusion import gaussian_diffusion as gd from diffusion.respace import space_timesteps, SpacedDiffusion from model.meta_model import M...
AGRoL-main
utils/model_util.py
# Copyright (c) Facebook, Inc. and its affiliates. All rights reserved. # Check PYTORCH3D_LICENCE before use import functools from typing import Optional import torch import torch.nn.functional as F """ The transformation matrices returned from the functions in this file assume the points on which the transformatio...
AGRoL-main
utils/rotation_conversions.py