repo stringlengths 3 91 | file stringlengths 16 152 | code stringlengths 0 3.77M | file_length int64 0 3.77M | avg_line_length float64 0 16k | max_line_length int64 0 273k | extension_type stringclasses 1
value |
|---|---|---|---|---|---|---|
RGB-N | RGB-N-master/lib/compact_bilinear_pooling/compact_bilinear_pooling_test.py | from __future__ import absolute_import, division, print_function
import numpy as np
import tensorflow as tf
from compact_bilinear_pooling import compact_bilinear_pooling_layer
def bp(bottom1, bottom2, sum_pool=True):
assert(np.all(bottom1.shape[:3] == bottom2.shape[:3]))
batch_size, height, width = bottom1.sh... | 3,295 | 34.44086 | 84 | py |
RGB-N | RGB-N-master/lib/compact_bilinear_pooling/__init__.py | # --------------------------------------------------------
# Fast R-CNN
# Copyright (c) 2015 Microsoft
# Licensed under The MIT License [see LICENSE for details]
# Written by Ross Girshick
# --------------------------------------------------------
| 248 | 34.571429 | 58 | py |
RGB-N | RGB-N-master/lib/compact_bilinear_pooling/sequential_fft/sequential_batch_fft_test.py | from __future__ import absolute_import, division, print_function
import tensorflow as tf
import numpy as np
from sequential_batch_fft_ops import sequential_batch_fft, sequential_batch_ifft
compute_size = 128
x = tf.placeholder(tf.complex64, [None, None])
x_128 = tf.placeholder(tf.complex128, [None, None])
# FFT
x_f... | 5,280 | 38.706767 | 99 | py |
RGB-N | RGB-N-master/lib/compact_bilinear_pooling/sequential_fft/sequential_batch_fft_ops.py | from __future__ import absolute_import, division, print_function
import os.path as osp
import tensorflow as tf
from tensorflow.python.framework import ops
# load module
module = tf.load_op_library(osp.join(osp.dirname(__file__),
'build/sequential_batch_fft.so'))
sequential_batch... | 1,700 | 36.8 | 77 | py |
RGB-N | RGB-N-master/lib/compact_bilinear_pooling/sequential_fft/__init__.py | from .sequential_batch_fft_ops import sequential_batch_fft, sequential_batch_ifft
| 82 | 40.5 | 81 | py |
RGB-N | RGB-N-master/lib/datasets/voc_eval.py | # --------------------------------------------------------
# Fast/er R-CNN
# Licensed under The MIT License [see LICENSE for details]
# Written by Peng Zhou
# --------------------------------------------------------
from __future__ import absolute_import
from __future__ import division
from __future__ import print_func... | 13,267 | 34.100529 | 173 | py |
RGB-N | RGB-N-master/lib/datasets/dist_fake.py | # --------------------------------------------------------
# Fast R-CNN
# Copyright (c) 2015 Microsoft
# Licensed under The MIT License [see LICENSE for details]
# Written by Peng Zhou
# --------------------------------------------------------
from __future__ import absolute_import
from __future__ import division
from ... | 13,392 | 34.619681 | 104 | py |
RGB-N | RGB-N-master/lib/datasets/pascal_voc.py | # --------------------------------------------------------
# Fast R-CNN
# Copyright (c) 2015 Microsoft
# Licensed under The MIT License [see LICENSE for details]
# Written by Ross Girshick and Peng Zhou
# --------------------------------------------------------
from __future__ import absolute_import
from __future__ imp... | 11,180 | 35.301948 | 85 | py |
RGB-N | RGB-N-master/lib/datasets/imdb.py | # --------------------------------------------------------
# Fast R-CNN
# Copyright (c) 2015 Microsoft
# Licensed under The MIT License [see LICENSE for details]
# Written by Peng Zhou
# --------------------------------------------------------
from __future__ import absolute_import
from __future__ import division
from ... | 10,309 | 33.481605 | 74 | py |
RGB-N | RGB-N-master/lib/datasets/factory.py | # --------------------------------------------------------
# Tensorflow RGB-N
# Licensed under The MIT License [see LICENSE for details]
# Written by Peng Zhou
# --------------------------------------------------------
"""Factory method for easily getting imdbs by name."""
from __future__ import absolute_import
from _... | 2,928 | 34.719512 | 83 | py |
RGB-N | RGB-N-master/lib/datasets/casia.py | # --------------------------------------------------------
# Fast R-CNN
# Copyright (c) 2015 Microsoft
# Licensed under The MIT License [see LICENSE for details]
# Written by Peng Zhou
# --------------------------------------------------------
from __future__ import absolute_import
from __future__ import division
from ... | 13,348 | 34.597333 | 105 | py |
RGB-N | RGB-N-master/lib/datasets/swapme.py | # --------------------------------------------------------
# Tensorflow RGB-N
# Licensed under The MIT License [see LICENSE for details]
# Written by Peng Zhou
# --------------------------------------------------------
from __future__ import absolute_import
from __future__ import division
from __future__ import print_f... | 13,342 | 35.062162 | 104 | py |
RGB-N | RGB-N-master/lib/datasets/ds_utils.py | # --------------------------------------------------------
# Fast/er R-CNN
# Licensed under The MIT License [see LICENSE for details]
# Written by Ross Girshick
# --------------------------------------------------------
from __future__ import absolute_import
from __future__ import division
from __future__ import print_... | 1,402 | 27.06 | 70 | py |
RGB-N | RGB-N-master/lib/datasets/__init__.py | # --------------------------------------------------------
# Fast R-CNN
# Copyright (c) 2015 Microsoft
# Licensed under The MIT License [see LICENSE for details]
# Written by Ross Girshick
# --------------------------------------------------------
| 248 | 34.571429 | 58 | py |
RGB-N | RGB-N-master/lib/datasets/coco.py | # --------------------------------------------------------
# Tensorflow RGB-N
# Licensed under The MIT License [see LICENSE for details]
# Written by Peng Zhou, based on the code of Xinlei Chen
# --------------------------------------------------------
from __future__ import absolute_import
from __future__ import divis... | 13,334 | 34.65508 | 104 | py |
RGB-N | RGB-N-master/lib/datasets/nist.py | # --------------------------------------------------------
# Tensorflow RGB-N
# Licensed under The MIT License [see LICENSE for details]
# Written by Peng Zhou
# --------------------------------------------------------
from __future__ import absolute_import
from __future__ import division
from __future__ import print_f... | 13,431 | 34.818667 | 104 | py |
RGB-N | RGB-N-master/lib/datasets/dvmm.py | # --------------------------------------------------------
# Fast R-CNN
# Copyright (c) 2015 Microsoft
# Licensed under The MIT License [see LICENSE for details]
# Written by Peng Zhou
# --------------------------------------------------------
from __future__ import absolute_import
from __future__ import division
from ... | 13,318 | 34.612299 | 104 | py |
RGB-N | RGB-N-master/lib/datasets/tools/mcg_munge.py | import os
import sys
"""Hacky tool to convert file system layout of MCG boxes downloaded from
http://www.eecs.berkeley.edu/Research/Projects/CS/vision/grouping/mcg/
so that it's consistent with those computed by Jan Hosang (see:
http://www.mpi-inf.mpg.de/departments/computer-vision-and-multimodal-
computing/research... | 1,451 | 36.230769 | 94 | py |
RGB-N | RGB-N-master/lib/layer_utils/proposal_layer.py | # --------------------------------------------------------
# Faster R-CNN
# Licensed under The MIT License [see LICENSE for details]
# Written by Ross Girshick and Xinlei Chen
# --------------------------------------------------------
from __future__ import absolute_import
from __future__ import division
from __future_... | 1,850 | 32.654545 | 102 | py |
RGB-N | RGB-N-master/lib/layer_utils/proposal_top_layer.py | # --------------------------------------------------------
# Faster R-CNN
# Licensed under The MIT License [see LICENSE for details]
# Written by Xinlei Chen
# --------------------------------------------------------
from __future__ import absolute_import
from __future__ import division
from __future__ import print_fun... | 1,868 | 32.981818 | 97 | py |
RGB-N | RGB-N-master/lib/layer_utils/generate_anchors.py | # --------------------------------------------------------
# Faster R-CNN
# Copyright (c) 2015 Microsoft
# Licensed under The MIT License [see LICENSE for details]
# Written by Ross Girshick and Sean Bell
# --------------------------------------------------------
from __future__ import absolute_import
from __future__ i... | 3,129 | 25.525424 | 78 | py |
RGB-N | RGB-N-master/lib/layer_utils/proposal_target_layer.py | # --------------------------------------------------------
# Faster R-CNN
# Copyright (c) 2015 Microsoft
# Licensed under The MIT License [see LICENSE for details]
# Written by Ross Girshick, Sean Bell and Xinlei Chen
# --------------------------------------------------------
from __future__ import absolute_import
from... | 6,081 | 37.987179 | 100 | py |
RGB-N | RGB-N-master/lib/layer_utils/snippets.py | # --------------------------------------------------------
# Tensorflow Faster R-CNN
# Licensed under The MIT License [see LICENSE for details]
# Written by Xinlei Chen
# --------------------------------------------------------
from __future__ import absolute_import
from __future__ import division
from __future__ impor... | 1,473 | 42.352941 | 103 | py |
RGB-N | RGB-N-master/lib/layer_utils/anchor_target_layer.py | # --------------------------------------------------------
# Faster R-CNN
# Copyright (c) 2015 Microsoft
# Licensed under The MIT License [see LICENSE for details]
# Written by Ross Girshick and Xinlei Chen
# --------------------------------------------------------
from __future__ import absolute_import
from __future__... | 6,031 | 35.780488 | 98 | py |
RGB-N | RGB-N-master/lib/layer_utils/__init__.py | 0 | 0 | 0 | py | |
RGB-N | RGB-N-master/lib/utils/nms.py | # --------------------------------------------------------
# Fast R-CNN
# Copyright (c) 2015 Microsoft
# Licensed under The MIT License [see LICENSE for details]
# Written by Ross Girshick
# --------------------------------------------------------
import numpy as np
def nms(dets, thresh):
x1 = dets[:, 0]
y1 =... | 1,008 | 25.552632 | 59 | py |
RGB-N | RGB-N-master/lib/utils/timer.py | # --------------------------------------------------------
# Fast R-CNN
# Copyright (c) 2015 Microsoft
# Licensed under The MIT License [see LICENSE for details]
# Written by Ross Girshick
# --------------------------------------------------------
import time
class Timer(object):
"""A simple timer."""
def __i... | 948 | 27.757576 | 71 | py |
RGB-N | RGB-N-master/lib/utils/boxes_grid.py | # --------------------------------------------------------
# Subcategory CNN
# Copyright (c) 2015 CVGL Stanford
# Licensed under The MIT License [see LICENSE for details]
# Written by Yu Xiang
# --------------------------------------------------------
from __future__ import absolute_import
from __future__ import divisi... | 2,599 | 34.135135 | 84 | py |
RGB-N | RGB-N-master/lib/utils/blob.py | # --------------------------------------------------------
# Fast R-CNN
# Copyright (c) 2015 Microsoft
# Licensed under The MIT License [see LICENSE for details]
# Written by Ross Girshick
# --------------------------------------------------------
"""Blob helper functions."""
from __future__ import absolute_import
fro... | 2,135 | 32.904762 | 73 | py |
RGB-N | RGB-N-master/lib/utils/__init__.py | # --------------------------------------------------------
# Fast R-CNN
# Copyright (c) 2015 Microsoft
# Licensed under The MIT License [see LICENSE for details]
# Written by Ross Girshick
# --------------------------------------------------------
| 248 | 34.571429 | 58 | py |
RGB-N | RGB-N-master/lib/model/test.py | # --------------------------------------------------------
# Tensorflow Faster R-CNN
# Licensed under The MIT License [see LICENSE for details]
# Written by Peng Zhou
# --------------------------------------------------------
from __future__ import absolute_import
from __future__ import division
from __future__ import ... | 7,355 | 32.589041 | 114 | py |
RGB-N | RGB-N-master/lib/model/bbox_transform.py | # --------------------------------------------------------
# Fast R-CNN
# Copyright (c) 2015 Microsoft
# Licensed under The MIT License [see LICENSE for details]
# Written by Ross Girshick
# --------------------------------------------------------
from __future__ import absolute_import
from __future__ import division
f... | 2,622 | 30.22619 | 77 | py |
RGB-N | RGB-N-master/lib/model/nms_wrapper.py | # --------------------------------------------------------
# Fast R-CNN
# Copyright (c) 2015 Microsoft
# Licensed under The MIT License [see LICENSE for details]
# Written by Ross Girshick
# --------------------------------------------------------
from __future__ import absolute_import
from __future__ import division
f... | 764 | 30.875 | 58 | py |
RGB-N | RGB-N-master/lib/model/config.py | from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import os
import os.path as osp
import numpy as np
# `pip install easydict` if you don't have it
from easydict import EasyDict as edict
__C = edict()
# Consumers can get config by:
# from fast_rcnn_config im... | 11,267 | 29.209115 | 91 | py |
RGB-N | RGB-N-master/lib/model/__init__.py | from . import config
| 21 | 10 | 20 | py |
RGB-N | RGB-N-master/lib/model/train_val.py | # --------------------------------------------------------
# Tensorflow RGB-N
# Licensed under The MIT License [see LICENSE for details]
# Written by Peng Zhou , based on code from Xinlei Chen
# --------------------------------------------------------
from __future__ import absolute_import
from __future__ import divisi... | 13,708 | 37.835694 | 119 | py |
RGB-N | RGB-N-master/lib/nms/py_cpu_nms.py | # --------------------------------------------------------
# Fast R-CNN
# Copyright (c) 2015 Microsoft
# Licensed under The MIT License [see LICENSE for details]
# Written by Ross Girshick
# --------------------------------------------------------
import numpy as np
def py_cpu_nms(dets, thresh):
"""Pure Python NM... | 1,051 | 25.974359 | 59 | py |
RGB-N | RGB-N-master/lib/nms/__init__.py | 0 | 0 | 0 | py | |
RGB-N | RGB-N-master/coco_synthetic/split_train_test.py | import networkx as nx
import numpy as np
import os
from glob import glob
import sys
import skimage.io as io
import pdb
def contain_node(Graph_list,node):
for g in Graph_list:
if g.has_node(node):
return True
return False
data_dir='../../dataset/filter_tamper' #FIXME
ext='Tp*'
dataDir='../../dataset' #FIXME
dat... | 2,551 | 33.486486 | 110 | py |
RGB-N | RGB-N-master/coco_synthetic/demo.py | from pycocotools.coco import COCO
import numpy as np
import cv2
import skimage.io as io
import matplotlib.pyplot as plt
import pylab
import os
from PIL import Image
from PIL import ImageFilter
import argparse
import sys
import pdb
def parse_args():
"""
Parse input arguments
"""
parser = argparse.ArgumentParser(... | 3,500 | 34.363636 | 185 | py |
SOCC | SOCC-master/scripts/socc_comment_profilling.py | import pandas as pd
import ast
import datetime
import numpy as np
"""
Note: This script file is specific designed for SOCC_DATA/raw/gnm_comment_threads.csv,
which can be find in "https://github.com/sfu-discourse-lab/SOCC"
"""
def posted_comments(df):
""" count the posted comments of each user
Args:
df: pandas dat... | 6,776 | 35.435484 | 139 | py |
SOCC | SOCC-master/scripts/clean_comments.py | import glob
import re
from smart_open import smart_open
# set the directory of your exported project
webanno_project = input("Path to exported WebAnno project: (e.g. 'C:/.../curation')")
write_directory = input("Path to folder to write new TSVs to: (e.g. 'C:/.../clean_TSVs')")
# note that if the folder you write to do... | 3,244 | 35.055556 | 119 | py |
SOCC | SOCC-master/scripts/rename_webanno.py | import glob
import os
import pandas as pd
# This script can be used to rename the Appraisal or Negation annotated files from their idiosyncratic names to those
# generated by the comment counter. You will need the unzipped, exported project directory, as well as a mapping of
# WebAnno to comment counter names. (The ma... | 4,125 | 38.673077 | 118 | py |
SOCC | SOCC-master/scripts/webanno_to_sentence.py | from smart_open import smart_open
import pandas as pd
import re
from io import StringIO
# find the comments
appraisal_comments_path = input('Path to combined Appraisal WebAnno formatted comments tsv'
'(e.g. C:\\...\\combined_appraisal_webanno.tsv): ')
negation_comments_path = input('Pat... | 43,711 | 54.261694 | 119 | py |
SOCC | SOCC-master/scripts/old_combine_comments.py | from glob import glob
import pandas as pd
import re
# where to find your cleaned TSVs:
appraisal_projectpath = input('Path to appraisal project folder: (e.g. C:/.../Appraisal/clean_TSVs)')
# where to write a new CSV
appraisal_writepath = input('Path to write a new appraisal CSV to: (e.g. C:/.../combined_appraisal_comm... | 42,165 | 50.992602 | 119 | py |
SOCC | SOCC-master/scripts/combine_webanno.py | # This script operates directly on the "annotation" folder output by exporting a WebAnno project
# for SOCC, this folder is SOCC\annotated\Appraisal\curation
# Each of \annotation's sub-folders contains a TSV that contains the annotations for the given comment.
# This script puts all of those TSVs into one long file, a... | 2,604 | 45.517857 | 127 | py |
SOCC | SOCC-master/scripts/webanno_to_span.py | from glob import glob
import pandas as pd
import re
# where to find your cleaned TSVs:
appraisal_projectpath = input('Path to appraisal project folder: (e.g. C:/.../Appraisal/clean_TSVs)')
# where to write a new CSV
appraisal_writepath = input('Path to write a new appraisal CSV to: (e.g. C:/.../combined_appraisal_comm... | 41,827 | 51.285 | 119 | py |
SOCC | SOCC-master/scripts/projects_to_tsv.py | from smart_open import smart_open
import pandas as pd
import re
from io import StringIO
# find the comments
appraisal_comments_path = input('Path to combined Appraisal WebAnno formatted comments tsv'
'(e.g. C:\\...\\combined_appraisal_webanno.tsv): ')
negation_comments_path = input('Pat... | 16,422 | 54.296296 | 120 | py |
robogym | robogym-master/setup.py | #!/usr/bin/env python3
from setuptools import find_packages, setup
def setup_robogym():
setup(
name="robogym",
version=open("ROBOGYM_VERSION").read(),
packages=find_packages(),
install_requires=[
# Fixed versions
"click==7.0",
"collision==1.2.2",... | 862 | 24.382353 | 59 | py |
robogym | robogym-master/robogym/robot_exception.py | """Module with custom exception code for robots."""
class RobotException(Exception):
"""Base class for custom exceptions relative to or raised by robots."""
pass
| 173 | 20.75 | 75 | py |
robogym | robogym-master/robogym/robot_env.py | import abc
import logging
import random
import time
from collections import OrderedDict
from copy import deepcopy
from typing import Any, Callable, Dict, Generic, List, Optional, Tuple, Type, TypeVar
import attr
import gym
import gym.spaces as spaces
import numpy as np
from robogym.goal.goal_generator import GoalGene... | 40,152 | 34.098776 | 115 | py |
robogym | robogym-master/robogym/mujoco/constants.py | from enum import Enum
OPT_FIELDS = {
"apirate",
"collision",
"cone",
"density",
"disableflags",
"enableflags",
"gravity",
"impedance",
"impratio",
"integrator",
"iterations",
"jacobian",
"magnetic",
"mpr_iterations",
"mpr_tolerance",
"noslip_iterations",
... | 1,292 | 19.854839 | 72 | py |
robogym | robogym-master/robogym/mujoco/simulation_interface.py | import itertools as it
from typing import Dict, List
import attr
from mujoco_py import MjSimState, cymj
from robogym.mujoco.helpers import (
joint_qpos_ids,
joint_qpos_ids_from_prefix,
joint_qvel_ids,
joint_qvel_ids_from_prefix,
)
from robogym.mujoco.mujoco_xml import MjSim
@attr.s(auto_attribs=True... | 8,178 | 31.585657 | 99 | py |
robogym | robogym-master/robogym/mujoco/mujoco_xml.py | import os.path
import typing
import xml.etree.ElementTree as et
import mujoco_py
import numpy as np
ASSETS_DIR = os.path.abspath(os.path.join(os.path.dirname(__file__), "../assets"))
XML_DIR = os.path.join(ASSETS_DIR, "xmls")
def _format_array(np_array, precision=6):
""" Format numpy array into a nice string su... | 12,646 | 32.635638 | 110 | py |
robogym | robogym-master/robogym/mujoco/warning_buffer.py | import collections
import logging
import mujoco_py.cymj as cymj
logger = logging.getLogger(__name__)
class MujocoErrorException(Exception):
""" Exception raised when mujoco error is called. """
pass
def error_callback(message):
""" Mujoco error callback """
message = message.decode()
full_mes... | 2,265 | 25.97619 | 86 | py |
robogym | robogym-master/robogym/mujoco/forward_kinematics.py | import xml.etree.ElementTree as et
from typing import Any, Dict, List, Optional, Tuple
import numpy as np
import robogym.utils.rotation as rot
from robogym.mujoco.mujoco_xml import MujocoXML
def homogeneous_matrix_from_pos_mat(pos, mat):
m = np.eye(4)
m[:3, :3] = mat
m[:3, 3] = pos
return m
def ge... | 9,205 | 35.387352 | 94 | py |
robogym | robogym-master/robogym/mujoco/helpers.py | import itertools
import typing
import mujoco_py
import mujoco_py.generated.const
def joint_qpos_ids(model, joint_name: str) -> typing.List[int]:
addr = model.get_joint_qpos_addr(joint_name)
if isinstance(addr, tuple):
return list(range(addr[0], addr[1]))
else:
return [addr]
def joint_qp... | 1,484 | 27.018868 | 65 | py |
robogym | robogym-master/robogym/mujoco/test/test_mujoco_utils.py | import random
import numpy as np
from mujoco_py import cymj, functions
from numpy.random.mtrand import _rand as global_randstate
from robogym.mujoco.forward_kinematics import ForwardKinematics
from robogym.mujoco.mujoco_xml import MujocoXML
from robogym.mujoco.simulation_interface import SimulationInterface
from robo... | 6,728 | 29.726027 | 86 | py |
robogym | robogym-master/robogym/mujoco/modifiers/base.py | class Modifier:
""" Base class for various MuJoCo modifiers """
def __init__(self):
self.sim = None
def initialize(self, sim):
self.sim = sim
def __call__(self, parameter_value):
""" Apply given parameter to the sim """
raise NotImplementedError
| 297 | 21.923077 | 51 | py |
robogym | robogym-master/robogym/mujoco/modifiers/timestep.py | from robogym.mujoco.modifiers.base import Modifier
class TimestepModifier(Modifier):
""" Modify simulation timestep """
def __call__(self, timestep):
self.sim.model.opt.timestep = timestep
| 208 | 22.222222 | 50 | py |
robogym | robogym-master/robogym/envs/dactyl/full_perpendicular.py | import functools
import typing
import attr
import numpy as np
import pycuber
import robogym.utils.rotation as rotation
from robogym.envs.dactyl.common.cube_env import (
CubeEnv,
CubeSimulationInterface,
DactylCubeEnvConstants,
DactylCubeEnvParameters,
)
from robogym.envs.dactyl.common.cube_manipulator... | 18,202 | 39.541203 | 99 | py |
robogym | robogym-master/robogym/envs/dactyl/reach.py | import functools
import typing
import attr
import numpy as np
from robogym.envs.dactyl.observation.reach import (
GoalFingertipPosObservation,
GoalIsAchievedObservation,
)
from robogym.envs.dactyl.observation.shadow_hand import (
MujocoShadowhandAbsoluteFingertipsObservation,
MujocoShadowHandJointPosO... | 8,954 | 32.920455 | 90 | py |
robogym | robogym-master/robogym/envs/dactyl/face_perpendicular.py | import functools
import logging
from typing import List
import attr
import numpy as np
import robogym.utils.rotation as rotation
from robogym.envs.dactyl.common.cube_env import (
CubeEnv,
CubeSimulationInterface,
DactylCubeEnvConstants,
DactylCubeEnvParameters,
)
from robogym.envs.dactyl.common.mujoco... | 19,795 | 39.154158 | 99 | py |
robogym | robogym-master/robogym/envs/dactyl/locked.py | import functools
import attr
import numpy as np
import robogym.utils.rotation as rotation
from robogym.envs.dactyl.common.cube_env import (
CubeEnv,
CubeSimulationInterface,
CubeSimulationParameters,
DactylCubeEnvConstants,
DactylCubeEnvParameters,
)
from robogym.envs.dactyl.common.mujoco_modifier... | 11,793 | 37.542484 | 99 | py |
robogym | robogym-master/robogym/envs/dactyl/common/cube_env.py | import abc
from contextlib import contextmanager
from typing import Dict, List, Optional, Tuple, TypeVar
import attr
import numpy as np
from robogym.envs.dactyl.common import cube_utils
from robogym.envs.dactyl.common.cube_utils import DEFAULT_CAMERA_NAMES
from robogym.envs.dactyl.common.dactyl_cube_wrappers import a... | 12,925 | 32.228792 | 99 | py |
robogym | robogym-master/robogym/envs/dactyl/common/cube_manipulator.py | import collections
from typing import Dict, Tuple
import numpy as np
import pycuber
from robogym.utils import rotation
PYCUBER_LOCATION_AXES: Dict[str, np.array] = {
"L": np.array([-1, 0, 0]),
"R": np.array([1, 0, 0]),
"F": np.array([0, -1, 0]),
"B": np.array([0, 1, 0]),
"D": np.array([0, 0, -1])... | 15,260 | 34.992925 | 99 | py |
robogym | robogym-master/robogym/envs/dactyl/common/cube_utils.py | import math
import numpy as np
from robogym.mujoco.helpers import joint_qpos_ids_from_prefix
from robogym.utils import rotation
PARALLEL_QUATS = [
rotation.quat_normalize(rotation.euler2quat(r))
for r in rotation.get_parallel_rotations()
]
DEFAULT_CAMERA_NAMES = ["vision_cam_top", "vision_cam_right", "visi... | 5,962 | 31.763736 | 97 | py |
robogym | robogym-master/robogym/envs/dactyl/common/dactyl_cube_wrappers.py | import logging
from robogym.wrappers.named_wrappers import apply_named_wrappers, edit_wrappers
logger = logging.getLogger(__name__)
def construct_default_wrappers(
*,
randomize: bool,
n_action_bins: int,
fixed_wrist: bool,
adr_wrapper,
relative_goal_wrapper: bool = False,
drop_reward: fl... | 4,867 | 29.049383 | 97 | py |
robogym | robogym-master/robogym/envs/dactyl/common/mujoco_modifiers.py | import numpy as np
# noinspection PyUnresolvedReferences
from robogym.mujoco.modifiers.timestep import Modifier
# noinspection PyAttributeOutsideInit
class PerpendicularCubeSizeModifier(Modifier):
""" Modify size of a "perpendicular cube" """
def __init__(self, prefix):
super().__init__()
s... | 3,155 | 29.941176 | 87 | py |
robogym | robogym-master/robogym/envs/dactyl/observation/cube.py | import numpy as np
from robogym.observation.goal import GoalObservation
from robogym.observation.mujoco import MujocoObservation
from robogym.utils.rotation import quat_normalize
class MujocoCubePosObservation(MujocoObservation):
"""
Implement mujoco base cube position observation.
"""
def get(self)... | 1,639 | 23.117647 | 88 | py |
robogym | robogym-master/robogym/envs/dactyl/observation/shadow_hand.py | import abc
import numpy as np
from robogym.observation.mujoco import MujocoObservation
from robogym.robot.shadow_hand.hand_forward_kinematics import FINGERTIP_SITE_NAMES
from robogym.robot.shadow_hand.hand_interface import JOINTS
from robogym.robot.shadow_hand.mujoco.mujoco_shadow_hand import MuJoCoShadowHand
def _... | 2,716 | 27.6 | 82 | py |
robogym | robogym-master/robogym/envs/dactyl/observation/full_perpendicular.py | import numpy as np
from robogym.observation.goal import GoalObservation
from robogym.observation.mujoco import MujocoObservation
from robogym.utils.rotation import normalize_angles
MYPY = False
if MYPY:
from robogym.envs.dactyl.full_perpendicular import FullPerpendicularSimulation
BaseObservationType = Mujo... | 1,267 | 22.924528 | 88 | py |
robogym | robogym-master/robogym/envs/dactyl/observation/reach.py | import numpy as np
from robogym.observation.goal import GoalObservation
class GoalFingertipPosObservation(GoalObservation):
"""
Implement goal fingertip pos observation.
"""
def get(self) -> np.ndarray:
assert self.provider.goal
return self.provider.goal["fingertip_pos"]
class Goal... | 618 | 22.807692 | 72 | py |
robogym | robogym-master/robogym/envs/dactyl/observation/face_perpendicular.py | import numpy as np
from robogym.observation.goal import GoalObservation
from robogym.observation.mujoco import MujocoObservation
MYPY = False
if MYPY:
from robogym.envs.dactyl.face_perpendicular import FacePerpendicularSimulation
BaseObservationType = MujocoObservation[FacePerpendicularSimulation]
else:
... | 1,197 | 22.038462 | 82 | py |
robogym | robogym-master/robogym/envs/dactyl/observation/locked.py | import numpy as np
from robogym.observation.goal import GoalObservation
class GoalCubePosObservation(GoalObservation):
"""
Implement goal cube position observation.
"""
def get(self) -> np.ndarray:
"""
Locked cube doesn't take position as part of goal.
"""
return np.z... | 328 | 19.5625 | 58 | py |
robogym | robogym-master/robogym/envs/dactyl/tests/test_rubik_solvers.py | import unittest
import numpy as np
import pytest
from numpy.testing import assert_allclose
from robogym.envs.dactyl.full_perpendicular import make_env
from robogym.utils import rotation
class TestRubikSolvers(unittest.TestCase):
X_AXIS = 0
Y_AXIS = 1
Z_AXIS = 2
NEGATIVE_SIDE = 0
POSITIVE_SIDE =... | 11,388 | 34.369565 | 89 | py |
robogym | robogym-master/robogym/envs/dactyl/tests/test_locked.py | import numpy as np
from mujoco_py import ignore_mujoco_warnings
from numpy.testing import assert_allclose
from robogym.envs.dactyl.common.cube_utils import on_palm
from robogym.envs.dactyl.locked import make_env, make_simple_env
from robogym.utils import rotation
def test_locked_cube():
env = make_env(starting_s... | 6,618 | 30.975845 | 91 | py |
robogym | robogym-master/robogym/envs/dactyl/tests/test_full.py | import numpy as np
import pytest
from numpy.testing import assert_allclose
from robogym.envs.dactyl.full_perpendicular import make_env, make_simple_env
from robogym.utils import rotation
def test_cube_mass():
env = make_env(constants=dict(randomize=False))
sim = env.unwrapped.sim
cube_id = sim.model.body... | 4,773 | 29.8 | 89 | py |
robogym | robogym-master/robogym/envs/dactyl/tests/test_cube_utils.py | import numpy as np
import robogym.envs.dactyl.common.cube_utils as cube_utils
import robogym.utils.rotation as rotation
def test_align_quat_up():
""" Test function 'align_quat_up' """
identity_quat = np.array([1.0, 0.0, 0.0, 0.0])
assert (
np.linalg.norm(cube_utils.align_quat_up(identity_quat) -... | 5,150 | 28.267045 | 88 | py |
robogym | robogym-master/robogym/envs/dactyl/tests/test_cube_manipulator.py | import numpy as np
import pycuber
import robogym.utils.rotation as rotation
from robogym.envs.dactyl.full_perpendicular import FullPerpendicularSimulation
X_AXIS = 0
Y_AXIS = 1
Z_AXIS = 2
NEGATIVE_SIDE = 0
POSITIVE_SIDE = 1
def _full_side_idx(axis, side):
# DRIVER ORDER IS:
# -x, +x, -y, +y, -z, +z
re... | 8,123 | 30.984252 | 88 | py |
robogym | robogym-master/robogym/envs/dactyl/tests/test_reach.py | from robogym.envs.dactyl.reach import make_env
def test_dactyl_reach():
env = make_env()
obs = env.reset()
expected_joints = (
"robot0:WRJ1",
"robot0:WRJ0",
"robot0:FFJ3",
"robot0:FFJ2",
"robot0:FFJ1",
"robot0:FFJ0",
"robot0:MFJ3",
"robot0:MF... | 826 | 21.972222 | 65 | py |
robogym | robogym-master/robogym/envs/dactyl/goals/full_unconstrained.py | import typing
import numpy as np
from robogym.envs.dactyl.common import cube_utils
from robogym.goal.goal_generator import GoalGenerator
from robogym.utils import rotation
class FullUnconstrainedGoal(GoalGenerator):
"""
Rotate any face, no orientation objectives for the Z axis.
"""
def __init__(
... | 4,409 | 35.147541 | 99 | py |
robogym | robogym-master/robogym/envs/dactyl/goals/unconstrained_cube_solver.py | import logging
import typing
import numpy as np
from robogym.envs.dactyl.goals.rubik_cube_solver import RubikCubeSolver
from robogym.utils import rotation
logger = logging.getLogger(__name__)
class UnconstrainedCubeSolver(RubikCubeSolver):
"""
Generates a series of goals to solve a Rubik's cube.
Goals ... | 4,548 | 35.103175 | 92 | py |
robogym | robogym-master/robogym/envs/dactyl/goals/face_curriculum.py | import typing
import numpy as np
from robogym.envs.dactyl.common import cube_utils
from robogym.goal.goal_generator import GoalGenerator
from robogym.utils import rotation
class FaceCurriculumGoal(GoalGenerator):
""" 'Face curriculum' goal generation. Generate goals that specify a fully aligned cube at a
de... | 6,870 | 38.262857 | 99 | py |
robogym | robogym-master/robogym/envs/dactyl/goals/release_cube_solver.py | import logging
from robogym.envs.dactyl.goals.face_cube_solver import FaceCubeSolverGoal
logger = logging.getLogger(__name__)
class ReleaseCubeSolverGoal(FaceCubeSolverGoal):
def face_threshold(self):
"""
Dynamic face threshold to use a custom success threshold
that is lower than the typ... | 977 | 30.548387 | 73 | py |
robogym | robogym-master/robogym/envs/dactyl/goals/locked_parallel.py | from typing import Set
import numpy as np
from numpy.random import RandomState
from robogym.envs.dactyl.common import cube_utils
from robogym.envs.dactyl.common.cube_env import CubeSimulationInterface
from robogym.goal.goal_generator import GoalGenerator
from robogym.utils import rotation
class LockedParallelGoal(G... | 3,288 | 40.1125 | 94 | py |
robogym | robogym-master/robogym/envs/dactyl/goals/face_free.py | import typing
import numpy as np
from robogym.envs.dactyl.common import cube_utils
from robogym.goal.goal_generator import GoalGenerator
from robogym.utils import rotation
class FaceFreeGoal(GoalGenerator):
"""
Rotate the top face of the cube and make sure it's still a top face, but don't constrain
the ... | 7,517 | 38.568421 | 99 | py |
robogym | robogym-master/robogym/envs/dactyl/goals/locked_real_image.py | import numpy as np
from numpy.random import RandomState
from robogym.envs.dactyl.common.cube_env import CubeSimulationInterface
from robogym.envs.dactyl.common.cube_utils import DEFAULT_CAMERA_NAMES
from robogym.envs.dactyl.goals.locked_parallel import LockedParallelGoal
class LockedRealImageGoal(LockedParallelGoal)... | 1,309 | 30.190476 | 88 | py |
robogym | robogym-master/robogym/envs/dactyl/goals/shadow_hand_reach_fingertip_pos.py | import numpy as np
from numpy.random import RandomState
from robogym.envs.dactyl.reach import ReachSimulation
from robogym.goal.goal_generator import GoalGenerator
from robogym.robot.shadow_hand.hand_forward_kinematics import FINGERTIP_SITE_NAMES
from robogym.utils.dactyl_utils import actuated_joint_range
class Fing... | 3,768 | 35.240385 | 88 | py |
robogym | robogym-master/robogym/envs/dactyl/goals/face_cube_solver.py | import logging
import typing
import numpy as np
from robogym.envs.dactyl.common import cube_utils
from robogym.envs.dactyl.goals.rubik_cube_solver import RubikCubeSolver
from robogym.utils import rotation
logger = logging.getLogger(__name__)
class FaceCubeSolverGoal(RubikCubeSolver):
"""
Generates a series... | 7,728 | 37.645 | 94 | py |
robogym | robogym-master/robogym/envs/dactyl/goals/rubik_cube_solver.py | import logging
import typing
import numpy as np
import pycuber
from robogym.envs.dactyl.common import cube_utils
from robogym.goal.goal_generator import GoalGenerator
from robogym.utils import rotation
from robogym.utils.rubik_utils import solve_fast
logger = logging.getLogger(__name__)
class GoalAction(typing.Nam... | 6,493 | 31.964467 | 97 | py |
robogym | robogym-master/robogym/envs/dactyl/goals/fixed_fair_scramble.py | import logging
from robogym.envs.dactyl.goals.face_cube_solver import FaceCubeSolverGoal
logger = logging.getLogger(__name__)
class FixedFairScrambleGoal(FaceCubeSolverGoal):
"""
Generates a series of goals to apply a "fair scramble" to a fully solved Rubik's cube.
The fair scramble was generated using ... | 675 | 34.578947 | 90 | py |
robogym | robogym-master/robogym/envs/rearrange/composer.py | import attr
from robogym.envs.rearrange.common.base import (
RearrangeEnv,
RearrangeEnvConstants,
RearrangeEnvParameters,
)
from robogym.envs.rearrange.goals.object_state import GoalArgs
from robogym.envs.rearrange.simulation.composer import (
ComposerRearrangeSim,
ComposerRearrangeSimParameters,
)... | 1,338 | 26.895833 | 87 | py |
robogym | robogym-master/robogym/envs/rearrange/chessboard.py | import logging
from typing import List
import attr
import numpy as np
from robogym.envs.rearrange.common.mesh import (
MeshRearrangeEnv,
MeshRearrangeEnvConstants,
MeshRearrangeEnvParameters,
MeshRearrangeSimParameters,
)
from robogym.envs.rearrange.common.utils import find_meshes_by_dirname
from robo... | 3,177 | 32.104167 | 87 | py |
robogym | robogym-master/robogym/envs/rearrange/ycb_pickandplace.py | from robogym.envs.rearrange.common.base import RearrangeEnvConstants
from robogym.envs.rearrange.goals.pickandplace import PickAndPlaceGoal
from robogym.envs.rearrange.simulation.mesh import MeshRearrangeSim
from robogym.envs.rearrange.ycb import YcbRearrangeEnv
class YcbPickAndPlaceEnv(YcbRearrangeEnv):
@classme... | 556 | 33.8125 | 82 | py |
robogym | robogym-master/robogym/envs/rearrange/table_setting.py | import logging
from typing import List
import attr
import numpy as np
from robogym.envs.rearrange.common.mesh import (
MeshRearrangeEnv,
MeshRearrangeEnvConstants,
MeshRearrangeEnvParameters,
MeshRearrangeSimParameters,
)
from robogym.envs.rearrange.goals.object_state_fixed import ObjectFixedStateGoal... | 2,813 | 32.105882 | 108 | py |
robogym | robogym-master/robogym/envs/rearrange/holdout.py | import os
from typing import Dict, List, Optional, cast
import attr
import numpy as np
from robogym.envs.rearrange.common.base import (
RearrangeEnv,
RearrangeEnvConstants,
RearrangeEnvParameters,
)
from robogym.envs.rearrange.goals.holdout_object_state import (
HoldoutGoalArgs,
HoldoutObjectState... | 3,871 | 32.094017 | 86 | py |
robogym | robogym-master/robogym/envs/rearrange/mixture.py | from typing import Any, Dict, List
import attr
from robogym.envs.rearrange.common.mesh import (
MeshRearrangeEnv,
MeshRearrangeEnvConstants,
MeshRearrangeEnvParameters,
)
from robogym.envs.rearrange.datasets.envstates.utils import get_envstate_datasets
from robogym.envs.rearrange.datasets.objects.utils im... | 4,957 | 36.560606 | 96 | py |
robogym | robogym-master/robogym/envs/rearrange/blocks_reach.py | import attr
import numpy as np
from robogym.envs.rearrange.blocks import BlockRearrangeEnvParameters, BlockRearrangeSim
from robogym.envs.rearrange.common.base import RearrangeEnv, RearrangeEnvConstants
from robogym.envs.rearrange.goals.object_reach_goal import (
DeterministicReachGoal,
ObjectReachGoal,
)
@a... | 1,282 | 31.897436 | 88 | py |
robogym | robogym-master/robogym/envs/rearrange/blocks_stack.py | import logging
import attr
from robogym.envs.rearrange.common.base import (
RearrangeEnv,
RearrangeEnvConstants,
RearrangeEnvParameters,
)
from robogym.envs.rearrange.goals.object_stack_goal import ObjectStackGoal
from robogym.envs.rearrange.simulation.base import RearrangeSimParameters
from robogym.envs.... | 1,242 | 26.622222 | 84 | py |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.