repo
stringlengths
2
99
file
stringlengths
13
225
code
stringlengths
0
18.3M
file_length
int64
0
18.3M
avg_line_length
float64
0
1.36M
max_line_length
int64
0
4.26M
extension_type
stringclasses
1 value
chainer
chainer-master/chainer/utils/cache.py
import functools import chainer class cached_property(object): """Cache a result of computation of Chainer functions Caches are stored for each chainer.config.enable_backprop. The following example calls ``F.sigmoid`` only once. >>> class C(object): ... def __init__(self, x): ... ...
1,735
29.45614
77
py
chainer
chainer-master/chainer/utils/conv_nd_kernel.py
import functools import six from chainer.backends import cuda def mulexp(xs, init=None): if init is not None: return functools.reduce('{} * {}'.format, xs, init) else: return functools.reduce('{} * {}'.format, xs) def andexp(xs, init=None): if init is not None: return functools...
9,790
31.855705
79
py
chainer
chainer-master/chainer/utils/imgproc.py
import numpy def oversample(images, crop_dims): """Crop an image into center, corners, and mirror images.""" # Dimensions and center. channels, src_h, src_w = images[0].shape cy, cx = src_h / 2.0, src_w / 2.0 dst_h, dst_w = crop_dims # Make crop coordinates crops_ix = numpy.empty((5, 4),...
992
30.03125
74
py
chainer
chainer-master/chainer/utils/experimental.py
import warnings import chainer def experimental(api_name): """Declares that user is using an experimental feature. The developer of an API can mark it as *experimental* by calling this function. When users call experimental APIs, :class:`FutureWarning` is issued. The presentation of :class:`Futu...
2,976
27.084906
79
py
chainer
chainer-master/chainer/utils/__init__.py
import collections import contextlib import shutil import sys import tempfile import numpy import six import chainer # import classes and functions from chainer.utils.array import size_of_shape # NOQA from chainer.utils.array import sum_to # NOQA from chainer.utils.conv import get_conv_outsize # NOQA from chainer....
3,506
31.775701
79
py
chainer
chainer-master/chainer/utils/conv.py
import numpy import six from chainer.backends import cuda def get_conv_outsize(size, k, s, p, cover_all=False, d=1): """Calculates output size of convolution. This function takes the size of input feature map, kernel, stride, and pooling of one particular dimension, then calculates the output feature ...
6,499
34.135135
78
py
chainer
chainer-master/chainer/utils/meta.py
import warnings import six def final(*args, **kwargs): """Decorator to declare a method final. By default, :class:`TypeError` is raised when the decorated method is being overridden. The class in which the decorated method is defined must inherit from a base class returned by :meth:`~chainer.ut...
2,668
32.3625
79
py
chainer
chainer-master/chainer/serializers/npz.py
import numpy import six from chainer.backends import _chainerx from chainer.backends import _cpu from chainer.backends import cuda from chainer.backends import intel64 from chainer import serializer import chainerx # For historical reasons, NPZ serializers in Chainer allow pickle despite their # potential security i...
9,163
36.557377
79
py
chainer
chainer-master/chainer/serializers/hdf5.py
import sys import numpy import six from chainer.backends import _chainerx from chainer.backends import _cpu from chainer.backends import cuda from chainer.backends import intel64 from chainer import serializer import chainerx try: import h5py _available = True except ImportError: _available = False de...
6,563
32.151515
79
py
chainer
chainer-master/chainer/serializers/__init__.py
from chainer.serializers.hdf5 import HDF5Deserializer # NOQA from chainer.serializers.hdf5 import HDF5Serializer # NOQA from chainer.serializers.hdf5 import load_hdf5 # NOQA from chainer.serializers.hdf5 import save_hdf5 # NOQA from chainer.serializers.npz import DictionarySerializer # NOQA from chainer.serializer...
463
50.555556
64
py
vosk-api
vosk-api-master/python/setup.py
import os import setuptools import shutil import glob import platform # Figure out environment for cross-compile vosk_source = os.getenv("VOSK_SOURCE", os.path.abspath(os.path.join(os.path.dirname(__file__), ".."))) system = os.environ.get('VOSK_SYSTEM', platform.system()) architecture = os.environ.get('VOSK_ARCHI...
2,861
36.657895
94
py
vosk-api
vosk-api-master/python/vosk_builder.py
#!/usr/bin/env python3 import os from cffi import FFI vosk_root=os.environ.get("VOSK_SOURCE", "..") cpp_command = "cpp " + vosk_root + "/src/vosk_api.h" ffibuilder = FFI() ffibuilder.set_source("vosk.vosk_cffi", None) ffibuilder.cdef(os.popen(cpp_command).read()) if __name__ == '__main__': ffibuilder.compile(ve...
332
21.2
52
py
vosk-api
vosk-api-master/python/test/transcribe_scp.py
#!/usr/bin/env python3 import wave import json import sys from multiprocessing.dummy import Pool from vosk import Model, KaldiRecognizer model = Model("en-us") def recognize(line): uid, fn = line.split() wf = wave.open(fn, "rb") rec = KaldiRecognizer(model, wf.getframerate()) text = "" while Tr...
774
21.142857
77
py
vosk-api
vosk-api-master/python/example/test_webvtt.py
#!/usr/bin/env python3 import sys import subprocess import json import textwrap from webvtt import WebVTT, Caption from vosk import Model, KaldiRecognizer, SetLogLevel SAMPLE_RATE = 16000 WORDS_PER_LINE = 7 SetLogLevel(-1) model = Model(lang="en-us") rec = KaldiRecognizer(model, SAMPLE_RATE) rec.SetWords(True) d...
1,770
25.044118
77
py
vosk-api
vosk-api-master/python/example/test_microphone.py
#!/usr/bin/env python3 # prerequisites: as described in https://alphacephei.com/vosk/install and also python module `sounddevice` (simply run command `pip install sounddevice`) # Example usage using Dutch (nl) recognition model: `python test_microphone.py -m nl` # For more help run: `python test_microphone.py -h` imp...
2,822
30.366667
153
py
vosk-api
vosk-api-master/python/example/test_gpu_batch.py
#!/usr/bin/env python3 import sys import json from vosk import BatchModel, BatchRecognizer, GpuInit from timeit import default_timer as timer TOT_SAMPLES = 0 GpuInit() model = BatchModel("model") with open(sys.argv[1]) as fn: fnames = fn.readlines() fds = [open(x.strip(), "rb") for x in fnames] uids =...
1,411
21.774194
67
py
vosk-api
vosk-api-master/python/example/test_simple.py
#!/usr/bin/env python3 import wave import sys from vosk import Model, KaldiRecognizer, SetLogLevel # You can set log level to -1 to disable debug messages SetLogLevel(0) wf = wave.open(sys.argv[1], "rb") if wf.getnchannels() != 1 or wf.getsampwidth() != 2 or wf.getcomptype() != "NONE": print("Audio file must be...
834
22.194444
82
py
vosk-api
vosk-api-master/python/example/test_nlsml.py
#!/usr/bin/env python3 import wave import sys from vosk import Model, KaldiRecognizer, SetLogLevel SetLogLevel(0) wf = wave.open(sys.argv[1], "rb") if wf.getnchannels() != 1 or wf.getsampwidth() != 2 or wf.getcomptype() != "NONE": print("Audio file must be WAV format mono PCM.") sys.exit(1) model = Model(l...
595
20.285714
82
py
vosk-api
vosk-api-master/python/example/test_alternatives.py
#!/usr/bin/env python3 import wave import sys import json from vosk import Model, KaldiRecognizer, SetLogLevel SetLogLevel(0) wf = wave.open(sys.argv[1], "rb") if wf.getnchannels() != 1 or wf.getsampwidth() != 2 or wf.getcomptype() != "NONE": print("Audio file must be WAV format mono PCM.") sys.exit(1) mod...
688
21.225806
82
py
vosk-api
vosk-api-master/python/example/test_empty.py
#!/usr/bin/env python3 import json from vosk import Model, KaldiRecognizer model = Model(lang="en-us") rec = KaldiRecognizer(model, 8000) res = json.loads(rec.FinalResult()) print(res)
189
14.833333
39
py
vosk-api
vosk-api-master/python/example/test_gradio.py
#!/usr/bin/env python3 import json import gradio as gr from vosk import KaldiRecognizer, Model model = Model(lang="en-us") def transcribe(data, state): sample_rate, audio_data = data audio_data = (audio_data >> 16).astype("int16").tobytes() if state is None: rec = KaldiRecognizer(model, sample_...
958
22.390244
73
py
vosk-api
vosk-api-master/python/example/test_reset.py
#!/usr/bin/env python3 import wave import sys import json from vosk import Model, KaldiRecognizer, SetLogLevel SetLogLevel(0) wf = wave.open(sys.argv[1], "rb") if wf.getnchannels() != 1 or wf.getsampwidth() != 2 or wf.getcomptype() != "NONE": print("Audio file must be WAV format mono PCM.") sys.exit(1) mod...
775
21.823529
82
py
vosk-api
vosk-api-master/python/example/test_words.py
#!/usr/bin/env python3 import wave import sys from vosk import Model, KaldiRecognizer wf = wave.open(sys.argv[1], "rb") if wf.getnchannels() != 1 or wf.getsampwidth() != 2 or wf.getcomptype() != "NONE": print("Audio file must be WAV format mono PCM.") sys.exit(1) model = Model(lang="en-us") # You can also ...
864
26.03125
106
py
vosk-api
vosk-api-master/python/example/test_srt.py
#!/usr/bin/env python3 import subprocess import sys from vosk import Model, KaldiRecognizer, SetLogLevel SAMPLE_RATE = 16000 SetLogLevel(-1) model = Model(lang="en-us") rec = KaldiRecognizer(model, SAMPLE_RATE) rec.SetWords(True) with subprocess.Popen(["ffmpeg", "-loglevel", "quiet", "-i", ...
529
23.090909
86
py
vosk-api
vosk-api-master/python/example/test_ffmpeg.py
#!/usr/bin/env python3 import subprocess import sys from vosk import Model, KaldiRecognizer, SetLogLevel SAMPLE_RATE = 16000 SetLogLevel(0) model = Model(lang="en-us") rec = KaldiRecognizer(model, SAMPLE_RATE) with subprocess.Popen(["ffmpeg", "-loglevel", "quiet", "-i", sys.argv[1], ...
724
23.166667
86
py
vosk-api
vosk-api-master/python/example/test_text.py
#!/usr/bin/env python3 import sys import json from vosk import Model, KaldiRecognizer model = Model(lang="en-us") # Large vocabulary free form recognition rec = KaldiRecognizer(model, 16000) # You can also specify the possible word list #rec = KaldiRecognizer(model, 16000, "zero oh one two three four five six seve...
668
22.068966
92
py
vosk-api
vosk-api-master/python/example/test_speaker.py
#!/usr/bin/env python3 import os import sys import wave import json import numpy as np from vosk import Model, KaldiRecognizer, SpkModel SPK_MODEL_PATH = "model-spk" if not os.path.exists(SPK_MODEL_PATH): print("Please download the speaker model from " "https://alphacephei.com/vosk/models and unpack as ...
3,345
41.35443
88
py
vosk-api
vosk-api-master/python/vosk/__init__.py
import os import sys import srt import datetime import json import requests from urllib.request import urlretrieve from zipfile import ZipFile from re import match from pathlib import Path from .vosk_cffi import ffi as _ffi from tqdm import tqdm # Remote location of the models and local folders MODEL_PRE_URL = "https...
9,892
34.844203
100
py
vosk-api
vosk-api-master/python/vosk/transcriber/transcriber.py
import json import logging import asyncio import websockets import srt import datetime import shlex import subprocess from vosk import KaldiRecognizer, Model from queue import Queue from timeit import default_timer as timer from multiprocessing.dummy import Pool CHUNK_SIZE = 4000 SAMPLE_RATE = 16000.0 class Transcri...
7,336
35.321782
161
py
vosk-api
vosk-api-master/python/vosk/transcriber/cli.py
#!/usr/bin/env python3 import argparse import logging import sys import os from pathlib import Path from vosk import list_models, list_languages from vosk.transcriber.transcriber import Transcriber parser = argparse.ArgumentParser( description = "Transcribe audio file and save result in selected format") par...
2,697
28.977778
97
py
vosk-api
vosk-api-master/python/vosk/transcriber/__init__.py
0
0
0
py
sysbench
sysbench-master/third_party/cram/setup.py
#!/usr/bin/env python """Installs cram""" import os import sys from distutils.core import setup COMMANDS = {} CRAM_DIR = os.path.abspath(os.path.dirname(__file__)) try: from wheel.bdist_wheel import bdist_wheel except ImportError: pass else: COMMANDS['bdist_wheel'] = bdist_wheel def long_description(): ...
1,529
29
70
py
sysbench
sysbench-master/third_party/cram/cram/__main__.py
"""Main module (invoked by "python -m cram")""" import sys import cram try: sys.exit(cram.main(sys.argv[1:])) except KeyboardInterrupt: pass
152
12.909091
47
py
sysbench
sysbench-master/third_party/cram/cram/_main.py
"""Main entry point""" import optparse import os import shlex import shutil import sys import tempfile try: import configparser except ImportError: # pragma: nocover import ConfigParser as configparser from cram._cli import runcli from cram._encoding import b, fsencode, stderrb, stdoutb from cram._run import...
7,967
35.888889
78
py
sysbench
sysbench-master/third_party/cram/cram/_process.py
"""Utilities for running subprocesses""" import os import signal import subprocess import sys from cram._encoding import fsdecode __all__ = ['PIPE', 'STDOUT', 'execute'] PIPE = subprocess.PIPE STDOUT = subprocess.STDOUT def _makeresetsigpipe(): """Make a function to reset SIGPIPE to SIG_DFL (for use in subproc...
1,805
31.836364
77
py
sysbench
sysbench-master/third_party/cram/cram/_diff.py
"""Utilities for diffing test files and their output""" import codecs import difflib import re from cram._encoding import b __all__ = ['esc', 'glob', 'regex', 'unified_diff'] def _regex(pattern, s): """Match a regular expression or return False if invalid. >>> from cram._encoding import b >>> [bool(_re...
5,630
34.415094
78
py
sysbench
sysbench-master/third_party/cram/cram/_run.py
"""The test runner""" import os import sys from cram._encoding import b, fsdecode, fsencode from cram._test import testfile __all__ = ['runtests'] if sys.platform == 'win32': # pragma: nocover def _walk(top): top = fsdecode(top) for root, dirs, files in os.walk(top): yield (fsencode(...
2,345
28.696203
74
py
sysbench
sysbench-master/third_party/cram/cram/_xunit.py
"""xUnit XML output""" import locale import os import re import socket import sys import time from cram._encoding import u, ul __all__ = ['runxunit'] _widecdataregex = ul(r"'(?:[^\x09\x0a\x0d\x20-\ud7ff\ue000-\ufffd" r"\U00010000-\U0010ffff]|]]>)'") _narrowcdataregex = ul(r"'(?:[^\x09\x0a\x0d\x...
6,247
34.908046
77
py
sysbench
sysbench-master/third_party/cram/cram/__init__.py
"""Functional testing framework for command line applications""" from cram._main import main from cram._test import test, testfile __all__ = ['main', 'test', 'testfile']
172
23.714286
64
py
sysbench
sysbench-master/third_party/cram/cram/_cli.py
"""The command line interface implementation""" import os import sys from cram._encoding import b, bytestype, stdoutb from cram._process import execute __all__ = ['runcli'] def _prompt(question, answers, auto=None): """Write a prompt to stdout and ask for answer in stdin. answers should be a string, with e...
4,484
31.5
78
py
sysbench
sysbench-master/third_party/cram/cram/_encoding.py
"""Encoding utilities""" import os import sys try: import builtins except ImportError: import __builtin__ as builtins __all__ = ['b', 'bchr', 'bytestype', 'envencode', 'fsdecode', 'fsencode', 'stdoutb', 'stderrb', 'u', 'ul', 'unicodetype'] bytestype = getattr(builtins, 'bytes', str) unicodetype =...
2,990
26.953271
75
py
sysbench
sysbench-master/third_party/cram/cram/_test.py
"""Utilities for running individual tests""" import itertools import os import re import time from cram._encoding import b, bchr, bytestype, envencode, unicodetype from cram._diff import esc, glob, regex, unified_diff from cram._process import PIPE, STDOUT, execute __all__ = ['test', 'testfile'] _needescape = re.co...
7,959
33.458874
77
py
sysbench
sysbench-master/third_party/cram/tests/run-doctests.py
#!/usr/bin/env python import doctest import os import sys def _getmodules(pkgdir): """Import and yield modules in pkgdir""" for root, dirs, files in os.walk(pkgdir): if '__pycache__' in dirs: dirs.remove('__pycache__') for fn in files: if not fn.endswith('.py') or fn ==...
1,182
27.853659
61
py
riscv-ocelot
riscv-ocelot-master/util/pipeview-helper.py
#!/usr/bin/env python #****************************************************************************** # Copyright (c) 2016, The Regents of the University of California (Regents). # All Rights Reserved. See LICENSE for license details. #------------------------------------------------------------------------------ #---...
8,876
35.9875
88
py
riscv-ocelot
riscv-ocelot-master/util/branch-processor.py
import argparse import sys parser = argparse.ArgumentParser(description='BOOM branch trace analyzer') parser.add_argument('-v', '--verbose', action='store_true', help='echo log contents') parser.add_argument('file', nargs='?', type=argparse.FileType('r'), default=sys.stdin, ...
3,997
34.696429
92
py
riscv-ocelot
riscv-ocelot-master/docs/conf.py
# -*- coding: utf-8 -*- # # Configuration file for the Sphinx documentation builder. # # This file does only contain a selection of the most common options. For a # full list see the documentation: # http://www.sphinx-doc.org/en/master/config # -- Path setup ------------------------------------------------------------...
5,400
29.173184
79
py
nonlocal-3dtracking
nonlocal-3dtracking-master/cvf/Python/setup.py
import os from distutils.sysconfig import get_python_lib libDir=get_python_lib() curDir=os.path.dirname(__file__) curDir=os.path.abspath(curDir) print('libDir='+libDir) print('curDir='+curDir) with open(libDir+'/'+'cvf.pth','w') as f: f.write(curDir+'\n') ''' libs=['bfc'] for lib in libs: with open(lib...
383
17.285714
46
py
nonlocal-3dtracking
nonlocal-3dtracking-master/cvf/Python/__init__.py
0
0
0
py
nonlocal-3dtracking
nonlocal-3dtracking-master/cvf/Python/test/test_dataset_render.py
import os import sys envs=os.environ.get("PATH") os.environ['PATH']=envs+';F:/dev/cvfx/assim410/bin-v140/x64/release/;F:/dev/cvfx/opencv3413/bin-v140/x64/Release/;F:/dev/cvfx/bin/x64/;D:/setup/Anaconda3/;' import cv2 from cv2 import data from skimage import measurecd import random import numpy as np import pycocot...
7,343
29.857143
156
py
nonlocal-3dtracking
nonlocal-3dtracking-master/cvf/Python/test/test_cvr.py
import os import sys import numpy as np import cv2 import time #envs=os.environ.get("PATH") #os.environ['PATH']=envs+';F:/dev/cvfx/assim410/bin-v140/x64/release/;F:/dev/cvfx/opencv3413/bin-v140/x64/Release/;F:/dev/cvfx/bin/x64/;D:/setup/Anaconda3/;' import cvf.cvrender as cvr #cvr.init("") #dr=cvr.DatasetRender() #...
952
18.44898
157
py
nonlocal-3dtracking
nonlocal-3dtracking-master/cvf/Python/compress/compress.py
import os mlx_path = "/home/aa/libs/cvf/Python/compress/compressmodel.mlx" # mlx脚本的路径 root_dir = "/home/aa/data/3dmodels" # 需要处理模型的根路径 for dr in os.listdir(root_dir): model_dir = os.path.join(root_dir, dr) if os.path.isdir(model_dir): model_path = os.path.join(model_dir, dr+".3ds") # 模型的路径,模型后缀根据实...
622
35.647059
118
py
nonlocal-3dtracking
nonlocal-3dtracking-master/cvf/Python/cvf/tools/render_bop_dataset.py
import os import sys #envs=os.environ.get("PATH") #os.environ['PATH']=envs+';F:/dev/cvfx/assim410/bin-v140/x64/release/;F:/dev/cvfx/opencv3413/bin-v140/x64/Release/;F:/dev/cvfx/bin/x64/;D:/setup/Anaconda3/;' import cv2 from cv2 import data from skimage import measure import random import numpy as np def categories...
7,686
30.504098
157
py
nonlocal-3dtracking
nonlocal-3dtracking-master/cvf/Python/cvf/tools/compositer.py
from numpy.core.fromnumeric import shape import cvf.bfc as bfc import cvf.cvrender as cvr import cv2 import random '''composite a set of image objects with a background image harmonizeF : transform fg color with respect to bg degradeF : add random smooth and noise to fg, specified with maxSmoothSigma and maxNoiseStd...
3,155
35.275862
120
py
nonlocal-3dtracking
nonlocal-3dtracking-master/cvf/Python/cvf/tools/render_test_idea.py
import cvf.bfc as bfc import cvf.cvrender as cvr import json import argparse import numpy as np import math import random import numpy as np import cv2 import os import shutil import csv """ def gen_views(nViews, nViewSamples, marginRatio=0): assert(nViewSamples>=nViews) views=cvr.sampleSphere(nViews) sam...
8,753
32.159091
139
py
nonlocal-3dtracking
nonlocal-3dtracking-master/cvf/Python/cvf/tools/render_delg_databasev2.py
import cvf.bfc as bfc import cvf.cvrender as cvr import json import argparse import numpy as np from sympy import im def gen_views(nViews, nViewSamples, marginRatio=0): assert(nViewSamples>=nViews) views=cvr.sampleSphere(nViews) samples=cvr.sampleSphere(nViewSamples) viewClusters=[] for i in rang...
3,872
29.496063
137
py
nonlocal-3dtracking
nonlocal-3dtracking-master/cvf/Python/cvf/tools/render_det2d_dataset.py
import os import sys import cv2 from cv2 import data from skimage import measure import random import numpy as np import pycocotools as coco import pycocotools.mask def categories(label, label_id): category = {} category['supercategory'] = 'component' category['id'] = label_id category['name'] = la...
8,333
30.80916
134
py
nonlocal-3dtracking
nonlocal-3dtracking-master/cvf/Python/cvf/tools/render_delg_database.py
import cvf.bfc as bfc import cvf.cvrender as cvr import json import argparse import numpy as np from sympy import im def gen_views(nViews, nViewSamples, marginRatio=0): assert(nViewSamples>=nViews) views=cvr.sampleSphere(nViews) samples=cvr.sampleSphere(nViewSamples) viewClusters=[] for i in rang...
3,872
29.496063
137
py
nonlocal-3dtracking
nonlocal-3dtracking-master/cvf/Python/cvf/tools/render_viewclassify_dataset.py
import cvf.bfc as bfc import cvf.cvrender as cvr import json import argparse def gen_views(nViews, nViewSamples, marginRatio=0): assert(nViewSamples>=nViews) views=cvr.sampleSphere(nViews) samples=cvr.sampleSphere(nViewSamples) viewClusters=[] for i in range(0,len(views)): viewClusters.app...
4,178
30.186567
137
py
nonlocal-3dtracking
nonlocal-3dtracking-master/cvf/Python/cvf/tools/cls_angle_render_viewclassify_dataset.py
import cvf.bfc as bfc import cvf.cvrender as cvr import json def gen_views(nViews, nViewSamples, marginRatio=0): assert(nViewSamples>=nViews) views=cvr.sampleSphere(nViews) samples=cvr.sampleSphere(nViewSamples) viewClusters=[] for i in range(0,len(views)): viewClusters.append([]) for...
3,543
29.551724
137
py
nonlocal-3dtracking
nonlocal-3dtracking-master/cvf/Python/cvf/tools/__init__.py
0
0
0
py
nonlocal-3dtracking
nonlocal-3dtracking-master/cvf/Python/cvf/tools/render_delg_dataset.py
import cvf.bfc as bfc import cvf.cvrender as cvr import json import argparse import numpy as np from sympy import im def gen_views(nViews, nViewSamples, marginRatio=0): assert(nViewSamples>=nViews) views=cvr.sampleSphere(nViews) samples=cvr.sampleSphere(nViewSamples) viewClusters=[] for i in rang...
4,146
30.416667
137
py
nonlocal-3dtracking
nonlocal-3dtracking-master/cvf/Python/cvf/bfc/__init__.py
import os envs=os.environ.get("PATH") os.environ['PATH']=envs+';F:/dev/cvfx/assim410/bin-v140/x64/release/;F:/dev/cvfx/opencv3413/bin-v140/x64/Release/;F:/dev/cvfx/bin/x64/;D:/setup/Anaconda3/;'
197
32
156
py
nonlocal-3dtracking
nonlocal-3dtracking-master/cvf/Python/cvf/bfc/netcall.py
#from socketserver import TCPServer, StreamRequestHandler import socketserver import time import numpy as np import cv2 import struct from numpy.core.defchararray import decode BUFSIZ = 1024 ''' def encodeBytesList(bytesList): INT_SIZE=4 totalSize=INT_SIZE*(len(bytesList)+1) head=struct.pack('!i',len(byt...
11,842
25.854875
81
py
DeSpaWN
DeSpaWN-main/Script_DeSpaWN.py
# -*- coding: utf-8 -*- """ Title: Fully Learnable Deep Wavelet Transform for Unsupervised Monitoring of High-Frequency Time Series ------ (DeSpaWN) Description: -------------- Toy script to showcase the deep neural network DeSpaWN. Please cite the corresponding paper: Michau, G., Frusque, G., & Fin...
5,817
38.849315
195
py
DeSpaWN
DeSpaWN-main/lib/despawnLayers.py
# -*- coding: utf-8 -*- """ Title: Fully Learnable Deep Wavelet Transform for Unsupervised Monitoring of High-Frequency Time Series ------ (DeSpaWN) Description: -------------- Function to generate the layers used in DeSpaWN TF model. Please cite the corresponding paper: Michau, G., Frusque, G., & Fink, O. (...
6,326
40.084416
111
py
DeSpaWN
DeSpaWN-main/lib/despawn.py
# -*- coding: utf-8 -*- """ Title: Fully Learnable Deep Wavelet Transform for Unsupervised Monitoring of High-Frequency Time Series ------ (DeSpaWN) Description: -------------- Function to generate a DeSpaWN TF model. Please cite the corresponding paper: Michau, G., Frusque, G., & Fink, O. (2022). ...
6,679
43.238411
144
py
gym-mupen64plus
gym-mupen64plus-master/example.py
#!/bin/python import gym, gym_mupen64plus env = gym.make('Mario-Kart-Luigi-Raceway-v0') env.reset() print("NOOP waiting for green light") for i in range(18): (obs, rew, end, info) = env.step([0, 0, 0, 0, 0]) # NOOP until green light print("GO! ...drive straight as fast as possible...") for i in range(50): (o...
694
26.8
78
py
gym-mupen64plus
gym-mupen64plus-master/setup.py
from setuptools import setup setup(name='gym_mupen64plus', version='0.0.3', install_requires=['gym==0.7.4', 'numpy==1.16.2', 'PyYAML==5.1', 'termcolor==1.1.0', 'mss==4.0.2', # 4.0.3 removes support for Python 2....
374
33.090909
76
py
gym-mupen64plus
gym-mupen64plus-master/gym_mupen64plus/__init__.py
import logging from gym_mupen64plus.envs.MarioKart64.mario_kart_env import MarioKartEnv from gym_mupen64plus.envs.Smash.smash_env import SmashEnv logger = logging.getLogger(__name__)
184
29.833333
72
py
gym-mupen64plus
gym-mupen64plus-master/gym_mupen64plus/envs/mupen64plus_env.py
import sys PY3_OR_LATER = sys.version_info[0] >= 3 if PY3_OR_LATER: # Python 3 specific definitions from http.server import BaseHTTPRequestHandler, HTTPServer else: # Python 2 specific definitions from BaseHTTPServer import BaseHTTPRequestHandler, HTTPServer import abc import array from contextlib im...
18,495
36.824131
120
py
gym-mupen64plus
gym-mupen64plus-master/gym_mupen64plus/envs/__init__.py
0
0
0
py
gym-mupen64plus
gym-mupen64plus-master/gym_mupen64plus/envs/Smash/smash_env.py
import abc import inspect import itertools import os import yaml from termcolor import cprint from gym import spaces from gym_mupen64plus.envs.mupen64plus_env \ import Mupen64PlusEnv, ControllerState, IMAGE_HELPER import numpy as np from gym_mupen64plus.envs.Smash \ import damage_parser, damage_tracker mk_config =...
13,419
44.185185
122
py
gym-mupen64plus
gym-mupen64plus-master/gym_mupen64plus/envs/Smash/discrete_envs.py
import abc from gym_mupen64plus.envs.Smash.smash_env import SmashEnv from gym import spaces def _create_action_map(): joystick_magnitudes = [ ("HARDNEG", [-120]), ("MIDNEG", [-60]), ("NEUTRAL", [0]), ("MIDPOS", [60]), ("HARDPOS", [120]), ] # Button orders are A, B,...
2,402
34.865672
99
py
gym-mupen64plus
gym-mupen64plus-master/gym_mupen64plus/envs/Smash/damage_parser.py
import numpy as np import cv2 import os.path _HEIGHT = 38 SUCCESS = 0 PERCENT_UNDETECTED = 1 # Couldn't detect the % character. DIGIT_AFTER_PERCENT_UNDETECTED = 2 # Couldn't detect any digits after the % character. ZERO_NOT_RIGHT_COLOR = 3 # We detected 0, but it was unexpectedly dark, so ...
9,396
45.519802
87
py
gym-mupen64plus
gym-mupen64plus-master/gym_mupen64plus/envs/Smash/__init__.py
from gym.envs.registration import register from gym_mupen64plus.envs.Smash.smash_env import SmashEnv from gym_mupen64plus.envs.Smash.discrete_envs import SmashDiscreteEnv # TODO: Add support for other oppenents, colors, maps. characters = ['luigi', 'mario', 'dk', 'link', 'samus', 'falcon', 'ness', 'yosh...
1,105
31.529412
72
py
gym-mupen64plus
gym-mupen64plus-master/gym_mupen64plus/envs/Smash/damage_tracker.py
from gym_mupen64plus.envs.Smash \ import damage_parser _NUM_DMGS_TO_DETECT = 3 # How many times we need to detect a damage to update. # When the player dies, his damage disappears for a few frames before # resetting to zero. We detect this to detect deaths, which is necessary # because you can die at 0% damage, an...
5,085
48.862745
87
py
gym-mupen64plus
gym-mupen64plus-master/gym_mupen64plus/envs/MarioKart64/discrete_envs.py
import abc from gym_mupen64plus.envs.MarioKart64.mario_kart_env import MarioKartEnv from gym import spaces class DiscreteActions: ACTION_MAP = [ ("NO_OP", [ 0, 0, 0, 0, 0]), ("STRAIGHT", [ 0, 0, 1, 0, 0]), ("BRAKE", [ 0, 0, 0, 1, 0]), ("BACK_UP", ...
1,602
34.622222
99
py
gym-mupen64plus
gym-mupen64plus-master/gym_mupen64plus/envs/MarioKart64/mario_kart_env.py
import abc import inspect import itertools import os import yaml from termcolor import cprint from gym import spaces from gym_mupen64plus.envs.mupen64plus_env \ import Mupen64PlusEnv, ControllerState, IMAGE_HELPER import numpy as np ############################################### class MarioKartEnv(Mupen64PlusEnv): ...
16,451
41.076726
369
py
gym-mupen64plus
gym-mupen64plus-master/gym_mupen64plus/envs/MarioKart64/__init__.py
from gym.envs.registration import register from gym_mupen64plus.envs.MarioKart64.mario_kart_env import MarioKartEnv from gym_mupen64plus.envs.MarioKart64.discrete_envs import MarioKartDiscreteEnv courses = [ { 'name' : 'Luigi-Raceway', 'cup': 'Mushroom', 'max_steps': 1250 }, { 'name' : 'Moo-Moo-Farm', ...
2,335
43.923077
79
py
entropic_barrier
entropic_barrier-master/setup.py
from setuptools import setup, find_packages setup( name='diffusion', author='Guangyao Zhou', author_email='tczhouguangyao@gmail.com', license='MIT', # Package info packages=find_packages(), include_package_data=True, zip_safe=True, )
267
19.615385
44
py
entropic_barrier
entropic_barrier-master/golf_course/utils.py
import pickle import numpy as np DEFAULT_THRESHOLD_MULTIPLIER = 4 DEFAULT_RELATIVE_SCALE = 0.1 def uniform_on_sphere(center, radius, num_samples=1, reflecting_boundary_radius=np.inf): """uniform_on_sphere Uniform distribution on a sphere Parameters ---------- center : np array center i...
3,260
30.355769
90
py
entropic_barrier
entropic_barrier-master/golf_course/__init__.py
0
0
0
py
entropic_barrier
entropic_barrier-master/golf_course/core/target.py
from math import * import numba import numpy as np import sympy from scipy.special import gamma from sympy.utilities.lambdify import lambdastr import golf_course.estimate.numba as nestimate class Target(object): """ Target A class that describes regions around important points in the energy function. ...
10,808
37.466192
116
py
entropic_barrier
entropic_barrier-master/golf_course/core/model.py
import numpy as np import golf_course.estimate.numba as nestimate from golf_course.core.target import Target from golf_course.estimate.capacity import estimate_capacity class ToyModel(object): """ ToyModel This class defines the toy model we are going to use. For simplicity, in our program, we will s...
3,065
36.390244
107
py
entropic_barrier
entropic_barrier-master/golf_course/core/__init__.py
0
0
0
py
entropic_barrier
entropic_barrier-master/golf_course/estimate/numba.py
import numba import numpy as np from golf_course.utils import DEFAULT_THRESHOLD_MULTIPLIER @numba.jit(nopython=True, nogil=True, cache=True) def advance_flat_regions(current_location, centers, radiuses, time_step): boundary_radius = 1.0 scale = np.sqrt(time_step) n_dim = current_location.size n_targe...
7,720
34.417431
95
py
entropic_barrier
entropic_barrier-master/golf_course/estimate/__init__.py
0
0
0
py
entropic_barrier
entropic_barrier-master/golf_course/estimate/capacity.py
import multiprocessing as mp import numpy as np from scipy.cluster.vq import kmeans2 from scipy.optimize import linear_sum_assignment from scipy.spatial.distance import cdist import golf_course.estimate.numba as nestimate from golf_course.utils import uniform_on_sphere from tqdm import tqdm def estimate_capacity( ...
22,543
32.201767
118
py
entropic_barrier
entropic_barrier-master/golf_course/estimate/hitprob.py
import functools import multiprocessing as mp import timeit import numpy as np import golf_course.estimate.numba as nestimate import joblib from golf_course.utils import sample_uniform_initial_location from tqdm import tqdm def get_simple_hitprob_parallelize( centers, target_radiuses, time_step, initial_locatio...
6,584
37.063584
88
py
entropic_barrier
entropic_barrier-master/scripts/simulation_based_hitprob.py
import os import pickle import tempfile import numpy as np import sacred from golf_course.core.model import ToyModel from golf_course.estimate.hitprob import get_nontrivial_hitprob from golf_course.utils import (DEFAULT_RELATIVE_SCALE, load_model_params, sample_random_locations) from sa...
5,335
32.35
87
py
entropic_barrier
entropic_barrier-master/scripts/capacity_based_hitprob.py
import os import pickle import tempfile import timeit import sacred from golf_course.core.model import ToyModel from golf_course.utils import load_model_params from sacred.observers import FileStorageObserver log_folder = os.path.expanduser('~/logs/diffusion/capacity_based_hitprob') ex = sacred.Experiment('capacity_b...
3,917
30.596774
84
py
entropic_barrier
entropic_barrier-master/scripts/sanity_checks.py
import os import pickle import tempfile from pprint import pprint import numpy as np import sacred from golf_course.core.target import Target from golf_course.estimate.capacity import estimate_capacity from golf_course.estimate.hitprob import get_simple_hitprob from sacred.observers import FileStorageObserver log_fo...
5,646
29.524324
105
py
TTS
TTS-master/setup.py
#!/usr/bin/env python import argparse import os import shutil import subprocess import sys import numpy import setuptools.command.build_py import setuptools.command.develop from setuptools import find_packages, setup from distutils.extension import Extension from Cython.Build import cythonize # parameters for wheel...
5,141
33.05298
91
py
TTS
TTS-master/TTS/__init__.py
0
0
0
py
TTS
TTS-master/TTS/speaker_encoder/losses.py
import torch import torch.nn as nn import torch.nn.functional as F import numpy as np # adapted from https://github.com/cvqluu/GE2E-Loss class GE2ELoss(nn.Module): def __init__(self, init_w=10.0, init_b=-5.0, loss_method="softmax"): """ Implementation of the Generalized End-to-End loss defined in h...
6,369
38.565217
172
py
TTS
TTS-master/TTS/speaker_encoder/model.py
import torch from torch import nn class LSTMWithProjection(nn.Module): def __init__(self, input_size, hidden_size, proj_size): super().__init__() self.input_size = input_size self.hidden_size = hidden_size self.proj_size = proj_size self.lstm = nn.LSTM(input_size, hidden_si...
4,118
35.451327
112
py
TTS
TTS-master/TTS/speaker_encoder/dataset.py
import numpy import numpy as np import queue import torch import random from torch.utils.data import Dataset from tqdm import tqdm class MyDataset(Dataset): def __init__(self, ap, meta_data, voice_len=1.6, num_speakers_in_batch=64, storage_size=1, sample_from_storage_p=0.5, additive_noise=0, ...
6,882
39.488235
133
py
TTS
TTS-master/TTS/speaker_encoder/__init__.py
0
0
0
py
TTS
TTS-master/TTS/speaker_encoder/utils/generic_utils.py
import datetime import os import re import torch from TTS.speaker_encoder.model import SpeakerEncoder from TTS.utils.generic_utils import check_argument def to_camel(text): text = text.capitalize() return re.sub(r'(?!^)_([a-zA-Z])', lambda m: m.group(1).upper(), text) def setup_model(c): model = Speake...
5,843
48.525424
134
py
TTS
TTS-master/TTS/speaker_encoder/utils/prepare_voxceleb.py
# coding=utf-8 # Copyright (C) 2020 ATHENA AUTHORS; Yiping Peng; Ne Luo # All rights reserved. # # 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...
8,952
37.260684
104
py