python_code stringlengths 0 4.04M | repo_name stringlengths 8 58 | file_path stringlengths 5 147 |
|---|---|---|
c3dm-main | c3dm/tools/__init__.py | |
# Copyright (c) Facebook, Inc. and its affiliates.
import pickle
import torch
import glob
import os
def load_stats(flstats):
try:
stats, _ = pickle.load(open(flstats,'rb')) # dont load the config
except Exception as e:
print("Cant load stats! %s" % flstats)
stats = None
return stat... | c3dm-main | c3dm/tools/model_io.py |
# Copyright (c) Facebook, Inc. and its affiliates.
import matplotlib
matplotlib.use('Agg')
import matplotlib.pyplot as plt
import os
import time
import sys
import copy
import torch
from tqdm import tqdm
from tools.stats import Stats
from tools.utils import pprint_dict, has_method, get_net_input
def cache_preds(mod... | c3dm-main | c3dm/tools/cache_preds.py |
# Copyright (c) Facebook, Inc. and its affiliates.
import torch
import math
import torch.nn.functional as Fu
def so3_6d_to_rot(d6):
"""
d6 ... batch x 6
Follows Sec. B in the appendix of:
https://arxiv.org/pdf/1812.07035.pdf
"""
a1, a2 = d6[:, :3], d6[:, 3:]
b1 = Fu.normalize(a1, dim=1)... | c3dm-main | c3dm/tools/so3.py |
# Copyright (c) Facebook, Inc. and its affiliates.
from tools.attr_dict import AttrDict
import inspect
import io
import os
import tarfile
import time
import urllib.request
import zipfile
import numpy as np
def pprint_dict(d, indent=3):
for key, value in d.items():
print(' ' * indent + str(key),end='', flush=True)... | c3dm-main | c3dm/tools/utils.py |
# Copyright (c) Facebook, Inc. and its affiliates.
import torch
import torch.nn as nn
from torchvision import models
import torch.nn.functional as F
Fu = F
from torch.autograd import Variable
import numpy as np
from math import exp
from tools.functions import avg_l2_dist, avg_l2_huber, image_meshgrid, huber, logexplo... | c3dm-main | c3dm/tools/loss_models.py |
# Copyright (c) Facebook, Inc. and its affiliates.
import os
import numpy as np
import sys
import time
import pickle
import matplotlib
import matplotlib.pyplot as plt
import copy
from matplotlib import colors as mcolors
from itertools import cycle
from collections.abc import Iterable
from tools.vis_utils import get_v... | c3dm-main | c3dm/tools/stats.py |
# Copyright (c) Facebook, Inc. and its affiliates.
import numpy as np
import copy
import io
import os
from matplotlib import cm
import matplotlib.pyplot as plt
from PIL import Image
from PIL import ImageFont
from PIL import ImageDraw
import torch
from tools.utils import NumpySeedFix
from visdom import Visdom
imp... | c3dm-main | c3dm/tools/vis_utils.py |
# Copyright (c) Facebook, Inc. and its affiliates.
from visdom import Visdom
from tools.vis_utils import get_visdom_connection, denorm_image_trivial
import plotly.graph_objects as go
from plotly.subplots import make_subplots
import numpy as np
import os
from PIL import Image
fig = make_subplots(
rows = ... | c3dm-main | c3dm/tools/visdom_plotly.py |
# Copyright (c) Facebook, Inc. and its affiliates.
import time
import torch
import torch.nn.functional as Fu
import numpy as np
import collections
from tools.functions import safe_sqrt
from tools.pcl_unproject import depth2pcl
def in_hull(p, hull, extendy=False):
"""
Test if points in `p` are in `hull`
`p` shoul... | c3dm-main | c3dm/tools/eval_functions.py |
# Copyright (c) Facebook, Inc. and its affiliates.
import os
import copy
import io
import gzip
import urllib.request
from dataset.dataset_configs import (
IMAGE_ROOTS, MASK_ROOTS, DEPTH_ROOTS, DATASET_ROOT, DATASET_CFG,
IMAGE_URLS, MASK_URLS, DEPTH_URLS
)
from dataset.keypoints_dataset import KeypointsDataset
from... | c3dm-main | c3dm/dataset/dataset_zoo.py |
# Copyright (c) Facebook, Inc. and its affiliates.
import numpy as np
import torch
from tools.utils import Timer
from torch.utils.data.sampler import Sampler
from torch._six import int_classes as _int_classes
class SceneBatchSampler(Sampler):
def __init__(self, sampler, batch_size, drop_last, \
train=True,... | c3dm-main | c3dm/dataset/batch_samplers.py |
# Copyright (c) Facebook, Inc. and its affiliates.
import torch
import numpy as np
import copy
from model import load_nrsfm_model
from tools.cache_preds import cache_preds
def run_c3dpo_model_on_dset(dset, nrsfm_exp_dir):
print('caching c3dpo outputs')
# make a dataset copy without any random sampling
# and ima... | c3dm-main | c3dm/dataset/c3dpo_annotate.py |
# Copyright (c) Facebook, Inc. and its affiliates.
from collections import defaultdict
import json
import os
import numpy as np
import torch
import trimesh
from visdom import Visdom
from dataset.dataset_configs import IMAGE_ROOTS
from dataset.keypoints_dataset import load_depth, load_mask
from tools.eval_functions i... | c3dm-main | c3dm/dataset/eval_zoo.py |
# Copyright (c) Facebook, Inc. and its affiliates.
import torch
import os
import sys
import json
import copy
import glob
import pickle, gzip
import numpy as np
import torch
from PIL import Image
from torch.utils import data
from tools.utils import NumpySeedFix, auto_init_args
class KeypointsDataset(data.Dataset)... | c3dm-main | c3dm/dataset/keypoints_dataset.py |
# Copyright (c) Facebook, Inc. and its affiliates.
import copy
# list of root folders containing the dataset images
IMAGE_ROOTS = {
'freicars_clickp_filtd': ('./dataset_root/freicars/',),
'freicars_clickp_filtd_dbg': ('./dataset_root/freicars/',),
'cub_birds_hrnet_v2': ('./dataset_root/cub_birds/',),
... | c3dm-main | c3dm/dataset/dataset_configs.py |
"""
Copyright (c) Facebook, Inc. and its affiliates.
This source code is licensed under the MIT license found in the
LICENSE file in the root directory of this source tree.
"""
from setuptools import find_packages, setup
install_requires = [
"numpy",
"pandas",
"Pillow",
"pytorch-lightning",
"pyyam... | CovidPrognosis-main | setup.py |
"""
Copyright (c) Facebook, Inc. and its affiliates.
This source code is licensed under the MIT license found in the
LICENSE file in the root directory of this source tree.
"""
from pathlib import Path
import numpy as np
import pytest
import yaml
from covidprognosis.data import (
CheXpertDataset,
CombinedXray... | CovidPrognosis-main | tests/conftest.py |
CovidPrognosis-main | tests/__init__.py | |
"""
Copyright (c) Facebook, Inc. and its affiliates.
This source code is licensed under the MIT license found in the
LICENSE file in the root directory of this source tree.
"""
import pytest
import torchvision.transforms as tvt
from covidprognosis.data.transforms import Compose
from .conftest import fetch_dataset
@... | CovidPrognosis-main | tests/test_xray_datasets.py |
"""
Copyright (c) Facebook, Inc. and its affiliates.
This source code is licensed under the MIT license found in the
LICENSE file in the root directory of this source tree.
"""
import covidprognosis.data.transforms as cpt
import numpy as np
import pytest
import torch
import torchvision.transforms as tvt
from scipy.ndi... | CovidPrognosis-main | tests/test_transforms.py |
import covidprognosis.data
import covidprognosis.models
import covidprognosis.plmodules
| CovidPrognosis-main | covidprognosis/__init__.py |
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved
# Code adapted from https://github.com/facebookresearch/moco
from typing import Tuple
import torch
import torch.nn as nn
from torch import Tensor
class MoCo(nn.Module):
"""
Build a MoCo model with: a query encoder, a key encoder, and a qu... | CovidPrognosis-main | covidprognosis/models/moco_model.py |
from .moco_model import MoCo
| CovidPrognosis-main | covidprognosis/models/__init__.py |
from .xray_datamodule import XrayDataModule
| CovidPrognosis-main | covidprognosis/plmodules/__init__.py |
"""
Copyright (c) Facebook, Inc. and its affiliates.
This source code is licensed under the MIT license found in the
LICENSE file in the root directory of this source tree.
"""
import os
from argparse import ArgumentParser
from typing import Callable, List, Optional, Union
import covidprognosis as cp
import numpy as ... | CovidPrognosis-main | covidprognosis/plmodules/xray_datamodule.py |
"""
Copyright (c) Facebook, Inc. and its affiliates.
This source code is licensed under the MIT license found in the
LICENSE file in the root directory of this source tree.
"""
from typing import Callable, Dict, List, Tuple, Union
import numpy as np
import torch
from scipy.ndimage import gaussian_filter
class XRayT... | CovidPrognosis-main | covidprognosis/data/transforms.py |
"""
Copyright (c) Facebook, Inc. and its affiliates.
This source code is licensed under the MIT license found in the
LICENSE file in the root directory of this source tree.
"""
import os
from pathlib import Path
from typing import Callable, Dict, List, Optional, Union
import numpy as np
import pandas as pd
from PIL i... | CovidPrognosis-main | covidprognosis/data/base_dataset.py |
from .base_dataset import BaseDataset
from .chexpert import CheXpertDataset
from .combined_datasets import CombinedXrayDataset
from .mimic_cxr import MimicCxrJpgDataset
from .nih_chest_xrays import NIHChestDataset
| CovidPrognosis-main | covidprognosis/data/__init__.py |
"""
Copyright (c) Facebook, Inc. and its affiliates.
This source code is licensed under the MIT license found in the
LICENSE file in the root directory of this source tree.
"""
import logging
import os
from typing import Callable, Dict, List, Optional, Union
import numpy as np
import pandas as pd
from .base_dataset ... | CovidPrognosis-main | covidprognosis/data/chexpert.py |
"""
Copyright (c) Facebook, Inc. and its affiliates.
This source code is licensed under the MIT license found in the
LICENSE file in the root directory of this source tree.
"""
import os
from typing import Callable, List, Optional, Union
from .base_dataset import BaseDataset
from .chexpert import CheXpertDataset
from... | CovidPrognosis-main | covidprognosis/data/combined_datasets.py |
"""
Copyright (c) Facebook, Inc. and its affiliates.
This source code is licensed under the MIT license found in the
LICENSE file in the root directory of this source tree.
"""
import logging
import os
from typing import Callable, Dict, List, Optional, Union
import numpy as np
import pandas as pd
from .base_dataset ... | CovidPrognosis-main | covidprognosis/data/nih_chest_xrays.py |
"""
Copyright (c) Facebook, Inc. and its affiliates.
This source code is licensed under the MIT license found in the
LICENSE file in the root directory of this source tree.
"""
import logging
import os
from typing import Callable, Dict, List, Optional, Union
import numpy as np
import pandas as pd
from .base_dataset ... | CovidPrognosis-main | covidprognosis/data/mimic_cxr.py |
"""
Copyright (c) Facebook, Inc. and its affiliates.
This source code is licensed under the MIT license found in the
LICENSE file in the root directory of this source tree.
"""
from torch.utils.data._utils.collate import default_collate
def collate_fn(batch):
"""Collate function to handle X-ray metadata."""
... | CovidPrognosis-main | covidprognosis/data/collate_fn.py |
"""
Copyright (c) Facebook, Inc. and its affiliates.
This source code is licensed under the MIT license found in the
LICENSE file in the root directory of this source tree.
"""
from argparse import ArgumentParser
import covidprognosis as cp
import pytorch_lightning as pl
import torch
import torchvision.models as mode... | CovidPrognosis-main | cp_examples/moco_pretrain/moco_module.py |
CovidPrognosis-main | cp_examples/moco_pretrain/__init__.py | |
"""
Copyright (c) Facebook, Inc. and its affiliates.
This source code is licensed under the MIT license found in the
LICENSE file in the root directory of this source tree.
"""
import os
from argparse import ArgumentParser
from pathlib import Path
import pytorch_lightning as pl
import yaml
from covidprognosis.data.tr... | CovidPrognosis-main | cp_examples/moco_pretrain/train_moco.py |
"""
Copyright (c) Facebook, Inc. and its affiliates.
This source code is licensed under the MIT license found in the
LICENSE file in the root directory of this source tree.
"""
from argparse import ArgumentParser
from pathlib import Path
import math
import pytorch_lightning as pl
import torch
import torch.nn as nn
im... | CovidPrognosis-main | cp_examples/mip_finetune/mip_model.py |
"""
Copyright (c) Facebook, Inc. and its affiliates.
This source code is licensed under the MIT license found in the
LICENSE file in the root directory of this source tree.
"""
import logging
import os
from argparse import ArgumentParser
from pathlib import Path
from warnings import warn
import numpy as np
import pyt... | CovidPrognosis-main | cp_examples/mip_finetune/train_mip.py |
"""
Copyright (c) Facebook, Inc. and its affiliates.
This source code is licensed under the MIT license found in the
LICENSE file in the root directory of this source tree.
"""
from argparse import ArgumentParser
from pathlib import Path
import pytorch_lightning as pl
import requests
import torch
import torchvision.m... | CovidPrognosis-main | cp_examples/sip_finetune/sip_finetune.py |
"""
Copyright (c) Facebook, Inc. and its affiliates.
This source code is licensed under the MIT license found in the
LICENSE file in the root directory of this source tree.
"""
import logging
import os
from argparse import ArgumentParser
from pathlib import Path
from warnings import warn
import numpy as np
import pyt... | CovidPrognosis-main | cp_examples/sip_finetune/train_sip.py |
# Copyright (c) Meta Platforms, Inc. and affiliates.
# All rights reserved.
# This source code is licensed under the license found in the
# LICENSE file in the root directory of this source tree.
import argparse
import datetime
import numpy as np
import time
import json
import os
from pathlib import Path
import to... | ConvNeXt-V2-main | main_pretrain.py |
# Copyright (c) Meta Platforms, Inc. and affiliates.
# All rights reserved.
# This source code is licensed under the license found in the
# LICENSE file in the root directory of this source tree.
import argparse
import os
import uuid
from pathlib import Path
import main_finetune as trainer
import submitit
def par... | ConvNeXt-V2-main | submitit_finetune.py |
# Copyright (c) Meta Platforms, Inc. and affiliates.
# All rights reserved.
# This source code is licensed under the license found in the
# LICENSE file in the root directory of this source tree.
import os
from torchvision import datasets, transforms
from timm.data.constants import \
IMAGENET_DEFAULT_MEAN, IMA... | ConvNeXt-V2-main | datasets.py |
# Copyright (c) Meta Platforms, Inc. and affiliates.
# All rights reserved.
# This source code is licensed under the license found in the
# LICENSE file in the root directory of this source tree.
import math
from typing import Iterable, Optional
import torch
from timm.data import Mixup
from timm.utils import accu... | ConvNeXt-V2-main | engine_finetune.py |
# Copyright (c) Meta Platforms, Inc. and affiliates.
# All rights reserved.
# This source code is licensed under the license found in the
# LICENSE file in the root directory of this source tree.
import math
import sys
from typing import Iterable
import torch
import utils
def train_one_epoch(model: torch.nn.Modul... | ConvNeXt-V2-main | engine_pretrain.py |
# Copyright (c) Meta Platforms, Inc. and affiliates.
# All rights reserved.
# This source code is licensed under the license found in the
# LICENSE file in the root directory of this source tree.
import os
import math
import time
from collections import defaultdict, deque
import datetime
import numpy as np
from tim... | ConvNeXt-V2-main | utils.py |
# Copyright (c) Meta Platforms, Inc. and affiliates.
# All rights reserved.
# This source code is licensed under the license found in the
# LICENSE file in the root directory of this source tree.
import argparse
import os
import uuid
from pathlib import Path
import main_pretrain as trainer
import submitit
def par... | ConvNeXt-V2-main | submitit_pretrain.py |
# Copyright (c) Meta Platforms, Inc. and affiliates.
# All rights reserved.
# This source code is licensed under the license found in the
# LICENSE file in the root directory of this source tree.
import argparse
import datetime
import numpy as np
import time
import json
import os
from pathlib import Path
import to... | ConvNeXt-V2-main | main_finetune.py |
# Copyright (c) Meta Platforms, Inc. and affiliates.
# All rights reserved.
# This source code is licensed under the license found in the
# LICENSE file in the root directory of this source tree.
import torch
from torch import optim as optim
from timm.optim.adafactor import Adafactor
from timm.optim.adahessian imp... | ConvNeXt-V2-main | optim_factory.py |
# Copyright (c) Meta Platforms, Inc. and affiliates.
# All rights reserved.
# This source code is licensed under the license found in the
# LICENSE file in the root directory of this source tree.
import torch
import torch.nn as nn
import torch.nn.functional as F
from timm.models.layers import trunc_normal_, DropPath... | ConvNeXt-V2-main | models/convnextv2.py |
# Copyright (c) Meta Platforms, Inc. and affiliates.
# All rights reserved.
# This source code is licensed under the license found in the
# LICENSE file in the root directory of this source tree.
import torch
import torch.nn as nn
from timm.models.layers import trunc_normal_
from .utils import (
LayerNorm,
... | ConvNeXt-V2-main | models/convnextv2_sparse.py |
# Copyright (c) Meta Platforms, Inc. and affiliates.
# All rights reserved.
# This source code is licensed under the license found in the
# LICENSE file in the root directory of this source tree.
import torch
import torch.nn as nn
from MinkowskiEngine import (
MinkowskiConvolution,
MinkowskiDepthwiseConvol... | ConvNeXt-V2-main | models/fcmae.py |
# Copyright (c) Meta Platforms, Inc. and affiliates.
# All rights reserved.
# This source code is licensed under the license found in the
# LICENSE file in the root directory of this source tree.
import numpy.random as random
import torch
import torch.nn as nn
import torch.nn.functional as F
from MinkowskiEngine i... | ConvNeXt-V2-main | models/utils.py |
"""
Copyright (c) Meta Platforms, Inc. and affiliates.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to... | Data_Acquisition_for_ML_Benchmark-main | src/dam.py |
"""
Copyright (c) Meta Platforms, Inc. and affiliates.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to... | Data_Acquisition_for_ML_Benchmark-main | src/buyer.py |
"""
Copyright (c) Meta Platforms, Inc. and affiliates.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to... | Data_Acquisition_for_ML_Benchmark-main | src/marketengine.py |
"""
Copyright (c) Meta Platforms, Inc. and affiliates.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to... | Data_Acquisition_for_ML_Benchmark-main | src/visualize_acc_cost.py |
"""
Copyright (c) Meta Platforms, Inc. and affiliates.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to... | Data_Acquisition_for_ML_Benchmark-main | src/evaluator_acc_cost.py |
import matplotlib # noqa
matplotlib.use('Agg') # noqa
import matplotlib.pyplot as plt
plt.rcParams['axes.facecolor'] = 'white'
import numpy as np
import matplotlib.ticker as ticker
import json
import seaborn as sn
import pandas as pd
from matplotlib.colors import LogNorm
import seaborn as sns
from matplotlib.colors... | Data_Acquisition_for_ML_Benchmark-main | src/visualizetools.py |
"""
Copyright (c) Meta Platforms, Inc. and affiliates.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to... | Data_Acquisition_for_ML_Benchmark-main | src/example.py |
"""
Copyright (c) Meta Platforms, Inc. and affiliates.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to... | Data_Acquisition_for_ML_Benchmark-main | src/utils.py |
"""
Copyright (c) Meta Platforms, Inc. and affiliates.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to... | Data_Acquisition_for_ML_Benchmark-main | src/seller.py |
"""
Copyright (c) Meta Platforms, Inc. and affiliates.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to... | Data_Acquisition_for_ML_Benchmark-main | src/helper.py |
"""
Copyright (c) Meta Platforms, Inc. and affiliates.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to... | Data_Acquisition_for_ML_Benchmark-main | src/pricefunction.py |
"""
Copyright (c) Meta Platforms, Inc. and affiliates.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to... | Data_Acquisition_for_ML_Benchmark-main | src/evaluator.py |
"""
Copyright (c) Meta Platforms, Inc. and affiliates.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to... | Data_Acquisition_for_ML_Benchmark-main | src/evaluator_submission.py |
#!/usr/bin/env python
# Copyright (c) Facebook, Inc. and its affiliates.
# coding: utf-8
# In[1]:
import os, sys
import time
sys.path.insert(0, '..')
import numpy as np
import matplotlib.pyplot as plt
from matplotlib.cbook import flatten
import lib
import torch, torch.nn as nn
import torch.nn.functional as F
from s... | Augur-main | train/augur_node_trainer.py |
# Copyright (c) Facebook, Inc. and its affiliates.
# Code by Samarth Brahmbhatt
import os
from scripts.download_data import ContactPoseDownloader
osp = os.path
def startup(data_dir=None, default_dir=osp.join('data', 'contactpose_data')):
# check that the provided data_dir is OK
if data_dir is not None:
asser... | ContactPose-main | startup.py |
# Copyright (c) Facebook, Inc. and its affiliates.
# Code by Samarth Brahmbhatt | ContactPose-main | __init__.py |
# Copyright (c) Facebook, Inc. and its affiliates.
# Code by Samarth Brahmbhatt
import numpy as np
import logging
import math
import transforms3d.euler as txe
import transforms3d.quaternions as txq
import argparse
import cv2
import matplotlib.pyplot as plt
try:
from thirdparty.mano.webuser.smpl_handpca_wrapper_HAND_... | ContactPose-main | utilities/misc.py |
# Copyright (c) Facebook, Inc. and its affiliates.
# Code by Samarth Brahmbhatt
from utilities.import_open3d import *
from open3d import pipelines
import utilities.misc as mutils
assert(mutils.load_mano_model is not None)
import numpy as np
import chumpy as ch
import os
import json
import transforms3d.quaternions as t... | ContactPose-main | utilities/mano_fitting.py |
# Copyright (c) Facebook, Inc. and its affiliates.
# Code by Samarth Brahmbhatt
import sys
sys.path.append('.') | ContactPose-main | utilities/init_paths.py |
# Copyright (c) Facebook, Inc. and its affiliates.
# Code by Samarth Brahmbhatt
import os
os.environ["PYOPENGL_PLATFORM"] = "osmesa"
import trimesh
import pyrender
import numpy as np
import transforms3d.euler as txe
import utilities.misc as mutils
import cv2
osp = os.path
class DepthRenderer(object):
"""
Renders... | ContactPose-main | utilities/rendering.py |
# Copyright (c) Facebook, Inc. and its affiliates.
# Code by Samarth Brahmbhatt
from open3d import io as o3dio
from open3d import visualization as o3dv
from open3d import utility as o3du
from open3d import geometry as o3dg | ContactPose-main | utilities/import_open3d.py |
# Copyright (c) Facebook, Inc. and its affiliates.
# Code by Samarth Brahmbhatt | ContactPose-main | utilities/__init__.py |
# Copyright (c) Facebook, Inc. and its affiliates.
# Code by Samarth Brahmbhatt
"""
ContactPose dataset loading utilities
"""
import os
import json
import numpy as np
import pickle
from . import misc as mutils
osp = os.path
def get_object_names(p_num, intent, ignore_hp=True):
"""
returns list of objects grasped... | ContactPose-main | utilities/dataset.py |
import datetime
try:
import dropbox
DROPBOX_FOUND = True
except ImportError:
DROPBOX_FOUND = False
import json
import math
import os
import random
import requests
from requests.exceptions import ConnectionError
import time
from tqdm.autonotebook import tqdm
osp = os.path
if DROPBOX_FOUND:
dropbox_app_key = os.... | ContactPose-main | utilities/networking.py |
# Copyright (c) Facebook, Inc. and its affiliates.
# Code by Samarth Brahmbhatt
import sys
sys.path.append('.') | ContactPose-main | scripts/init_paths.py |
# Copyright (c) Facebook, Inc. and its affiliates.
# Code by Samarth Brahmbhatt
import matplotlib.pyplot as plt
import numpy as np
import init_paths
from utilities.import_open3d import *
from utilities.dataset import ContactPose
import utilities.misc as mutils
def apply_colormap_to_mesh(mesh, sigmoid_a=0.05, invert=... | ContactPose-main | scripts/show_contactmap.py |
# Copyright (c) Facebook, Inc. and its affiliates.
# Code by Samarth Brahmbhatt
"""
Preprocesses images for ML training by cropping (RGB and depth), and
randomizing background (RGB only)
NOTE: Requites rendering setup, see docs/rendering.py
"""
import init_paths
from utilities.dataset import ContactPose, get_object_na... | ContactPose-main | scripts/preprocess_images.py |
# Copyright (c) Facebook, Inc. and its affiliates.
# Code by Samarth Brahmbhatt | ContactPose-main | scripts/__init__.py |
# Copyright (c) Facebook, Inc. and its affiliates.
# Code by Samarth Brahmbhatt
"""
script to download ContactPose data from Dropbox
URLs in data/urls.json
"""
import init_paths
import cv2
import os
import json
import shutil
from tqdm.autonotebook import tqdm
import utilities.networking as nutils
from zipfile import Zi... | ContactPose-main | scripts/download_data.py |
# Copyright (c) Facebook, Inc. and its affiliates.
# Code by Samarth Brahmbhatt
"""
Discovers 'active areas' i.e. areas on the object surface most frequently
touched by a certain part of the hand. See Figure 7 in the paper
https://arxiv.org/pdf/2007.09545.pdf.
"""
import init_paths
from utilities.import_open3d impo... | ContactPose-main | scripts/data_analysis/active_areas.py |
# Copyright (c) Facebook, Inc. and its affiliates.
# Code by Samarth Brahmbhatt
import sys
sys.path.append('.') | ContactPose-main | scripts/data_analysis/init_paths.py |
# Copyright (c) Facebook, Inc. and its affiliates.
# Code by Samarth Brahmbhatt
"""
Calculates and shows the contact probability for hand points
Figure 5(a) in the paper
"""
import os
import matplotlib.pyplot as plt
import numpy as np
import init_paths
from utilities.import_open3d import *
from utilities.dataset impor... | ContactPose-main | scripts/data_analysis/hand_contact_prob.py |
ContactPose-main | scripts/data_analysis/__init__.py | |
# Copyright (c) Facebook, Inc. and its affiliates.
# Code by Samarth Brahmbhatt
import init_paths
import dropbox
import json
from requests.exceptions import ConnectionError
import os
from utilities.dataset import get_object_names
osp = os.path
dbx = dropbox.Dropbox(os.environ['DROPBOX_APP_KEY'])
def move(p_num, inten... | ContactPose-main | scripts/maintenance/move_videos_dropbox.py |
# Copyright (c) Facebook, Inc. and its affiliates.
# Code by Samarth Brahmbhatt
import sys
sys.path.append('.') | ContactPose-main | scripts/maintenance/init_paths.py |
# Copyright (c) Facebook, Inc. and its affiliates.
# Code by Samarth Brahmbhatt
import requests
import json
from copy import deepcopy
import os
osp = os.path
data_template = {
'path': '/contactpose/videos_full/{:s}/{:s}/color',
'settings': {
'requested_visibility': 'public',
'audience': 'public',
'acc... | ContactPose-main | scripts/maintenance/get_urls.py |
# Copyright (c) Facebook, Inc. and its affiliates.
# Code by Samarth Brahmbhatt
import os
import shutil
import sys
osp = os.path
def remove(p_num):
for ins in ('use', 'handoff'):
p_id = 'full{:s}_{:s}'.format(p_num, ins)
sess_dir = osp.join('..', '..', 'data', 'contactpose_data', p_id)
for object_name ... | ContactPose-main | scripts/maintenance/remove_videos.py |
# Copyright (c) Facebook, Inc. and its affiliates.
# Code by Samarth Brahmbhatt
| ContactPose-main | scripts/maintenance/__init__.py |
# Copyright (c) Facebook, Inc. and its affiliates.
# Code by Samarth Brahmbhatt
import init_paths
from scripts.download_data import ContactPoseDownloader
import ffmpeg
import os
import shutil
import json
import itertools
from multiprocessing import Pool
import argparse
from functools import partial
import utilities.ne... | ContactPose-main | scripts/maintenance/produce_videos.py |
# Copyright (c) Facebook, Inc. and its affiliates.
# Code by Samarth Brahmbhatt | ContactPose-main | thirdparty/__init__.py |
#!/usr/bin/env python3
"""
Copyright (c) Meta Platforms, Inc. and affiliates.
Calculate cumulative distribution functions for standard Brownian motions.
Running as a script tests assertions that closed-form, analytical expressions
for the means match numerical evaluations of the means for the cumulative
distribution... | cdeets-main | codes/dists.py |
#!/usr/bin/env python3
"""
Copyright (c) Meta Platforms, Inc. and affiliates.
Plot the subpopulation deviations for the American Community Survey of USCB.
This script creates a directory, "weighted," in the working directory if the
directory does not already exist, then creates subdirectories there for each
of the c... | cdeets-main | codes/acs.py |
#!/usr/bin/env python3
"""
Copyright (c) Meta Platforms, Inc. and affiliates.
Plots of deviation of a subpop. from the full pop., with weighted sampling
*
This implementation considers responses r that can take arbitrary values,
not necesssarily restricted to taking values 0 or 1.
*
Functions
---------
cumulative
... | cdeets-main | codes/subpop_weighted.py |
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved
#Common imports
import sys
import os
import argparse
import random
import copy
import torch
import torch.utils.data as data_utils
from torch import nn, optim
from torch.nn import functional as F
from torchvision import datasets, transforms
from to... | CausalRepID-main | test.py |
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved
#Common imports
import sys
import os
import argparse
import random
import copy
import torch
from torch import nn, optim
from torch.nn import functional as F
from torchvision import datasets, transforms
from torchvision.utils import save_image
from... | CausalRepID-main | train.py |
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved
import os
import sys
import math
import torch
import torch.utils.data as data_utils
from torch import nn, optim
from torch.nn import functional as F
from torchvision import datasets, transforms
from torchvision.utils import save_image
from torch.a... | CausalRepID-main | algorithms/poly_auto_encoder.py |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.