repo
stringlengths
1
99
file
stringlengths
13
215
code
stringlengths
12
59.2M
file_length
int64
12
59.2M
avg_line_length
float64
3.82
1.48M
max_line_length
int64
12
2.51M
extension_type
stringclasses
1 value
relative-entropy
relative-entropy-main/chemtrain/neural_networks.py
"""Neural network models for potential energy and molecular property prediction. """ from functools import partial from typing import Callable, Dict, Any, Tuple import haiku as hk from jax import numpy as jnp, nn as jax_nn from jax_md import smap, space, partition, nn, util from chemtrain import layers, sparse_graph...
14,117
48.191638
80
py
relative-entropy
relative-entropy-main/chemtrain/reweighting.py
"""Implementation of the reweighting formalism. Allows re-using existing trajectories. p(S) = ... """ from abc import abstractmethod import time import warnings from jax import (checkpoint, lax, jit, random, grad, tree_util, vmap, numpy as jnp) from jax_md import util as jax_md_util from chemtrain i...
17,923
44.492386
80
py
relative-entropy
relative-entropy-main/chemtrain/trainers.py
"""This file contains several Trainer classes as a quickstart for users.""" from jax import numpy as jnp from jax_sgmc import data from jax_sgmc.data import numpy_loader from chemtrain import (util, force_matching, reweighting, max_likelihood) class ForceMatching(max_likelihood.DataParallelTra...
12,808
50.441767
80
py
relative-entropy
relative-entropy-main/chemtrain/data_processing.py
"""Functions that facilitate common data processing operations for machine learning. """ import numpy as onp from jax import lax from jax.tree_util import tree_flatten from jax_sgmc.data import numpy_loader from chemtrain.jax_md_mod import custom_space from chemtrain import util def get_dataset(data_location_str, re...
5,020
36.470149
80
py
relative-entropy
relative-entropy-main/chemtrain/layers.py
# Copyright 2022 Multiscale Modeling of Fluid Materials, TU Munich # # 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 appl...
20,944
40.55754
80
py
relative-entropy
relative-entropy-main/chemtrain/dropout.py
"""Customn function for enabling dropout applications in haiku.""" from functools import wraps import haiku as hk from jax import random, vmap, numpy as jnp # Note: This implementation currently stores the RNG key as float32 # rather than uint32. This way, both energy_params and the RNG key # can be treated analog...
8,399
38.810427
80
py
relative-entropy
relative-entropy-main/chemtrain/force_matching.py
"""Functions for learning via direct matching of per-snapshot quantities, such as energy, forces and virial pressure. """ from collections import namedtuple from jax import vmap, value_and_grad, numpy as jnp from chemtrain import max_likelihood from chemtrain.jax_md_mod import custom_quantity # Note: # Computing th...
6,673
38.258824
80
py
relative-entropy
relative-entropy-main/chemtrain/traj_util.py
"""Utility functions to process whole MD trajectories rather than single snapshots. """ from functools import partial from typing import Any, Dict import chex from jax import lax, jit, vmap, numpy as jnp from jax_md import simulate, util as jax_md_util from chemtrain import util from chemtrain.jax_md_mod import custo...
13,097
39.93125
80
py
relative-entropy
relative-entropy-main/chemtrain/util.py
"""Utility functions helpful in designing new trainers.""" import abc from functools import partial import pathlib from typing import Any import chex import cloudpickle as pickle from jax import tree_map, device_count, numpy as jnp from jax.tree_util import tree_flatten, tree_leaves from jax_md import simulate import ...
9,189
32.663004
79
py
relative-entropy
relative-entropy-main/chemtrain/traj_quantity.py
"""Molecular dynamics observable functions acting on trajectories rather than single snapshots. Builds on the TrajectoryState object defined in traj_util.py. """ from jax import numpy as jnp def init_traj_mean_fn(quantity_key): """Initializes the 'traj_fn' for the DiffTRe 'target' dict for simple trajectory-...
1,558
40.026316
78
py
relative-entropy
relative-entropy-main/chemtrain/max_likelihood.py
"""A collection of functions to facilitate learning maximum likelihood / single point estimate models. """ import abc import copy from functools import partial import time from jax import (lax, jit, vmap, pmap, value_and_grad, tree_map, device_count, numpy as jnp) from jax_sgmc import data import nu...
27,573
41.81677
80
py
relative-entropy
relative-entropy-main/chemtrain/jax_md_mod/custom_interpolate.py
import jax.numpy as jnp from jax.tree_util import register_pytree_node_class @register_pytree_node_class class MonotonicInterpolate: """ Piecewise cubic, monotonic interpolation via Steffens method [1]. The interpolation curve is monotonic within each interval such that extrema can only occur at grid ...
19,047
36.718812
110
py
relative-entropy
relative-entropy-main/chemtrain/jax_md_mod/custom_energy.py
"""Custom definition of some potential energy functions.""" from functools import partial from typing import Callable, Any from jax import vmap import jax.numpy as jnp from jax_md import space, partition, util, energy, smap from chemtrain.jax_md_mod import custom_interpolate, custom_quantity from chemtrain import spa...
10,505
33.559211
101
py
relative-entropy
relative-entropy-main/chemtrain/jax_md_mod/custom_space.py
"""Custom functions simplifying the handling of fractional coordinates.""" from typing import Union, Tuple, Callable from jax_md import space, util import jax.numpy as jnp Box = Union[float, util.Array] def _rectangular_boxtensor(box: Box) -> Box: """Transforms a 1-dimensional box to a 2D box tensor.""" spa...
1,155
32.028571
78
py
relative-entropy
relative-entropy-main/chemtrain/jax_md_mod/io.py
"""Functions for io: Loading data to and from Jax M.D.""" import jax.numpy as jnp import mdtraj import numpy as onp def load_box(filename): """Loads initial configuration using the file loader from MDTraj. Args: filename: String providing the location of the file to load. Returns: Tuple ...
866
27.9
70
py
relative-entropy
relative-entropy-main/chemtrain/jax_md_mod/custom_quantity.py
"""A collection of functions evaluating quantiities of trajectories. For easiest integration into chemtain, functions should be compatible with traj_util.quantity_traj. Functions provided to quantity_traj need to take the state and additional kwargs. """ from functools import partial from jax import grad, vmap, lax, n...
28,968
41.538913
80
py
relative-entropy
relative-entropy-main/util/Postprocessing.py
import jax.numpy as jnp from jax import lax import pickle from matplotlib import pyplot as plt from functools import partial def box_density(R_snapshot, bin_edges, axis=0): # assumes all particles are wrapped into the same box profile, _ = jnp.histogram(R_snapshot[:, axis], bins=bin_edges) # norm via n_b...
4,851
37.507937
80
py
relative-entropy
relative-entropy-main/util/Initialization.py
"""A collection of functions to initialize Jax, M.D. simulations.""" from functools import partial import chex import haiku as hk from jax import random, vmap, numpy as jnp from jax_md import util, simulate, partition, space, energy import numpy as onp from scipy import interpolate as sci_interpolate from chemtrain i...
22,831
41.998117
80
py
ngp_pl
ngp_pl-master/losses.py
import torch from torch import nn import vren class DistortionLoss(torch.autograd.Function): """ Distortion loss proposed in Mip-NeRF 360 (https://arxiv.org/pdf/2111.12077.pdf) Implementation is based on DVGO-v2 (https://arxiv.org/pdf/2206.05085.pdf) Inputs: ws: (N) sample point weights ...
2,112
33.639344
83
py
ngp_pl
ngp_pl-master/utils.py
import torch def extract_model_state_dict(ckpt_path, model_name='model', prefixes_to_ignore=[]): checkpoint = torch.load(ckpt_path, map_location='cpu') checkpoint_ = {} if 'state_dict' in checkpoint: # if it's a pytorch-lightning checkpoint checkpoint = checkpoint['state_dict'] for k, v in che...
1,353
32.85
85
py
ngp_pl
ngp_pl-master/show_gui.py
import torch from opt import get_opts import numpy as np from einops import rearrange import dearpygui.dearpygui as dpg from scipy.spatial.transform import Rotation as R import time from datasets import dataset_dict from datasets.ray_utils import get_ray_directions, get_rays from models.networks import NGP from models...
6,939
34.773196
93
py
ngp_pl
ngp_pl-master/metrics.py
import torch def mse(image_pred, image_gt, valid_mask=None, reduction='mean'): value = (image_pred-image_gt)**2 if valid_mask is not None: value = value[valid_mask] if reduction == 'mean': return torch.mean(value) return value @torch.no_grad() def psnr(image_pred, image_gt, valid_mas...
424
25.5625
76
py
ngp_pl
ngp_pl-master/train.py
import torch from torch import nn from opt import get_opts import os import glob import imageio import numpy as np import cv2 from einops import rearrange # data from torch.utils.data import DataLoader from datasets import dataset_dict from datasets.ray_utils import axisangle_to_R, get_rays # models from kornia.utils...
11,972
39.72449
116
py
ngp_pl
ngp_pl-master/models/networks.py
import torch from torch import nn import tinycudann as tcnn import vren from einops import rearrange from .custom_functions import TruncExp import numpy as np from .rendering import NEAR_DISTANCE class NGP(nn.Module): def __init__(self, scale, rgb_act='Sigmoid'): super().__init__() self.rgb_act ...
10,391
37.488889
103
py
ngp_pl
ngp_pl-master/models/custom_functions.py
import torch import vren from torch.cuda.amp import custom_fwd, custom_bwd from torch_scatter import segment_csr from einops import rearrange class RayAABBIntersector(torch.autograd.Function): """ Computes the intersections of rays and axis-aligned voxels. Inputs: rays_o: (N_rays, 3) ray origins ...
6,186
34.557471
83
py
ngp_pl
ngp_pl-master/models/rendering.py
import torch from .custom_functions import \ RayAABBIntersector, RayMarcher, VolumeRenderer from einops import rearrange import vren MAX_SAMPLES = 1024 NEAR_DISTANCE = 0.01 @torch.cuda.amp.autocast() def render(model, rays_o, rays_d, **kwargs): """ Render rays by 1. Compute the intersection of the ra...
6,192
36.762195
89
py
ngp_pl
ngp_pl-master/models/csrc/setup.py
import glob import os.path as osp from setuptools import setup from torch.utils.cpp_extension import CUDAExtension, BuildExtension ROOT_DIR = osp.dirname(osp.abspath(__file__)) include_dirs = [osp.join(ROOT_DIR, "include")] # "helper_math.h" is copied from https://github.com/NVIDIA/cuda-samples/blob/master/Common/hel...
893
26.090909
104
py
ngp_pl
ngp_pl-master/datasets/base.py
from torch.utils.data import Dataset import numpy as np class BaseDataset(Dataset): """ Define length and sampling method """ def __init__(self, root_dir, split='train', downsample=1.0): self.root_dir = root_dir self.split = split self.downsample = downsample def read_intr...
1,704
37.75
88
py
ngp_pl
ngp_pl-master/datasets/colmap.py
import torch import numpy as np import os import glob from tqdm import tqdm from .ray_utils import * from .color_utils import read_image from .colmap_utils import \ read_cameras_binary, read_images_binary, read_points3d_binary from .base import BaseDataset class ColmapDataset(BaseDataset): def __init__(self...
7,505
46.207547
97
py
ngp_pl
ngp_pl-master/datasets/nerf.py
import torch import json import numpy as np import os from tqdm import tqdm from .ray_utils import get_ray_directions from .color_utils import read_image from .base import BaseDataset class NeRFDataset(BaseDataset): def __init__(self, root_dir, split='train', downsample=1.0, **kwargs): super().__init__(...
3,180
33.956044
89
py
ngp_pl
ngp_pl-master/datasets/nsvf.py
import torch import glob import numpy as np import os from tqdm import tqdm from .ray_utils import get_ray_directions from .color_utils import read_image from .base import BaseDataset class NSVFDataset(BaseDataset): def __init__(self, root_dir, split='train', downsample=1.0, **kwargs): super().__init__(...
4,232
40.910891
93
py
ngp_pl
ngp_pl-master/datasets/ray_utils.py
import torch import numpy as np from kornia import create_meshgrid from einops import rearrange @torch.cuda.amp.autocast(dtype=torch.float32) def get_ray_directions(H, W, K, device='cpu', random=False, return_uv=False, flatten=True): """ Get ray directions for all pixels in camera coordinate [right down front...
7,289
32.906977
97
py
ngp_pl
ngp_pl-master/datasets/nerfpp.py
import torch import glob import numpy as np import os from PIL import Image from tqdm import tqdm from .ray_utils import get_ray_directions from .color_utils import read_image from .base import BaseDataset class NeRFPPDataset(BaseDataset): def __init__(self, root_dir, split='train', downsample=1.0, **kwargs): ...
2,341
38.033333
92
py
ngp_pl
ngp_pl-master/datasets/rtmv.py
import torch import glob import json import numpy as np import os from tqdm import tqdm from .ray_utils import get_ray_directions from .color_utils import read_image from .base import BaseDataset class RTMVDataset(BaseDataset): def __init__(self, root_dir, split='train', downsample=1.0, **kwargs): super...
2,582
35.380282
97
py
DeepSpeech
DeepSpeech-master/training/deepspeech_training/train.py
#!/usr/bin/env python # -*- coding: utf-8 -*- from __future__ import absolute_import, division, print_function import os import sys LOG_LEVEL_INDEX = sys.argv.index('--log_level') + 1 if '--log_level' in sys.argv else 0 DESIRED_LOG_LEVEL = sys.argv[LOG_LEVEL_INDEX] if 0 < LOG_LEVEL_INDEX < len(sys.argv) else '3' os.e...
46,010
43.369335
211
py
DeepSpeech
DeepSpeech-master/doc/conf.py
# -*- coding: utf-8 -*- # # DeepSpeech documentation build configuration file, created by # sphinx-quickstart on Thu Feb 2 21:20:39 2017. # # This file is execfile()d with the current directory set to its # containing dir. # # Note that not all possible configuration values are present in this # autogenerated file. # ...
6,579
30.333333
109
py
FGAHOI
FGAHOI-main/generate_vcoco_official.py
# ------------------------------------------------------------------------ # QAHOI # Copyright (c) 2021 Junwen Chen. All Rights Reserved. # Licensed under the Apache License, Version 2.0 [see LICENSE for details] # ------------------------------------------------------------------------ # Copyright (c) Hitachi, Ltd. Al...
19,612
46.146635
183
py
FGAHOI
FGAHOI-main/main.py
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved import argparse import datetime import json import random import time from pathlib import Path import os, sys from typing import Optional from util.logger import setup_logger import numpy as np import torch from torch.utils.data import DataLoa...
22,680
49.740492
184
py
FGAHOI
FGAHOI-main/engine.py
import math import os import sys from typing import Iterable import numpy as np import copy import itertools import torch import util.misc as utils from datasets.hico_eval import HICOEvaluator from datasets.vcoco_eval import VCOCOEvaluator from datasets.hake_eval import HAKEEvaluator from loguru import logger # fr...
7,080
44.683871
211
py
FGAHOI
FGAHOI-main/make_param.py
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved import argparse import datetime import json import random import time from pathlib import Path import os, sys from typing import Optional from util.logger import setup_logger import numpy as np import torch from torch.utils.data import DataLoa...
15,107
50.040541
155
py
FGAHOI
FGAHOI-main/coco_param.py
import argparse import torch from torch import nn def get_args(): parser = argparse.ArgumentParser() parser.add_argument( '--save_path', type=str, default="/mnt/gluster/home/mashuailei/DAB-DETR-main/dahoi/param/pretrained_357_coco_obj.pth", ) parser.add_argument( '--load_path', type=...
2,582
38.136364
128
py
FGAHOI
FGAHOI-main/models/dab_deformable_detr/test.py
import torch a = torch.rand([2,1]) b = torch.rand([2,1]) c = torch.max(a,b) print(a.shape)
93
10.75
21
py
FGAHOI
FGAHOI-main/models/dab_deformable_detr/swin_transformer.py
# ------------------------------------------------------------------------ # QAHOI # Copyright (c) 2021 Junwen Chen. All Rights Reserved. # Licensed under the Apache License, Version 2.0 [see LICENSE for details] # -------------------------------------------------------- # Modified from Swin Transformer (https://github...
29,754
38.202899
123
py
FGAHOI
FGAHOI-main/models/dab_deformable_detr/matcher.py
# ------------------------------------------------------------------------ # QAHOI # Copyright (c) 2021 Junwen Chen. All Rights Reserved. # Licensed under the Apache License, Version 2.0 [see LICENSE for details] # ------------------------------------------------------------------------ # Modified from QPIC (https://gi...
4,478
48.766667
121
py
FGAHOI
FGAHOI-main/models/dab_deformable_detr/segmentation.py
# ------------------------------------------------------------------------ # DAB-DETR # Copyright (c) 2022 IDEA. All Rights Reserved. # Licensed under the Apache License, Version 2.0 [see LICENSE for details] # ------------------------------------------------------------------------ # DModified from eformable DETR # Co...
16,148
42.179144
120
py
FGAHOI
FGAHOI-main/models/dab_deformable_detr/deformable_transformer.py
# ------------------------------------------------------------------------ # DAB-DETR # Copyright (c) 2022 IDEA. All Rights Reserved. # Licensed under the Apache License, Version 2.0 [see LICENSE for details] # ------------------------------------------------------------------------ # DModified from eformable DETR # Co...
27,364
47.093146
173
py
FGAHOI
FGAHOI-main/models/dab_deformable_detr/position_encoding.py
# ------------------------------------------------------------------------ # DAB-DETR # Copyright (c) 2022 IDEA. All Rights Reserved. # Licensed under the Apache License, Version 2.0 [see LICENSE for details] # ------------------------------------------------------------------------ # DModified from eformable DETR # Co...
4,011
38.333333
103
py
FGAHOI
FGAHOI-main/models/dab_deformable_detr/backbone.py
# ------------------------------------------------------------------------ # QAHOI # Copyright (c) 2021 Junwen Chen. All Rights Reserved. # Licensed under the Apache License, Version 2.0 [see LICENSE for details] # ------------------------------------------------------------------------ # Modified from Deformable DETR ...
6,974
42.867925
201
py
FGAHOI
FGAHOI-main/models/dab_deformable_detr/dab_deformable_detr.py
# ------------------------------------------------------------------------ # DAB-DETR # Copyright (c) 2022 IDEA. All Rights Reserved. # Licensed under the Apache License, Version 2.0 [see LICENSE for details] # ------------------------------------------------------------------------ # DModified from eformable DETR # Co...
38,148
48.224516
164
py
FGAHOI
FGAHOI-main/models/dab_deformable_detr/ops/test.py
# ------------------------------------------------------------------------------------------------ # Deformable DETR # Copyright (c) 2020 SenseTime. All Rights Reserved. # Licensed under the Apache License, Version 2.0 [see LICENSE for details] # -------------------------------------------------------------------------...
4,087
44.422222
172
py
FGAHOI
FGAHOI-main/models/dab_deformable_detr/ops/setup.py
# ------------------------------------------------------------------------------------------------ # Deformable DETR # Copyright (c) 2020 SenseTime. All Rights Reserved. # Licensed under the Apache License, Version 2.0 [see LICENSE for details] # -------------------------------------------------------------------------...
2,596
34.094595
98
py
FGAHOI
FGAHOI-main/models/dab_deformable_detr/ops/functions/ms_deform_attn_func.py
# ------------------------------------------------------------------------------------------------ # Deformable DETR # Copyright (c) 2020 SenseTime. All Rights Reserved. # Licensed under the Apache License, Version 2.0 [see LICENSE for details] # -------------------------------------------------------------------------...
3,298
52.209677
138
py
FGAHOI
FGAHOI-main/models/dab_deformable_detr/ops/functions/__init__.py
# ------------------------------------------------------------------------------------------------ # Deformable DETR # Copyright (c) 2020 SenseTime. All Rights Reserved. # Licensed under the Apache License, Version 2.0 [see LICENSE for details] # -------------------------------------------------------------------------...
598
53.454545
98
py
FGAHOI
FGAHOI-main/models/dab_deformable_detr/ops/modules/__init__.py
# ------------------------------------------------------------------------------------------------ # Deformable DETR # Copyright (c) 2020 SenseTime. All Rights Reserved. # Licensed under the Apache License, Version 2.0 [see LICENSE for details] # -------------------------------------------------------------------------...
584
57.5
98
py
FGAHOI
FGAHOI-main/models/dab_deformable_detr/ops/modules/attention.py
# ------------------------------------------------------------------------ # Modified from codes in torch.nn # ------------------------------------------------------------------------ # ------------------------------------------------------------------------ # Modified from Conditional DETR (https://github.com/Atten4Vi...
20,197
53.295699
120
py
FGAHOI
FGAHOI-main/models/dab_deformable_detr/ops/modules/ms_deform_attn.py
from __future__ import absolute_import from __future__ import print_function from __future__ import division import warnings import math import torch from torch import nn import torch.nn.functional as F from torch.nn.init import xavier_uniform_, constant_ import einops from ..functions import MSDeformAttnFunction im...
20,416
56.838527
156
py
FGAHOI
FGAHOI-main/models/DAB_DETR/DABDETR.py
# ------------------------------------------------------------------------ # DAB-DETR # Copyright (c) 2022 IDEA. All Rights Reserved. # Licensed under the Apache License, Version 2.0 [see LICENSE for details] # ------------------------------------------------------------------------ # Modified from Conditional DETR (ht...
23,292
44.494141
137
py
FGAHOI
FGAHOI-main/models/DAB_DETR/swin_transformer.py
# ------------------------------------------------------------------------ # DAB-DETR # Copyright (c) 2022 IDEA. All Rights Reserved. # Licensed under the Apache License, Version 2.0 [see LICENSE for details] # ------------------------------------------------------------------------ # Modified from Swin Transformer # C...
26,290
39.76124
119
py
FGAHOI
FGAHOI-main/models/DAB_DETR/matcher.py
# ------------------------------------------------------------------------ # DAB-DETR # Copyright (c) 2022 IDEA. All Rights Reserved. # Licensed under the Apache License, Version 2.0 [see LICENSE for details] # ------------------------------------------------------------------------ # Modified from Conditional DETR (ht...
5,105
51.102041
119
py
FGAHOI
FGAHOI-main/models/DAB_DETR/segmentation.py
# ------------------------------------------------------------------------ # DAB-DETR # Copyright (c) 2022 IDEA. All Rights Reserved. # Licensed under the Apache License, Version 2.0 [see LICENSE for details] # ------------------------------------------------------------------------ # Modified from Conditional DETR (ht...
16,281
42.303191
120
py
FGAHOI
FGAHOI-main/models/DAB_DETR/position_encoding.py
# ------------------------------------------------------------------------ # DAB-DETR # Copyright (c) 2022 IDEA. All Rights Reserved. # Licensed under the Apache License, Version 2.0 [see LICENSE for details] # ------------------------------------------------------------------------ # Modified from Conditional DETR (ht...
6,204
39.555556
110
py
FGAHOI
FGAHOI-main/models/DAB_DETR/backbone.py
# ------------------------------------------------------------------------ # DAB-DETR # Copyright (c) 2022 IDEA. All Rights Reserved. # Licensed under the Apache License, Version 2.0 [see LICENSE for details] # ------------------------------------------------------------------------ # Modified from Conditional DETR (ht...
5,971
39.080537
113
py
FGAHOI
FGAHOI-main/models/DAB_DETR/transformer.py
# ------------------------------------------------------------------------ # DAB-DETR # Copyright (c) 2022 IDEA. All Rights Reserved. # Licensed under the Apache License, Version 2.0 [see LICENSE for details] # ------------------------------------------------------------------------ # Modified from Conditional DETR (ht...
20,612
41.153374
145
py
FGAHOI
FGAHOI-main/models/DAB_DETR/attention.py
# ------------------------------------------------------------------------ # DAB-DETR # Copyright (c) 2022 IDEA. All Rights Reserved. # Licensed under the Apache License, Version 2.0 [see LICENSE for details] # ------------------------------------------------------------------------ # Modified from Conditional DETR (ht...
20,785
51.357683
130
py
FGAHOI
FGAHOI-main/util/plot_utils.py
""" Plotting utilities to visualize training logs. """ import torch import pandas as pd import numpy as np import seaborn as sns import matplotlib.pyplot as plt from pathlib import Path, PurePath def plot_logs(logs, fields=('class_error', 'loss_bbox_unscaled', 'mAP'), ewm_col=0, log_name='log.txt'): ''' Func...
4,658
40.230088
120
py
FGAHOI
FGAHOI-main/util/misc.py
# ------------------------------------------------------------------------ # QAHOI # Copyright (c) 2021 Junwen Chen. All Rights Reserved. # Licensed under the Apache License, Version 2.0 [see LICENSE for details] # ------------------------------------------------------------------------ # Modified from Deformable DETR ...
18,119
32.680297
113
py
FGAHOI
FGAHOI-main/util/utils.py
from collections import OrderedDict from copy import deepcopy import json import warnings import torch import numpy as np def slprint(x, name='x'): if isinstance(x, (torch.Tensor, np.ndarray)): print(f'{name}.shape:', x.shape) elif isinstance(x, (tuple, list)): print('type x:', type(x)) ...
13,342
32.441103
814
py
FGAHOI
FGAHOI-main/util/visualizer.py
# -*- coding: utf-8 -*- ''' @File : visualizer.py @Time : 2022/04/05 11:39:33 @Author : Shilong Liu @Contact : slongliu86@gmail.com ''' import os, sys from textwrap import wrap import torch import numpy as np import cv2 import datetime import matplotlib.pyplot as plt from matplotlib.collections import...
8,740
40.037559
139
py
FGAHOI
FGAHOI-main/util/get_param_dicts.py
import json import torch import torch.nn as nn def match_name_keywords(n: str, name_keywords: list): out = False for b in name_keywords: if b in n: out = True break return out def get_param_dict(args, model_without_ddp: nn.Module): try: param_dict_type = args....
3,315
38.47619
157
py
FGAHOI
FGAHOI-main/util/box_ops.py
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved """ Utilities for bounding box manipulation and GIoU. """ import torch, os from torchvision.ops.boxes import box_area import numpy as np from scipy.optimize import linear_sum_assignment def sort_with_idx(source,idx): n,_ = source.size() afte...
5,221
30.269461
141
py
FGAHOI
FGAHOI-main/util/box_loss.py
# borrow from https://github.com/Zzh-tju/CIoU/blob/master/layers/modules/multibox_loss.py import torch, math def ciou(bboxes1, bboxes2): bboxes1 = torch.sigmoid(bboxes1) bboxes2 = torch.sigmoid(bboxes2) rows = bboxes1.shape[0] cols = bboxes2.shape[0] cious = torch.zeros((rows, cols)) if rows...
3,884
33.380531
96
py
FGAHOI
FGAHOI-main/datasets/test.py
import torch import torch.nn.functional as F verb_labels = torch.tensor([0], dtype=torch.int64) verb_labels = F.one_hot(verb_labels, num_classes=117) list = ['a','b'] index = list.index('a') a = 0
198
21.111111
53
py
FGAHOI
FGAHOI-main/datasets/gen_npy.py
from pathlib import Path from PIL import Image import json from collections import defaultdict import numpy as np import copy import torch import torch.utils.data import torchvision import math import torch.nn.functional as F import os with open("/mnt/gluster/ssd/datasets/HAKE/proposed_challenge/dc_hoi_list.json", 'r'...
595
22.84
90
py
FGAHOI
FGAHOI-main/datasets/hico_eval.py
# ------------------------------------------------------------------------ # QAHOI # Copyright (c) 2021 Junwen Chen. All Rights Reserved. # Licensed under the Apache License, Version 2.0 [see LICENSE for details] # ------------------------------------------------------------------------ import numpy as np import os imp...
24,349
37.650794
143
py
FGAHOI
FGAHOI-main/datasets/hico.py
# ------------------------------------------------------------------------ # QAHOI # Copyright (c) 2021 Junwen Chen. All Rights Reserved. # Licensed under the Apache License, Version 2.0 [see LICENSE for details] # ------------------------------------------------------------------------ # Modified from QPIC (https://gi...
11,053
39.196364
125
py
FGAHOI
FGAHOI-main/datasets/__init__.py
# ------------------------------------------------------------------------ # QAHOI # Copyright (c) 2021 Junwen Chen. All Rights Reserved. # Licensed under the Apache License, Version 2.0 [see LICENSE for details] # ------------------------------------------------------------------------ # Modified from Deformable DETR ...
989
38.6
86
py
FGAHOI
FGAHOI-main/datasets/hake.py
""" HAKE detection dataset. """ from pathlib import Path from PIL import Image import json from collections import defaultdict import numpy as np import torch import torch.utils.data import torchvision import math import torch.nn.functional as F import datasets.transforms_hake as T import os def gaussian2D(shape, si...
9,548
40.517391
163
py
FGAHOI
FGAHOI-main/datasets/hake_eval.py
# ------------------------------------------------------------------------ # QAHOI # Copyright (c) 2021 Junwen Chen. All Rights Reserved. # Licensed under the Apache License, Version 2.0 [see LICENSE for details] # ------------------------------------------------------------------------ import numpy as np import os imp...
19,890
38.310277
159
py
FGAHOI
FGAHOI-main/datasets/vcoco.py
# ------------------------------------------------------------------------ # QAHOI # Copyright (c) 2021 Junwen Chen. All Rights Reserved. # Licensed under the Apache License, Version 2.0 [see LICENSE for details] # ------------------------------------------------------------------------ # Copyright (c) Hitachi, Ltd. Al...
8,044
41.342105
123
py
FGAHOI
FGAHOI-main/datasets/transforms_hake.py
# ------------------------------------------------------------------------ # QAHOI # Copyright (c) 2021 Junwen Chen. All Rights Reserved. # Licensed under the Apache License, Version 2.0 [see LICENSE for details] # ------------------------------------------------------------------------ # Modified from Deformable DETR ...
9,703
31.13245
104
py
FGAHOI
FGAHOI-main/datasets/transforms.py
# ------------------------------------------------------------------------ # QAHOI # Copyright (c) 2021 Junwen Chen. All Rights Reserved. # Licensed under the Apache License, Version 2.0 [see LICENSE for details] # ------------------------------------------------------------------------ # Modified from Deformable DETR ...
9,214
30.558219
104
py
differentiable-learning-under-triage
differentiable-learning-under-triage-main/Galaxy-zoo/prepare_data.py
import os import pandas as pd import numpy as np import skimage from skimage import io import csv from skimage.transform import rescale, resize, downscale_local_mean import torch import torch.nn as nn import copy # entire dataset size = 61577 ''' The dataset is downloaded from https://www.kaggle.com/c/galaxy-zoo-the-g...
5,062
28.436047
131
py
differentiable-learning-under-triage
differentiable-learning-under-triage-main/Synthetic/generate_synthetic.py
import pickle import sys import numpy as np import torch import os def save_data(data, file_path): with open(file_path + '.pkl','wb') as f: pickle.dump(data,f,pickle.HIGHEST_PROTOCOL) def load_data(file_name): assert(os.path.exists(file_name+'.pkl')) with open(file_name + '.pkl', 'rb') as ...
3,535
28.714286
129
py
differentiable-learning-under-triage
differentiable-learning-under-triage-main/Hatespeech/process_text_data.py
import numpy.random as rand import codecs import csv import random import numpy as np import numpy.linalg as LA import fasttext import copy import pickle5 as pickle import os import torch ''' The data can be downloaded from https://github.com/t-davidson/hate-speech-and-offensive-language. put the labeled_data.csv in t...
8,410
34.944444
195
py
craves.ai
craves.ai-master/train_arm.py
from __future__ import print_function, absolute_import import sys import os import argparse import time import matplotlib.pyplot as plt import scipy import json import numpy as np import cv2 import torch import torch.nn.parallel import torch.backends.cudnn as cudnn import torch.optim import torchvision.datasets as d...
21,397
41.710579
206
py
craves.ai
craves.ai-master/data_generation/load_data_and_vis.py
import sys sys.path.append('..') from unreal.arm import get_joint_2d import unreal.virtual_db as vdb import numpy as np import cv2 import torch import time import pose.datasets as datasets from pose.utils.imutils import * from pose.utils.transforms import multi_scale_merge from pose.utils.evaluation import * if __na...
1,046
25.175
122
py
craves.ai
craves.ai-master/pose/models/preresnet.py
'''Pre-activated Resnet for cifar dataset. Ported form https://github.com/facebook/fb.resnet.torch/blob/master/models/preresnet.lua (c) YANG, Wei ''' import torch.nn as nn import math import torch.utils.model_zoo as model_zoo __all__ = ['PreResNet', 'preresnet20', 'preresnet32', 'preresnet44', 'preresnet56', ...
5,650
29.38172
95
py
craves.ai
craves.ai-master/pose/models/hourglass.py
''' Hourglass network inserted in the pre-activated Resnet Use lr=0.01 for current version (c) YANG, Wei ''' import torch.nn as nn import torch.nn.functional as F # from .preresnet import BasicBlock, Bottleneck __all__ = ['HourglassNet', 'hg', 'hg_feat'] class Bottleneck(nn.Module): expansion = 2 def __i...
9,704
33.172535
107
py
craves.ai
craves.ai-master/pose/datasets/concat.py
import numpy as np import torch import torch.utils.data as data class Concat(data.Dataset): def __init__(self, datasets, ratio = None): self.datasets = datasets self.ratio = ratio if self.ratio is not None: self.ratio = self.ratio / np.sum(self.ratio) self.reset() ...
3,030
34.244186
128
py
craves.ai
craves.ai-master/pose/datasets/arm_realtime_loader.py
import numpy as np import torch import scipy from utils.transforms import crop, color_normalize def to_torch(ndarray): if type(ndarray).__module__ == 'numpy': return torch.from_numpy(ndarray) elif not torch.is_tensor(ndarray): raise ValueError("Cannot convert {} to torch tensor" ...
1,309
26.87234
126
py
craves.ai
craves.ai-master/pose/datasets/mpii.py
from __future__ import print_function, absolute_import import os import numpy as np import json import random import math import torch import torch.utils.data as data from pose.utils.osutils import * from pose.utils.imutils import * from pose.utils.transforms import * class Mpii(data.Dataset): def __init__(sel...
4,650
34.234848
110
py
craves.ai
craves.ai-master/pose/datasets/arm.py
from __future__ import print_function, absolute_import import os import numpy as np import json import random import math import cv2 import torch import torch.utils.data as data import imageio as io import json from pose.utils.osutils import * from pose.utils.imutils import * from pose.utils.transforms import * from...
11,865
37.904918
157
py
craves.ai
craves.ai-master/pose/datasets/arm_resnet.py
from __future__ import print_function, absolute_import import os import numpy as np import json import random import math import cv2 import torch import torch.utils.data as data import imageio as io import json from pose.utils.osutils import * from pose.utils.imutils import * from pose.utils.transforms import * imp...
4,105
31.330709
126
py
craves.ai
craves.ai-master/pose/datasets/lsp.py
from __future__ import print_function, absolute_import import os import numpy as np import json import random import math import torch import torch.utils.data as data from pose.utils.osutils import * from pose.utils.imutils import * from pose.utils.transforms import * class LSP(data.Dataset): """ LSP exten...
4,969
34.755396
115
py
craves.ai
craves.ai-master/pose/datasets/mscoco.py
from __future__ import print_function, absolute_import import os import numpy as np import json import random import math import torch import torch.utils.data as data from pose.utils.osutils import * from pose.utils.imutils import * from pose.utils.transforms import * class Mscoco(data.Dataset): def __init__(s...
4,816
34.947761
110
py
craves.ai
craves.ai-master/pose/utils/misc.py
from __future__ import absolute_import import os import shutil import torch import math import numpy as np import scipy.io import matplotlib.pyplot as plt def to_numpy(tensor): if torch.is_tensor(tensor): return tensor.cpu().numpy() elif type(tensor).__module__ != 'numpy': raise ValueError("C...
1,899
28.6875
107
py
craves.ai
craves.ai-master/pose/utils/logger.py
# A simple torch style logger # (C) Wei YANG 2017 from __future__ import absolute_import import os import sys import numpy as np import matplotlib.pyplot as plt __all__ = ['Logger', 'LoggerMonitor', 'savefig'] def savefig(fname, dpi=None): dpi = 150 if dpi == None else dpi plt.savefig(fname, dpi=dpi) de...
4,399
33.375
100
py
craves.ai
craves.ai-master/pose/utils/imutils.py
from __future__ import absolute_import import torch import torch.nn as nn import numpy as np import scipy.misc import cv2 import os import json import time from .misc import * def im_to_numpy(img): img = to_numpy(img) img = np.transpose(img, (1, 2, 0)) # H*W*C return img def im_to_torch(img): img =...
8,327
31.15444
108
py
craves.ai
craves.ai-master/pose/utils/evaluation.py
from __future__ import absolute_import import math import numpy as np import matplotlib.pyplot as plt from random import randint import torch from .misc import * from .transforms import transform, transform_preds __all__ = ['accuracy', 'AverageMeter'] def get_preds(scores): ''' get predictions from score maps i...
4,865
28.313253
114
py
craves.ai
craves.ai-master/pose/utils/transforms.py
from __future__ import absolute_import import os import numpy as np import scipy.misc import matplotlib.pyplot as plt import torch import cv2 import json import time from .misc import * from .imutils import * def color_normalize(x, mean, std): if x.size(0) == 1: x = x.repeat(3, 1, 1) for t, m, s in...
8,363
28.347368
145
py