text stringlengths 3.07k 22.1k |
|---|
# Copyright (c) 2017, <NAME> <<EMAIL>>
# All rights reserved
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# * Redistributions of source code must retain the above copyright notice, this
# list of conditions and t... |
import collections
import openmlpimp
from ConfigSpace.hyperparameters import UniformFloatHyperparameter, \
UniformIntegerHyperparameter, CategoricalHyperparameter
from scipy.stats import gaussian_kde
from sklearn.model_selection._search import BaseSearchCV
from sklearn.model_selection._search import ParameterSam... |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2013 Hewlett-Packard Development Company, L.P.
# 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
#
# ... |
import torch
import torch.nn as nn
import torch.nn.functional as F
import math
import numpy as np
import scipy.ndimage
from config import config
class FlawDetector(nn.Module):
""" The FC Discriminator proposed in paper:
'Guided Collaborative Training for Pixel-wise Semi-Supervised Learning'
"""
n... |
from __future__ import annotations
from textwrap import dedent
from typing import TYPE_CHECKING
import numpy as np
import pandas as pd
from pandas.util._decorators import doc
from sklearn.pipeline import FeatureUnion as SKFeatureUnion
from sklearn.preprocessing import MinMaxScaler as SKMinMaxScaler
from sklearn.prepr... |
__all__ = ["assign_attributes", "get_attributes"]
def assign_attributes(data, site, sampling_period=None, network=None):
""" Assign attributes to the data we've processed. This ensures that the xarray Datasets produced
as CF 1.7 compliant. Some of the attributes written to the Dataset are saved as metadat... |
import smtplib, time,os,datetime
from email.mime.text import MIMEText
from email.header import Header
from toolkit import Toolkit
from email.mime.multipart import MIMEMultipart
from email import Encoders, Utils
from toolkit import Toolkit
import tushare as ts
from pandas import Series
import matplotlib.pyplot as plt
im... |
#!python
##############
# HOW TO RUN #
##############
# 1. Install Pytest
"pip install pytest"
# 2. Run Tests
"pytest -v test_airlines.py"
# NOTE: if "pytest" is not found, run "python -m pytest ..."
##############
import pytest
from typing import Dict, List, Any
from airlines import Airline, get_delay
try:
from... |
# Copyright 2017 Intel Corporation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in wri... |
import discord
from discord.ext import commands
import datetime
class AmountConverter(commands.Converter):
async def convert(self, ctx, argument):
try:
return int(argument)
except:
pass
if "all" in argument:
coins = await ctx.bot.pool.fetchval("SELECT co... |
import asyncio
import collections
import concurrent.futures
import math
import time
import async_timeout
import discord
from discord.ext import commands
# noinspection PyUnreachableCode
if False:
import alice
class Helper:
# region discord stuff
@staticmethod
async def react_or_false(ctx, reactions:... |
# -*- coding: utf-8 -*-
"""
Created on Sat Jan 19 13:15:14 2019
@author: HP
"""
import cv2
import numpy as np
from flask import Flask,render_template
import json
app= Flask(__name__)
@app.route('/')
def hello():
return render_template('index.html')
hand_hist = None
traverse_point = []
total_rectangle = 9
hand... |
# Test the GalSim interface to a PixelMapCollection
from __future__ import print_function
import pixmappy
import time
import numpy as np
import os
import galsim
def test_basic():
"""Test basic operation of the GalSimWCS class """
# Check that building a GalSimWCS builds successfully and has some useful attrib... |
#%% First
import numpy as np
import json
import os
from numpy.lib.type_check import _asfarray_dispatcher
import pandas as pd
import requests
from contextlib import closing
import time
from datetime import datetime
import seaborn as sns
from matplotlib import pyplot as plt
abspath = os.path.abspath(__file__)
dname = os... |
#! /usr/bin/env python
#
# Originally written in 2015 by <NAME> (Precision Translation Tools).
#
# This file is part of moses. Its use is licensed under the GNU Lesser General
# Public License version 2.1 or, at your option, any later version.
"""Reformat project source code, and/or check for style errors ("lint").
... |
from easydict import EasyDict as edict
import numpy as np
import torch.nn as nn
__C = edict()
cfg = __C
### Define config flags here
### Some flags are dummy, would be removed later
### Name of the config
__C.TAG = 'default'
### Training and validation
__C.GT_DEPTH_DIR = None
__C.TRAIN_SIZE = [256,512]
__C... |
"""
Random walker segmentation algorithm
from *Random walks for image segmentation*, <NAME>, IEEE Trans
Pattern Anal Mach Intell. 2006 Nov;28(11):1768-83.
This code is mostly adapted from scikit-image 0.11.3 release.
Location of file in scikit image: random_walker function and its supporting
sub functions in skimage.... |
from django.contrib.auth.models import User
from django.contrib.contenttypes.fields import GenericRelation
from django.core import validators
from django.core.exceptions import ValidationError
from django.db import models
from django.db.models import Avg, Sum, Count, Q
from django.db.models.functions import Coalesce
fr... |
"""
The input data for the fine-tune flow. Directory structure in "user@118:/home/students/oron/animation/data$"
data:
\TRAIN_Series:
\triplets:
\guid.jpg
\triplets.json
\model:
\keyframe_detections:
\guid.jpg
\animationdetectionoutput.json
"""
import json
import os
import shutil
import uuid
from t... |
# -*- coding: utf-8 -*-
# NeuralCorefRes main
#
# Author: <NAME> <<EMAIL>>
#
# For license information, see LICENSE
import argparse
import gc
import os
import pprint
import re
import sys
from itertools import zip_longest
from typing import List
import nltk
import numpy as np
from nltk.corpus import stopwords
from nlt... |
import numpy as np
import sys
import random
import os
import time
import argparse
import glob
import matplotlib.pyplot as plt
from functools import partial
try:
from mayavi import mlab as mayalab
except:
pass
np.random.seed(2)
# from contact_point_dataset_torch_multi_label import MyDataset
from hang_dataset impor... |
# Slightly modified from original Lucid library
# Copyright 2018 The Lucid Authors. 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/license... |
import json
import os
import glob
import shutil
import logging
import time
import itertools
from nullunit.common import GIT_CMD, WORK_DIR, PACKAGE_MANAGER, getPackrat, getContractor, getConfluence, runMake, MakeException
from nullunit.procutils import execute, execute_rc, ExecutionException
from nullunit.targets import... |
import asyncio
from typing import Sequence, Dict, Tuple, AsyncIterator, Any, Optional
from enum import Enum
import grpc
import torch
from hivemind.averaging.partition import TensorPartContainer, TensorPartReducer, AllreduceException
from hivemind.utils import Endpoint, get_logger, ChannelCache
from hivemind.utils.asy... |
# (C) Copyright 2017 Inova Development Inc.
# 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.0
#
# Unless required by appl... |
from typing import Dict, List, Optional, Tuple
import numpy as np
import scipy
import torch
from tqdm import tqdm
import datasets
from fewie.data.datasets.generic.nway_kshot import NwayKshotDataset
from fewie.encoders.encoder import Encoder
from fewie.evaluation.classifiers.classifier import Classifier
from fewie.eva... |
# Ported from the Synchrosqueezing Toolbox, authored by
# <NAME>, <NAME>
# (http://www.math.princeton.edu/~ebrevdo/)
# (https://github.com/ebrevdo/synchrosqueezing/)
import numpy as np
from .utils import wfiltfn, padsignal, buffer
from quadpy import quad as quadgk
PI = np.pi
EPS = np.finfo(np.float64).eps # ma... |
# python -m odf.mfs.collector
import datetime
import os
import time
from datetime import datetime
from threading import Thread
import cv2
import mss
import pandas as pd
import wave
import pyaudio
from odf.config import config
from PIL import Image
import numpy
import json
sensors = {
# up to seven groups, each g... |
import random
import pubchem as pc
import numpy as np
import pandas as pd
import sklearn as sk
import utility
import db.db as db
from config import config as cc
import sys
from sets import Set
import data
RD = cc.exp['params']['data']
RP = cc.exp['params']['rnn']
# not entirely correct, in one partition can app... |
#!/usr/bin/env python
# Copyright 2019 <NAME>
#
# This file is part of RfPy.
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# ... |
# -*- coding: utf-8 -*-
"""Input utilities and constants for `openmx`."""
from os.path import splitext
import functools
import jsonschema
import numpy as np
_RESERVED_KEYWORDS = [
'SYSTEM_CURRRENTDIRECTORY',
'SYSTEM_NAME',
'DATA_PATH',
'LEVEL_OF_STDOUT',
'LEVEL_OF_FILEOUT',
'SPECIES_NUMBER',
... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Wed Mar 13 14:10:46 2019
@author: gui
"""
import sys, pygame
import numpy as np
from pygame.locals import *
import pygame.freetype
w = 600
h = 600
scale = 100
WHITE = (255, 255, 255)
BLUE = (0, 0, 255)
score = max_score = 0
pygame.init()
screen = pygame.... |
from PIL import Image
import glob, os, sys, face_recognition, itertools, subprocess, concurrent.futures, face_util, datetime
global dir_images
global dir_faces
global dir_exclude_arg
global face_tolerance
global is_verbose
global is_exiftool
def print_help():
print(" ")
print("Recognize persons in images and... |
from __future__ import division
import numpy as np
import math
import fractions
from nltk.util import ngrams
from collections import Counter
from fractions import Fraction
def sentence_bleu(references, hypothesis, weights=(0.25, 0.25, 0.25, 0.25),
smoothing_function=None):
"""
:param refere... |
from jax.scipy.linalg import solve
from jax.lax import scan
from optimism.JaxConfig import *
from optimism import Interpolants
from optimism import Mesh
from optimism import QuadratureRule
from optimism.TensorMath import tensor_2D_to_3D
FunctionSpace = namedtuple('FunctionSpace', ['shapes', 'vols', 'shapeGrads', 'mes... |
import os
import sys
from datetime import datetime
from shutil import copyfile
import glob
import copy
import yaml
import torch
import networkx as nx
import numpy as np
from models.fourier_nn import FourierNet
from problems.dist_online_dense_problem import DistOnlineDensityProblem
from optimizers.dinno import DiNNO
f... |
from typing import Optional, Callable, Any, List, Dict
import numpy as np
from functools import partial
import torch.nn as nn
import torch
from torch import Tensor
from ..layers.activations import lookup_act
from ..initialisations import lookup_normal_init
from .abs_block import AbsBlock
__all__ = ['FullyConnected',... |
from StringIO import StringIO
from django.core.paginator import Paginator
from django.core.handlers.wsgi import WSGIRequest
from django.template import Template, Context
from django.http import HttpRequest as DjangoHttpRequest
from django.test import SimpleTestCase
from pagination.templatetags.pagination_tags import... |
from pathlib import Path
import fpdf
from test.conftest import assert_pdf_equal
HERE = Path(__file__).resolve().parent
TEXT_SIZE, SPACING = 36, 1.15
LINE_HEIGHT = TEXT_SIZE * SPACING
TABLE_DATA = (
("First name", "Last name", "Age", "City"),
("Jules", "Smith", "34", "San Juan"),
("Mary", "Ramos", "45",... |
# -*- coding: utf-8 -*-
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
... |
import speech_recognition as sr
from os import system, _exit
from playsound import playsound
from random import randrange
from threading import Thread
from time import time, localtime
from datetime import date
from utilities import *
from dictionary import *
from tts import *
from stt import *
from google_functions im... |
import torch
import torch.nn as nn
from collections import OrderedDict
from PIL import Image
import numpy as np
def act(act_type, inplace=True, neg_slope=0.2, n_prelu=1):
# helper selecting activation
# neg_slope: for leakyrelu and init of prelu
# n_prelu: for p_relu num_parameters
act_type = act_type... |
# =============== 有序数组去重
from collections import OrderedDict
from typing import List
# Method 1 ----- new list
def removeDuplicates(test_list):
res = []
for i in test_list:
if i not in res:
res.append(i)
# Method 2 ----- new list
def removeDuplicates(test_list):
res = []
[res.app... |
import logging
from banal import is_mapping, ensure_list
from pprint import pprint # noqa
from followthemoney import model
log = logging.getLogger(__name__)
DEFTAULT_IDENTIFIER = 'registrationNumber'
IDENTIFIERS = {
'TRADE_REGISTER': 'registrationNumber',
'AU-ABN': 'registrationNumber',
'PY-PGN': 'class... |
import os
import re
import urllib
import urlparse
import hashlib
import logging
from google.appengine.api import memcache
from google.appengine.api import urlfetch
from google.appengine.runtime import apiproxy_errors
import webapp2
# URLs that have absolute addresses
ABSOLUTE_URL_REGEX = r"(http(s?):)?//(?P<url>[^\... |
import csv, os
from py3dengine.utils.WavefrontOBJFormat.WavefrontOBJReader import WavefrontOBJReader
from dolphintracker.smooth_path.pool_camera import PoolCamera
from py3dengine.scenes.SceneClient import SceneClient
from py3dengine.scenes.Scene import Scene
from py3dengine.cameras.Ray import Ray, lin3d_distance
... |
#!/usr/bin/env python
import argparse
import mdtraj as md
import os
from LLC_Membranes.llclib import topology
def initialize():
parser = argparse.ArgumentParser(description='Generate topology file from coordinate file.')
parser.add_argument('-g', '--gro', help='Name of coordinate file to write topology fil... |
import re
import os
import sys
import random
import argparse
from datetime import datetime
import spacy
import msgpack, time
import numpy as np
import multiprocessing
import unicodedata
import collections
import torch
from torch.autograd import Variable
from apip import utils
from apip.model import DocReaderModel
p... |
from __future__ import print_function
import numpy as np
def IsPowerOfTwo(i):
"""Returns true if all entries of i are powers of two, False otherwise.
"""
return (i & (i - 1)) == 0 and i != 0
def Log2ofPowerof2(shape):
""" Returns powers of two exponent for each element of shape
"""
res = ... |
import sqlite3
from pprint import pprint
import json
from pathlib import Path
from time import perf_counter, sleep
import multiprocessing as mp
#from multiprocessing import Pipe, Process
#from multiprocessing.connection import Connection
from multiprocessing.connection import Connection
from enum import Enum
from colle... |
import math
import numpy as np
import cv2
import sys
# # Implement the functions below.
def extract_red(image):
""" Returns the red channel of the input image. It is highly recommended to make a copy of the
input image in order to avoid modifying the original array. You can do this by calling:
temp_image... |
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
name = 'weibo_2_album'
import cached_url
import yaml
from bs4 import BeautifulSoup
from telegram_util import AlbumResult as Result
from telegram_util import getWid, matchKey
import sys
import os
import hashlib
from PIL import Image
prefix = 'https://m.weibo.cn/statuses/... |
# -*- coding: utf-8 -*-
"""
Created on Sat Jun 5 00:24:23 2021
@author: 34123
"""
import matplotlib.pyplot as plt
import numpy as np
import random
from scipy.stats import multivariate_normal
def plot_random_init_iris_sepal(df_full):
sepal_df = df_full.iloc[:,0:2]
sepal_df = np.array(sepal_df)
m1 = ... |
import json
import os
import platform
import random
import sys
from discord.ext.commands.core import command
import requests
from lxml import html
from ast import literal_eval
# uWu quote libraries
from owoify import owoify
import discord
from discord.ext import commands, tasks
from discord.ext.commands import Bot
i... |
from django.shortcuts import render
from django.template import loader
from django.http import HttpResponse, HttpResponseForbidden, HttpResponseNotAllowed, HttpResponseRedirect, HttpResponseBadRequest, HttpRequest
from django.core.exceptions import PermissionDenied
from django.contrib.auth import authenticate, login, l... |
#!/usr/bin/python
"""
Utility script with functions used in lr classifier and cnn classifier.
For data preparation:
- get_train_test(): from dataframe, and specified columns, get train and test data and labels
- tokenize_text(): tokenize a list of texts, and return tokenized texts
- pad_texts(): add padding t... |
# Graphics for Exploratory Analysis Script
# ==============================================================================
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
import seaborn as sns
# ^^^ pyforest auto-imports - don't write above this line
# ========================================... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
:mod:`Quantulum` unit and entity loading functions.
"""
import json
from collections import defaultdict
from pathlib import Path
from typing import Any, List, Tuple, Union
from . import classes as c
from . import language
TOPDIR = Path(__file__).parent or Path(".")
... |
#!/usr/bin/env python
import csv
import os
import sys
import argparse
from decimal import *
from datetime import datetime
def parse_args():
parser = argparse.ArgumentParser()
parser._action_groups.pop()
# parser.add_argument('-b', '--begin_date', help="Begin date (inclusive)", type=lambda s: d... |
'''
Created on Apr 15, 2016
Evaluate the performance of Top-K recommendation:
Protocol: leave-1-out evaluation
Measures: Hit Ratio and NDCG
(more details are in: <NAME>, et al. Fast Matrix Factorization for Online Recommendation with Implicit Feedback. SIGIR'16)
@author: hexiangnan
'''
import math
... |
"""Generate random sentences with an LCFRS.
Reads grammar from a text file."""
import sys
import gzip
import codecs
from collections import namedtuple, defaultdict
from array import array
from random import random
SHORTUSAGE = '''Generate random sentences with a PLCFRS or PCFG.
Reads grammar from a text file in PLCFR... |
#!/usr/bin/env python
"""
Testing harness for running pyshepseg in the tiling mode.
Handy for running a basic segmentation
but it is suggested that users call the module directly from a Python
script and handle things like scaling the data in an appripriate
manner for their application.
"""
#Copyright 2021 <NAME> an... |
__all__ = [
"Element",
"component",
"html_name_to_python",
"python_name_to_html",
"ParseError"
]
from typing import *
from keyword import iskeyword
from inspect import getmembers
from html.parser import HTMLParser
from xml.etree import ElementTree
def prefixed_attributes(obj, prefix):
return ... |
# --- Internal Level Representation and Gamerules --- #
from typing import Collection, Mapping, Tuple, Type, Sequence
from functools import reduce
from copy import deepcopy
import pygame as pg # for type hints
from entities import *
from helpers import V2
class Board:
"""a hashing based sparse-matrix... |
# Copyright 2021 Huawei Technologies Co., Ltd
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to... |
import click
import requests
from operator import itemgetter
from blessed import Terminal
from itertools import chain, cycle
import os
from sys import platform
from datetime import datetime
from texttable import Texttable
import logs.logger as logger
from src.constants import ELEMENTS_PER_PAGE, ONE_MONTH, ONE_YEAR, SOR... |
#! /usr/bin/env python
# -*- coding: utf-8 -*-
"""
@Author:lichunhui
@Time: 2018/7/19 16:05
@Description: 利用谷歌翻译进行因为文本翻译
"""
import urllib.request
import urllib.parse
import execjs
import random
import json
import asyncio
from aiohttp import ClientSession
from baikeSpider.settings import MY_USER_AGENT
from ..logger i... |
from collections import defaultdict
from math import *
from itertools import product
from logbook import Logger
import cv2
import numpy as np
import networkx as nx
import math
from tqdm import tqdm
# from palettable.cartocolors.qualitative import Pastel_10 as COLORS
from suppose.common import timing
from suppose.camer... |
# MIT License
# Copyright (c) 2018 <NAME>
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish... |
"""A module which implements the time frequency estimation.
Authors : <NAME> <<EMAIL>>
License : BSD 3-clause
Multitaper wavelet method
"""
import warnings
from math import sqrt
import numpy as np
from scipy import linalg
from scipy.fftpack import fftn, ifftn
from .utils import logger, verbose
from .dpss import dp... |
# -*- coding: utf-8 -*-
"""
Created on Mon May 21 21:08:09 2018
@author: <NAME>
"""
# System Utilities
import os
import io
import sys
import gc
import traceback
# Email and Text processing
import email
from email.header import decode_header
import re
import uuid # unique ID
# Data handling and analytics tools
impo... |
# coding=utf-8
# Copyright 2022 The Google Research Authors.
#
# 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 applicab... |
# vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2012 <NAME>
# 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... |
import functools
import glob
import os
import shlex
from typing import Callable, Iterable, List, Optional, Tuple
from bs4 import BeautifulSoup, Comment, Doctype
from mitmproxy import ctx, http
import modules.arguments as A
import modules.constants as C
import modules.csp as csp
import modules.inject as inject
import ... |
# def decision_tree_to_simple_program(node: TreeNode, simple_program: SimpleProgram, previous_conjunction=Term('true')):
# # if the current node is a leaf
# if node.left_subtree is None and node.right_subtree is None:
# if node.classification is not None:
# clause = (node.classification << p... |
from __future__ import print_function # Python 2.x
import os
import numpy as np
import pandas as pd
import h5py
import sys
import math
from fnmatch import fnmatch
# helper functions klusta analysis pipeline
def get_param_file(filename,params_folder):
found = False
params = []
for path, subdirs, files in ... |
import io
import logging
import re
from contextlib import redirect_stdout
from threading import Thread
from typing import Dict, Callable
import botflow.matches as matches
log = logging.getLogger(__name__)
class Response:
def __init__(self, msg: str, response_action: Callable=None):
self.__msg = msg
... |
# -*- coding: utf-8 -*-
import os
import re
import sounddevice as sd
from utils import read_wav, write_wav
import numpy as np
from threading import Thread
import argparse
class DeviceNotFoundError(Exception):
pass
def record_target(file_path, length, fs, channels=2, append=False):
"""Records audio and writ... |
import app as vnpy_app
from time import sleep
import json
import handler
import script_handler
import time, datetime
import vnpy.trader.rqdata as rq
from vnpy.trader.object import HistoryRequest
from vnpy.trader.constant import Exchange, Interval
from kdj import calc_kdj
import pandas as pd
import matplotlib.pyplot as ... |
from flask import Blueprint, g, request, current_app
import json
import logging
from ..utils import datetime_to_json, get_time_string, get_default_runtime, match_movie
import datetime
from ..pick_algo import pick_movies_by_num, pick_movies_by_time
from .auth import login_required
import pandas
import pathlib
from .. i... |
"""
This module contains classes for PSU controllers that supports the SNMP management protocol.
The classes must implement the PsuControllerBase interface defined in controller_base.py.
"""
import logging
from controller_base import PsuControllerBase
from controller_base import run_local_cmd
def get_psu_controller... |
# -*- coding: utf-8 -*-
# @Time : 2020/4/20
# @File : network.py
# @Software: PyCharm
import tensorflow as tf
###RFB
def _BasicConv(x, out_planes, kernel_size, stride=1, padding='same', dilation=1, activation=1, use_l2=False,
use_bn=True, use_bias=False):
'''
Basic Convolution Layer
'''
... |
import torch
import torch.nn as nn
import numpy as np
import scipy.io as scio
import os
import matplotlib.pyplot as plt
os.environ['CUDA_VISIBLE_DEVICES'] = '0'
torch.manual_seed(1)
np.random.seed(1)
lapl_op = [[[[ 0, 0, -1/12, 0, 0],
[ 0, 0, 4/3, 0, 0],
[-1/12, 4/3... |
#!/usr/bin/env python3
"""
###################
last changes
edidted the data processing.py
duplicate_processing funciton
added the product id to 'query' dict
###################
"""
"""
Program: front_module
File: front_module.py
Version: V1.0
Date: 10.05.18
Function: creates and reciv... |
# Copyright (c) 2015 Mirantis Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writ... |
"""
DeCliff filter contributed by Minecraft Forums user "DrRomz"
Originally posted here:
http://www.minecraftforum.net/topic/13807-mcedit-minecraft-world-editor-compatible-with-mc-beta-18/page__st__3940__p__7648793#entry7648793
"""
from numpy import zeros, array
import itertools
from pymclevel import alphaMaterials
a... |
# standard imports
from landsat_metadata import landsat_metadata
from dnppy import core
import math
import os
import arcpy
if arcpy.CheckExtension('Spatial')=='Available':
arcpy.CheckOutExtension('Spatial')
arcpy.env.overwriteOutput = True
__all__=['toa_reflectance_8', # complete
'toa_re... |
# The MIT License (MIT)
#
# Copyright (c) 2020 <NAME>
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, me... |
# ---------------------------------------------------------------
# layers.py
# Set-up time: 2021/1/3 15:14
# Copyright (c) 2020 ICT
# Licensed under The MIT License [see LICENSE for details]
# Written by Kenneth-Wong (Wenbin-Wang) @ VIPL.ICT
# Contact: <EMAIL> [OR] <EMAIL>
# ------------------------------------... |
from app import __metadata__ as meta
from configparser import ConfigParser, ExtendedInterpolation
from pathlib import Path
from shutil import copy
import os
import io
import logging
log = logging.getLogger(__name__)
APP = meta.APP_NAME
'''
This component is responsible for configuration management.
If this is the fir... |
# implementing RNN and LSTM
# %%
import pandas as pd
import numpy as np
import nltk
import sklearn
import matplotlib.pyplot as plt
import re
import tqdm
twitter_df = pd.read_csv('twitter_train.csv')
twitter_df = twitter_df.fillna('0')
twitter_df_test = pd.read_csv('twitter_test.csv')
twitter_df_test = twitter_df_tes... |
# -*- coding: utf-8 -*-
#
# Dell EMC OpenManage Ansible Modules
# Version 2.1.3
# Copyright (C) 2019-2020 Dell Inc. or its subsidiaries. All Rights Reserved.
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
#
from __future__ import (absolute_import, division, print_functio... |
# -*- coding: UTF-8 -*-
import os, sys
try:
import ConfigParser
except ImportError:
import configparser as ConfigParser
import filecmp
import random
import shutil
import tempfile
import time
import unittest
try:
from StringIO import StringIO
except ImportError:
from io import StringIO
import win32com.c... |
import scann
from argparse import ArgumentParser
from pl_bolts.models.self_supervised import SimCLR
from pl_bolts.models.self_supervised.resnets import resnet18
from pl_bolts.models.self_supervised.simclr.transforms import SimCLREvalDataTransform, SimCLRTrainDataTransform
from pathlib import Path
import torch
import os... |
import os
import glob
from unet3d.data import write_data_to_file, open_data_file
from unet3d.generator import get_training_and_validation_generators
from unet3d.model import siam3dunet_model
from unet3d.model import testnet_model
from unet3d.training import load_old_model, train_model
from skimage.io import imsave, im... |
import logging
import typing
from datetime import timedelta
import disnake
from asyncpg.exceptions import PostgresError
from disnake.ext.commands import BucketType, cooldown, guild_only
from bot.bot import command, bot_has_permissions, group, Group
from bot.converters import AnyUser, CommandConverter, TimeDelta
from ... |
import os
import cv2
import numpy as np
from math import *
from scipy.stats import mode
import time
# 图像矫正类
class ImgCorrect:
"""
霍夫变换进行线段检索,再根据这些线段算出夹角,利用角度的加权平均值和频率最高的思想作为旋转的最佳角度
"""
def __init__(self, img):
self.img = img
"""
# 图像归一化处理 会造成图像清晰度变低
self.h, self.w, self.... |
import abc
import logging
from enum import Enum
from typing import List, Tuple, Union, Dict, Optional
from nempy.user_data import AccountData
from nempy.sym.constants import BlockchainStatuses, Fees, TransactionStatus
from .sym import api as sym
from .sym import network
from .sym.network import NodeSelector
logger = ... |
# Copyright 2020 The TensorFlow Probability Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law o... |
import json
from pathlib import Path
from typing import Any, Dict, Optional, Set, Union
import numpy
from pydantic import BaseModel, BaseSettings
from ..testing import compare_recursive
from ..util import deserialize, serialize, yaml_import
from ..util.autodocs import AutoPydanticDocGenerator
from ..util.decorators i... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.