sha256 stringlengths 64 64 | language stringclasses 28
values | size int32 1 491k | lines int32 1 23.2k | content stringlengths 1 200k |
|---|---|---|---|---|
64bacb35e159aca1032421c8497df73c5dbb263f9767847f6b70d1f5b98a863c | Python | 5,222 | 100 | # ----------------------------------------------------------------------- #
# Copyright (c) 2023, UChicago Argonne, LLC. All rights reserved. #
# #
# Software Name: Fast Autonomous Scanning Toolkit (FAST) #
# By: Argonne Na... |
bda5c733797fe3741a871008418f18eef4c2bde8430e194c6b4bbb74de83a664 | Python | 5,228 | 102 | #!/usr/bin/env python
import CNVworkflowlib
import argparse
# This script takes as input two or more files containing CNVs, and it outputs groups of CNVs with 50% reciprocal overlap
# The "CNV_filenames" should be filenames in the common format (as output by convert_CNV_calls_to_common_format.py),
# and the "benchmar... |
9cde4e97ba3569389ec1c2efb17950ac304c861b726a8654fc99b4713151758b | Python | 5,230 | 179 | _base_ = [
'../../../../_base_/default_runtime.py',
'../../../../_base_/datasets/deepfashion_lower.py'
]
evaluation = dict(interval=10, metric='PCK', save_best='PCK')
optimizer = dict(
type='Adam',
lr=5e-4,
)
optimizer_config = dict(grad_clip=None)
# learning policy
lr_config = dict(
policy='step',... |
adabe6d5f73ba47a69ed9fb6c26cd0e28739349ff4aeb8084a81f753711d9cc2 | Python | 5,230 | 113 | # Copyright (c) OpenMMLab. All rights reserved.
import torch
from mmdet.core import bbox2roi
from ..builder import HEADS, build_head
from .standard_roi_head import StandardRoIHead
@HEADS.register_module()
class MaskScoringRoIHead(StandardRoIHead):
"""Mask Scoring RoIHead for Mask Scoring RCNN.
https://arxiv... |
353ec4069b69856c193f1c434dcd2deca8c769751f53d9b613b6d94d0919bdcc | Python | 5,232 | 169 | _base_ = [
'../../../../_base_/default_runtime.py',
'../../../../_base_/datasets/aic.py'
]
evaluation = dict(interval=10, metric='mAP', save_best='AP')
optimizer = dict(
type='Adam',
lr=5e-4,
)
optimizer_config = dict(grad_clip=None)
# learning policy
lr_config = dict(
policy='step',
warmup='li... |
ef3efa20f62e1730110ff5c426235d9a1440967a110f645a82be62c35353b2fb | Python | 5,232 | 169 | _base_ = [
'../../../../_base_/default_runtime.py',
'../../../../_base_/datasets/aic.py'
]
evaluation = dict(interval=10, metric='mAP', save_best='AP')
optimizer = dict(
type='Adam',
lr=5e-4,
)
optimizer_config = dict(grad_clip=None)
# learning policy
lr_config = dict(
policy='step',
warmup='li... |
2089dcc30351a319642657b237a6f077c25617da96fc6716ec7ab37caa2209e5 | Python | 5,234 | 120 | import json
import os
import shutil
import pickle
import torch
import torch.nn as nn
from torch.utils.tensorboard import SummaryWriter
from models.models import SegmentationModule, build_encoder, build_decoder
from models.dataset import TrainDataset, ValDataset
from utils.constants import NUM_EPOCHS, OPTIMIZER_PARAMET... |
8e4e9e022d2bbc7ee074ad82d2f60e64fbdb9f31540366e8d9d87409fb5680a6 | Python | 5,237 | 169 | _base_ = [
'../../../../_base_/default_runtime.py',
'../../../../_base_/datasets/aic.py'
]
evaluation = dict(interval=10, metric='mAP', save_best='AP')
optimizer = dict(
type='Adam',
lr=5e-4,
)
optimizer_config = dict(grad_clip=None)
# learning policy
lr_config = dict(
policy='step',
warmup='li... |
fac23e0cfbd432c5fc361f28bd8a9e429367f058b4b9b8c9002743af48be70b3 | Python | 5,243 | 168 | #!/usr/bin/python
# -*- coding: UTF-8 -*-
from .util import *
from scipy.special import j0
def ensurePSD(kern,eps=0.0):
assert eps>=0
return ifftn(np.maximum(eps,fftn(kern).real)).real
def grid_kernel(
P,
shape,
style = 'radial',
angle = 0.0,
doclip = True,
k = 3... |
0a73ec8417c7fc01a3d52a939fcd12d7cbf05c2d2aa5d720fedfab709c1aa09c | Python | 5,247 | 180 | _base_ = [
'../../../../_base_/default_runtime.py',
'../../../../_base_/datasets/deepfashion_lower.py'
]
evaluation = dict(interval=10, metric='PCK', save_best='PCK')
optimizer = dict(
type='Adam',
lr=5e-4,
)
optimizer_config = dict(grad_clip=None)
# learning policy
lr_config = dict(
policy='step',... |
883e064917a7b9dddd26cfc2fd658bd485235ae396e4352322d9356dfdfc62da | Python | 5,247 | 137 | # Copyright (c) OpenMMLab. All rights reserved.
import mmcv
import torch
from mmdet.models.dense_heads import YOLACTHead, YOLACTProtonet, YOLACTSegmHead
def test_yolact_head_loss():
"""Tests yolact head losses when truth is empty and non-empty."""
s = 550
img_metas = [{
'img_shape': (s, s, 3),
... |
fbead9adf64f2b63f9265bf729694a7b770ed78923c4cfd3d304a5f47a34a062 | Python | 5,247 | 133 | # training surv-based network with resnet model
# Created: 5/21/2021
# Status: OK
# Consider merge into 1 main file
# CUBLAS_WORKSPACE_CONFIG=:4096:8 python res_main.py
# import torch.nn as nn
import sys
import torch
import numpy as np
import pandas as pd
sys.path.insert(1, '../plot/')
from networks import CNN_Surv_Wr... |
df652642d69edc62a4c061aff205e2350972bc11e35ca428c3ab4b27d1e1e6e0 | Python | 5,248 | 178 | import os.path as osp
import numpy as np
import numpy.random as npr
import PIL
import cv2
import torch
import torchvision
import xml.etree.ElementTree as ET
import json
import copy
import math
def singleton(class_):
instances = {}
def getinstance(*args, **kwargs):
if class_ not in instances:
... |
efbf0733d3e31a151028d058056af05a415bb6d0fef06042cb6600d56f22aa8e | Python | 5,255 | 170 | _base_ = [
'../../../../_base_/default_runtime.py',
'../../../../_base_/datasets/aic.py'
]
evaluation = dict(interval=10, metric='mAP', save_best='AP')
optimizer = dict(
type='Adam',
lr=5e-4,
)
optimizer_config = dict(grad_clip=None)
# learning policy
lr_config = dict(
policy='step',
warmup=Non... |
747eda59f7f2dccd5c242c0a63041e41670579349c0156ae6c797f0bf14e1df0 | Python | 5,256 | 139 | import torch
import torch.nn as nn
import copy
import numpy as np
from scipy.io import mmread
from scipy.io import mmwrite
from sys import getsizeof
# user specificed dataset name vector used to train autoencoder and impute
datasets = ['jurkat', 'monocyte','mbrain','pbmc','lymphoma','293t','bmmc','human_mix',... |
12626636e09a1dbd89b1c62c5d5d53217ffaee75f4d0c737aba6727a737f394e | Python | 5,259 | 180 | _base_ = [
'../../../../_base_/default_runtime.py',
'../../../../_base_/datasets/deepfashion_upper.py'
]
evaluation = dict(interval=10, metric='PCK', save_best='PCK')
optimizer = dict(
type='Adam',
lr=5e-4,
)
optimizer_config = dict(grad_clip=None)
# learning policy
lr_config = dict(
policy='step',... |
73b5331b1ef4edcceda767b05e8451f8cba64babb3b85c70772bfdd2e2d72e1d | Python | 5,259 | 180 | _base_ = [
'../../../../_base_/default_runtime.py',
'../../../../_base_/datasets/deepfashion_upper.py'
]
evaluation = dict(interval=10, metric='PCK', save_best='PCK')
optimizer = dict(
type='Adam',
lr=5e-4,
)
optimizer_config = dict(grad_clip=None)
# learning policy
lr_config = dict(
policy='step',... |
c30a85acc912493faebb86bd0e1e86440c9d46ca6cf32d476d8e500bdf5e4aa4 | Python | 5,262 | 175 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""Distributed process launcher.
This code is modified from https://github.com/pytorch/pytorch/blob/v1.3.0/torch/distributed/launch.py.
"""
import os
import subprocess
import sys
from argparse import REMAINDER, ArgumentParser
def parse_args():
"""Parse arguments."... |
74ab0153d3b90613a939fc235ee6db9f30055588c000affde62ca61bb473f970 | Python | 5,263 | 174 | _base_ = [
'../../../../_base_/default_runtime.py',
'../../../../_base_/datasets/onehand10k.py'
]
evaluation = dict(interval=10, metric=['PCK', 'AUC', 'EPE'], save_best='AUC')
optimizer = dict(
type='Adam',
lr=5e-4,
)
optimizer_config = dict(grad_clip=None)
# learning policy
lr_config = dict(
polic... |
10ff9a7115a3b7b22c8ef3e7d585a9380c2f158e38e66056ffec5d3d762855f5 | Python | 5,264 | 180 | _base_ = [
'../../../../_base_/default_runtime.py',
'../../../../_base_/datasets/deepfashion_full.py'
]
evaluation = dict(interval=10, metric='PCK', save_best='PCK')
optimizer = dict(
type='Adam',
lr=5e-4,
)
optimizer_config = dict(grad_clip=None)
# learning policy
lr_config = dict(
policy='step',
... |
38840fbe0b05560fc11a92394fdcbfd26aaa1d76ed60d2ed0b8fff460af9eacf | Python | 5,264 | 180 | _base_ = [
'../../../../_base_/default_runtime.py',
'../../../../_base_/datasets/deepfashion_full.py'
]
evaluation = dict(interval=10, metric='PCK', save_best='PCK')
optimizer = dict(
type='Adam',
lr=5e-4,
)
optimizer_config = dict(grad_clip=None)
# learning policy
lr_config = dict(
policy='step',
... |
edd53895b269c3bac8b7460e030f33b9bd744c047597fafa59c79f1dbb3ed4e3 | Python | 5,269 | 152 | import dataclasses
import typing
from dataclasses import dataclass
import numpy as np
from geotransformations import geo_to_pix
@dataclass(init=False, repr=False)
class Scope(object):
def __init__(self,
x_off: int,
y_off: int,
x_size: int,
y_s... |
4e81f07b528324b931e783c2afe3cfb70cad167d01d9d8b93a69bfe961b57083 | Python | 5,273 | 88 | import pandas as pd
import numpy as np
pd.set_option('display.max_columns', None)
pd.set_option('display.max_rows', None)
pd.set_option('display.expand_frame_repr', False)
# focus on Maize and Sorghum
crops = ['Maize', 'Sorghum']
seasons = ['Gu', 'Deyr']
for season in seasons:
print(season)
#READ HARVEST
... |
4d3019bdefb3f06da3e48ffb15e071dd7f9904f839004959ad15e3cabcf43137 | Python | 5,277 | 166 | # This file is part of sbi, a toolkit for simulation-based inference. sbi is licensed
# under the Apache License Version 2.0, see <https://www.apache.org/licenses/>
# pyright: reportIncompatibleMethodOverride=true
import math
from abc import ABC, abstractmethod
from typing import Callable, Optional, Type
import torc... |
dd6b9d01a33871f48cfdc64d0a21c8cfe05a5b2a42ef036ebbdce3a6e79a4262 | Python | 5,277 | 142 | from math import sin, cos, radians
class SubScreen:
"""
SubScreen of a Screen object
defined by physical screen dimensions and a viewport on the display device
pa, pb, pc as in: https://csc.lsu.edu/~kooima/articles/genperspective/index.html
i.e. pa is the lower-left corner of the screen, from the p... |
dffc1a63c2102fade72f4ae0e3555636fa3d7a02bb62ed3b4687be473fb62a21 | Python | 5,277 | 119 |
import plotly.express as px
from plotly.subplots import make_subplots
import plotly.graph_objects as go
import numpy as np
import scipy.spatial.distance as sd
from operations.alignment import calc_domainAveraged_FOSCTTM
from app_main.utilities import df_to_data
from app_main.constants import dataset_titles, marker_si... |
2924e6394b8ea331b66f77c3f19b232915d428b603c0286122c791817f8a6c19 | Python | 5,280 | 126 | import argparse
import h5py
import os
import PIL.Image
from shutil import rmtree
import numpy as np
import sys
sys.path.insert(0, os.path.abspath(os.path.join(os.getcwd(), "../../../")))
from fedml_api.Dist_FID import fid_score
def adjust_dynamic_range(data, drange_in, drange_out):
if drange_in != drange_out:
... |
6e5fb7fb1957ef01182aaac2fae6d96ae1fe7a727ac739772b0e0610e432c2cb | Python | 5,281 | 132 | import numpy as np
import pandas as pd
import os
from sklearn.metrics import mean_squared_error, r2_score, mean_absolute_error
from sklearn.cross_decomposition import PLSRegression
import matplotlib.pyplot as plt
from tensorflow.keras import datasets, layers, models
from tensorflow.keras.optimizers import Adam
from ten... |
988cdf3839aaf42d4b95ac6fba509297ea074252fab960ec7412f56d8198beca | Python | 5,281 | 174 | _base_ = [
'../../../../_base_/default_runtime.py',
'../../../../_base_/datasets/coco.py'
]
evaluation = dict(interval=10, metric='mAP', save_best='AP')
optimizer = dict(
type='Adam',
lr=5e-4,
)
optimizer_config = dict(grad_clip=None)
# learning policy
lr_config = dict(
policy='step',
warmup='l... |
e8bb0def5e1ccf1e3d41b00dc7109ec55eb4b05b8c863ddc8e36c2fd89b5d340 | Python | 5,289 | 135 | # -*- coding: utf-8 -*-
"""
Created on Fri Apr 10 13:39:17 2020
@author: nihao
"""
import os
import numpy as np
import codecs
import json
import glob
import cv2
import shutil
#from sklearn.model_selection import train_test_splitimport os
import numpy as np
import codecs
import json
import glob
import... |
2541c19e6768d221845cb9d7862d480e7a99cfbf9032515b35facdd7ba66c1eb | Python | 5,290 | 142 | import torch
import torch.nn as nn
from functools import partial
# from ldm.modules.x_transformer import Encoder, TransformerWrapper # TODO: can we directly rely on lucidrains code and simply add this as a reuirement? --> test
class AbstractEncoder(nn.Module):
def __init__(self):
super().__init__()
... |
4181fcea030e1ef52683cd3dd814b9f5bbace8d93b09cf45c262da09f98d46b3 | Python | 5,290 | 176 | _base_ = [
'../../../../_base_/default_runtime.py',
'../../../../_base_/datasets/coco.py'
]
evaluation = dict(interval=10, metric='mAP', save_best='AP')
optimizer = dict(
type='Adam',
lr=5e-4,
)
optimizer_config = dict(grad_clip=None)
# learning policy
lr_config = dict(
policy='step',
warmup='l... |
5e27df6f3710ff9e1ea9ddcad50da0da55c8a3f5902610e05dc30a3b011f2645 | Python | 5,290 | 176 | _base_ = [
'../../../../_base_/default_runtime.py',
'../../../../_base_/datasets/coco.py'
]
evaluation = dict(interval=10, metric='mAP', save_best='AP')
optimizer = dict(
type='Adam',
lr=5e-4,
)
optimizer_config = dict(grad_clip=None)
# learning policy
lr_config = dict(
policy='step',
warmup='l... |
67afa4b0d77b357fb8286ea67407ad0beb55104863ff83b1041b176554889abd | Python | 5,290 | 176 | _base_ = [
'../../../../_base_/default_runtime.py',
'../../../../_base_/datasets/coco.py'
]
evaluation = dict(interval=10, metric='mAP', save_best='AP')
optimizer = dict(
type='Adam',
lr=5e-4,
)
optimizer_config = dict(grad_clip=None)
# learning policy
lr_config = dict(
policy='step',
warmup='l... |
f5a4ddddc2f3faaacc211cc2f70bc6f31fcdd221136d6fee26eb381593b6f27e | Python | 5,290 | 176 | _base_ = [
'../../../../_base_/default_runtime.py',
'../../../../_base_/datasets/coco.py'
]
evaluation = dict(interval=10, metric='mAP', save_best='AP')
optimizer = dict(
type='Adam',
lr=5e-4,
)
optimizer_config = dict(grad_clip=None)
# learning policy
lr_config = dict(
policy='step',
warmup='l... |
1581a2c471bf02043b833f3c176ec32ff21c2ecc0e7a9eef6f5127ab7bb626ff | Python | 5,291 | 126 | import unittest
import json
import pathlib
import os
from PIL import Image
import random
import torchvision.transforms as T
import torch
import numpy as np
from .. import figure
from ..figures.scale.dataset import ScaleBarDataset
from ..figures.scale.engine import evaluate
from ..figures.scale.utils import collate_fn
... |
bfe327f6eb91dd3b0d350f09361e5652b47dcdee8b5bb21ec5c79a486cb33567 | Python | 5,292 | 117 | from .mmd_ma import *
import tensorflow.compat.v1 as tf
# Change: Adding compatibility for raw data
from scipy.spatial.distance import cdist
# 'Change:' comments are changes for this wrapper
def mmd_ma_helper(k1_matrix,
k2_matrix,
tradeoff2=.01,
tradeoff3=.001,
... |
b8e13aa18fec873abbcc5df63a74cbbaebb7bb23ea287022bf560c8d26c3cfff | Python | 5,294 | 149 | # Copyright (c) OpenMMLab. All rights reserved.
import mmcv
import numpy as np
import torch
from mmdet.models.dense_heads import LADHead, lad_head
from mmdet.models.dense_heads.lad_head import levels_to_images
def test_lad_head_loss():
"""Tests lad head loss when truth is empty and non-empty."""
class mock_... |
c2506647e26a4a73b474532f914f3759d2f49626a487523eb1098e13f3e02656 | Python | 5,294 | 179 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
# Copyright 2019 Tomoki Hayashi
# MIT License (https://opensource.org/licenses/MIT)
"""Decode text with trained VQ-VAE Generator or discrete symbol vocoder."""
import argparse
import logging
import os
import time
import soundfile as sf
import torch
import yaml
from tq... |
18552ba3ec63e006080a72562ac453da7b3ad17f77c44a10a3310add00d8af53 | Python | 5,300 | 105 | import pandas as pd
import numpy as np
import os
'''
Francesco extracts data for Gu and Deyr from Fews data (directly from Fews data Wearhouse, V:\foodsec\Projects\SNYF\stable_input_data\SO\FSNAU from Weston\FewsDW\SO_FDW_Jan28_2025.xlsx
and place it here
V:\foodsec\Projects\SNYF\stable_input_data\SO\Gu\Tuning_data\SO... |
89ada0a307a8a9122fc8b7e49a4074d9e461f7eb066e502b412793f8ff9eb954 | Python | 5,305 | 166 | import sys
sys.path.append('versatile_diffusion')
import os
import os.path as osp
import PIL
from PIL import Image
from pathlib import Path
import numpy as np
import numpy.random as npr
import torch
import torchvision.transforms as tvtrans
from lib.cfg_helper import model_cfg_bank
from lib.model_zoo import get_model
f... |
00bc7eaf71f699078fb5ce26c6326bcb8a683b04d6fc766bf25a5d1d343dde99 | Python | 5,311 | 136 | # -*- coding: utf-8 -*-
"""
Created on Thu Sep 06 19:42:24 2018
@author: StuffDeveloping
This analysis is for experiments trying to deconvolve a solution for a varying ITD &IAC
that was varied via an M-sequence
This code just does filtering, ocular artifact rejection, and decimates the EEG data.
"""
imp... |
e285825cddbffde1186d3c738b5dd3601ee4f34a4e392eadc532be96aaf62601 | Python | 5,316 | 134 | # Copyright (c) OpenMMLab. All rights reserved.
import numpy as np
import pytest
import torch
from mmdet.core import BboxOverlaps2D, bbox_overlaps
from mmdet.core.evaluation.bbox_overlaps import \
bbox_overlaps as recall_overlaps
def test_bbox_overlaps_2d(eps=1e-7):
def _construct_bbox(num_bbox=None):
... |
64f7a9698030cffdd4841148598d1f822191dfebe1872a2ff8e18bc5518821ad | Python | 5,319 | 129 | import numpy as np
import torch
def zscore_norm(data, eps: float = 1e-8, adjusted: bool = False):
"""Per-instance data z-score standardisation
"""
if np.iscomplexobj(data):
data.real = (data.real - np.mean(data.real)) / (np.std(data.real) + eps) # adjusted variance
data.imag = (data... |
70fb69ab21497113616ae61063819ef815c1b7cc4b1b77903e04e0d3b4792760 | Python | 5,321 | 120 | # Copyright (c) OpenMMLab. All rights reserved.
import torch
from mmcv.ops import batched_nms
from mmdet.core import (bbox2result, bbox2roi, bbox_mapping, merge_aug_bboxes,
multiclass_nms)
from mmdet.models.roi_heads.standard_roi_head import StandardRoIHead
from ..builder import HEADS
@HEADS.... |
e23dab0f7b8520822375214289cac070ce321156f252c15e4c8c2823465509d7 | Python | 5,325 | 187 | _base_ = [
'../../../../_base_/default_runtime.py',
'../../../../_base_/datasets/mhp.py'
]
checkpoint_config = dict(interval=50)
evaluation = dict(interval=50, metric='mAP', save_best='AP')
optimizer = dict(
type='Adam',
lr=0.005,
)
optimizer_config = dict(grad_clip=None)
# learning policy
lr_config = ... |
cb415c156bdc0843da916cd687e58b35cc7d7c997ed5c4d0176709ef17b0658f | Python | 5,328 | 110 | import os
import logging
import multiprocessing
import argparse
import numpy as np
import gensim.models
from gensim import utils
from gensim.corpora.wikicorpus import WikiCorpus
class SentencesCorpus:
"""An iterator that yields preprocessed sentences"""
def __init__(self, corpus_filename: str):
"""
... |
f9bb81599535b88708689efcf3fdad7638e0f3f0eca2a096a3c127c1943c32f5 | Python | 5,334 | 129 | import os, sys, math, pickle
import pandas as pd
root = os.path.dirname(os.getcwd())
db_file = root + "/data/vanwesten/si4_complete_dataset.txt"
cpds = root + "/data/vanwesten/vanwesten_tautomers.csv"
kinases = root + "/data/kinases.csv"
db_header = [ "Organism", "HGNC", "Mutation", "Is_Mutant", "HGNC_Mutant", "Com... |
226eea5220ca5e62154599989fa3c71327772fcbdf9505a8717719751d4c23ee | Python | 5,345 | 127 | # This file is part of sbi, a toolkit for simulation-based inference. sbi is licensed
# under the Apache License Version 2.0, see <https://www.apache.org/licenses/>
from typing import Dict, Optional, Union
import torch
from torch import Tensor
from torch.distributions import Distribution
from sbi.inference.posterior... |
dfe7eb9d0de30ca477e79300d999e115b93f620169f9900950c4d679a9353281 | Python | 5,351 | 155 | from torch.utils.data import Dataset
from weibull_mlp.utilities import read_csv_cox, retrieve_kfold_partition
from simple_mlps.datas import ParcellationDataVentricles, ParcellationDataVentriclesNacc
import random
import pandas as pd
import numpy as np
def prep_data(dataset='ADNI', csvname='./metadata/data_processed/... |
7f62c8f11323cbbe1dd1ddf91493aca3a57effc5caa2dc64045fccef4535bdf0 | Python | 5,353 | 175 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
# Copyright 2019 Tomoki Hayashi
# MIT License (https://opensource.org/licenses/MIT)
"""Decode text with trained VQ-VAE Generator or discrete symbol vocoder."""
import argparse
import logging
import os
import time
import soundfile as sf
import torch
import yaml
from tq... |
3c0a0aa99bb7a2ef1a656ad8384dd8b5e4be89f877ab8a728da30ec044a817e8 | Python | 5,354 | 154 | """
This script generates grid cell spikes, feeds them into pydentate to
generate granule cell spikes and saves both as time stamps.
This script is particularly designed to simulate a large number
of poisson seeds without exceeding memory.
"""
from pydentate import neuron_tools
from grid_model import grid_simulate
im... |
186e44976502ae62af69c383514630fd203141d623141ab15789c7df6087b04e | Python | 5,365 | 171 | _base_ = [
'../../../../_base_/default_runtime.py',
'../../../../_base_/datasets/panoptic_hand2d.py'
]
evaluation = dict(interval=10, metric=['PCKh', 'AUC', 'EPE'], save_best='AUC')
optimizer = dict(
type='Adam',
lr=5e-4,
)
optimizer_config = dict(grad_clip=None)
# learning policy
lr_config = dict(
... |
ed9364a762f58a0fc096fb7abb9124540d7f33296640790a4324e5a9937edabd | Python | 5,365 | 134 | # Copyright (c) OpenMMLab. All rights reserved.
import mmcv
import torch.nn as nn
import torch.nn.functional as F
from ..builder import LOSSES
from .utils import weight_reduce_loss
@mmcv.jit(derivate=True, coderize=True)
def varifocal_loss(pred,
target,
weight=None,
... |
b0c5201b36b39a4280bed9d61effa091ad9db56961a4e0165e6bfbc9a998814b | Python | 5,370 | 121 | # This file is part of sbi, a toolkit for simulation-based inference. sbi is licensed
# under the Apache License Version 2.0, see <https://www.apache.org/licenses/>
from typing import Callable, Optional, Tuple, Union
import numpy as np
import torch
from joblib import Parallel, delayed
from numpy import ndarray
from t... |
d2b7d21c3466a914fe273535ed49967fbf9ca9f478c037c4902643f794a68681 | Python | 5,372 | 138 | import pickle, os, sys
import pandas as pd
import numpy as np
from os import path
from rdkit import Chem
from rdkit.Chem import AllChem
from sklearn.ensemble import RandomForestRegressor
from sklearn.metrics import accuracy_score
from sklearn.metrics import mean_squared_error
from sklearn.preprocessing import... |
e85674b1ac48b9618a754366576dd748e7cabf9187ecc81183caf14ffb048cd6 | Python | 5,373 | 123 | # Configuration file for the Sphinx documentation builder.
#
# This file only contains a selection of the most common options. For a full
# list see the documentation:
# https://www.sphinx-doc.org/en/master/usage/configuration.html
# -- Path setup --------------------------------------------------------------
# If ex... |
d768be3821aa49699817d2a9a2d8177ecbea71eec0c9f0ccac10bf252f14b2a3 | Python | 5,374 | 152 | import pandas as pd
import numpy as np
import seaborn as sns
import os.path as path
import os
import sys
import tabulate
from simple_mlps.model_ibs.ibs import retrieve_brier_scores, make_struc_array
from sksurv.metrics import concordance_index_censored
DATA_DIR = "/data2/MRI_PET_DATA/predicts/"
def filter_and_dump_a... |
af0802833438b390c0fe6350d8236e5941399ce150e94fc62eb8d343d0dfdecb | Python | 5,376 | 179 | _base_ = [
'../../../../_base_/default_runtime.py',
'../../../../_base_/datasets/coco.py'
]
evaluation = dict(interval=10, metric='mAP', save_best='AP')
optimizer = dict(
type='Adam',
lr=5e-4,
)
optimizer_config = dict(grad_clip=None)
# learning policy
lr_config = dict(
policy='step',
warmup='l... |
a9b9c8da5d2f3a5d7b0c8b677a8dbff9eff4f559637dc2039183254b74b21139 | Python | 5,381 | 129 | import numpy as np
from torch.utils.data import DataLoader
from torch.utils.data.dataloader import default_collate
from torch.utils.data.sampler import SubsetRandomSampler
from data_loader import nuclei_transforms as my_transforms
from dataset.nuclei_dataset import NucleiTrainDataset, NucleiTestDataset
class NucleiDa... |
de7ee896ed15dbdf501946df8f8516155e7c5f2529b01d81082bb62571a55c22 | Python | 5,382 | 153 | # Copyright (c) OpenMMLab. All rights reserved.
import torch
from mmdet.utils import util_mixins
class SamplingResult(util_mixins.NiceRepr):
"""Bbox sampling result.
Example:
>>> # xdoctest: +IGNORE_WANT
>>> from mmdet.core.bbox.samplers.sampling_result import * # NOQA
>>> self = Sa... |
44e5684c3ccbeea26e4fb87d457576cf01a131afb0f746057608f2969405e09f | Python | 5,384 | 148 | # Copyright (c) OpenMMLab. All rights reserved.
import math
import numpy as np
import torch
from mmcv.runner import get_dist_info
from torch.utils.data import Sampler
class GroupSampler(Sampler):
def __init__(self, dataset, samples_per_gpu=1):
assert hasattr(dataset, 'flag')
self.dataset = datas... |
9c08d2b36c81d888456bd5c1f6d6f4cdd25066379a068d53ace8b4c0c4bea49c | Python | 5,387 | 155 | # based on conv_qsar_fast by Connor Coley
import os
import time
import json
import logging
import numpy as np
from sklearn.metrics import roc_auc_score, roc_curve, mean_squared_error, mean_absolute_error
from .graphconv import predict
import matplotlib
matplotlib.use('Agg')
import matplotlib.pyplot as plt
import trace... |
f20d8e30a970ceac2d7be6eed249d5b4d99418bef548532f71389aa2d19a7e3a | Python | 5,387 | 159 | # This file is part of sbi, a toolkit for simulation-based inference. sbi is licensed
# under the Apache License Version 2.0, see <https://www.apache.org/licenses/>
"""Supporting types for the Builder pattern: configuration, data-derived state,
and z-score computation.
``ZScoreConfig`` captures the user's preprocessi... |
eb37259acb13d5f7964eaa4ce4a817f8221674bd8ca0cc58fef7238fe37411e8 | Python | 5,388 | 109 | import os
from functools import partial
from typing import Union
import torch
from sklearn.model_selection import KFold
from torch.utils.data import DataLoader, Subset, random_split
from selbstaufsicht.datasets import CoCoNetDataset
from selbstaufsicht.datasets.rna_ts_label import challData_lab
from selbstaufsicht.ut... |
d7761a8f72f1d7db42a6cfd233f90536198d37445035ec7610c33a56646829bc | Python | 5,389 | 180 | import pytest
import pytest_mock
from pathlib import Path
import numpy as np
from Bio import AlignIO
from Bio import SeqIO
from Bio.Seq import Seq
from Bio.SeqRecord import SeqRecord
from Bio.Align import MultipleSeqAlignment
from clipkit.smart_gap_helper import (
smart_gap_threshold_determination,
greatest_... |
37a75e254e12818981e9ca9149d271659e5dba5c2abbafcd9d4a21da6722e4db | Python | 5,390 | 171 | _base_ = [
'../../../../_base_/default_runtime.py',
'../../../../_base_/datasets/panoptic_hand2d.py'
]
evaluation = dict(interval=10, metric=['PCKh', 'AUC', 'EPE'], save_best='AUC')
optimizer = dict(
type='Adam',
lr=5e-4,
)
optimizer_config = dict(grad_clip=None)
# learning policy
lr_config = dict(
... |
11c04bc8c15dd580b6d95be8de3ae3df3001cfbd898d62717f9fe68b933ab85c | Python | 5,395 | 110 | from datetime import datetime
from typing import Optional, Iterable
import neo
from pydapsys.file import File
from pydapsys.neo_converters.helper import DapsysToNeoHelper
from pydapsys.neo_converters.interface import INeoConverter
from pydapsys.toc.entry import Folder, Stream, StreamType
class NIPulseStimRecordingC... |
1016f6e7524aaae77eed6c4693a13f7abf8c2add370628923b16dfdb3f7ac64f | Python | 5,396 | 189 | _base_ = [
'../../../../_base_/default_runtime.py',
'../../../../_base_/datasets/coco.py'
]
checkpoint_config = dict(interval=50)
evaluation = dict(interval=50, metric='mAP', save_best='AP')
optimizer = dict(
type='Adam',
lr=0.0015,
)
optimizer_config = dict(grad_clip=None)
# learning policy
lr_config ... |
eee0f8fde267b44bf9a93e8041a020e3a7f81172b2e5ac78f6b57062aaa73a05 | Python | 5,396 | 157 | #!/usr/bin/env ipython
import shelve
from pathlib import Path
import datetime
import pandas as pd
import numpy as np
from sklearn.metrics import make_scorer, roc_auc_score
from eegml import featureengineering as fe
from eegml import model as mod
from eegml import toolkit as tk
config = tk.parse_config("config.yaml")... |
16e3c37b86a316d57fb08498a2f53c32436fbadd88a01d07b444529ee95df86d | Python | 5,397 | 189 | _base_ = [
'../../../../_base_/default_runtime.py',
'../../../../_base_/datasets/coco.py'
]
checkpoint_config = dict(interval=50)
evaluation = dict(interval=50, metric='mAP', save_best='AP')
optimizer = dict(
type='Adam',
lr=0.0015,
)
optimizer_config = dict(grad_clip=None)
# learning policy
lr_config ... |
8c8a1aea84ab864ffc0f0adb65ae8ac28f12141451c34f3096483aefbbcec70d | Python | 5,397 | 189 | _base_ = [
'../../../../_base_/default_runtime.py',
'../../../../_base_/datasets/coco.py'
]
checkpoint_config = dict(interval=50)
evaluation = dict(interval=50, metric='mAP', save_best='AP')
optimizer = dict(
type='Adam',
lr=0.0015,
)
optimizer_config = dict(grad_clip=None)
# learning policy
lr_config ... |
93715d5e6a0644bfc29bc7562f45ba385b9bb7f73d855034ebfbac1ba466313d | Python | 5,397 | 217 | import itk
import numpy as np
def bounded_region(ref_img, r):
'''
Returns a region that is the intersection between r and ref_img.GetLargestPossibleRegion()
Parameters
----------
ref_img : itk.Image
r : itk.ImageRegion
Returns
-------
itk.ImageRegion
'''
r2 = ref_img.GetLa... |
d79de19595280f352a84dd5a94898d89496bb0e4a375b8c7ddaedfbf72669318 | Python | 5,397 | 189 | _base_ = [
'../../../../_base_/default_runtime.py',
'../../../../_base_/datasets/coco.py'
]
checkpoint_config = dict(interval=50)
evaluation = dict(interval=50, metric='mAP', save_best='AP')
optimizer = dict(
type='Adam',
lr=0.0015,
)
optimizer_config = dict(grad_clip=None)
# learning policy
lr_config ... |
b7c1010653e5545daccc0cb510e63b77e8e7c8f2e1f08390668c2cf060c340d4 | Python | 5,401 | 139 | # Copyright (c) OpenMMLab. All rights reserved.
import time
from typing import List, Union
from mmpose.utils.timer import RunningAverage
from ..node import Node
from ..registry import NODES
@NODES.register_module()
class ObjectAssignerNode(Node):
"""Assign the object information to the frame message.
:class... |
2dadf8c8e9c6b608c7d7cdb53baabc6a1353359f66e992763a569063163dce21 | Python | 5,403 | 138 | # Copyright Universitat Pompeu Fabra 2020-2023 https://www.compscience.org
# Distributed under the MIT License.
# (See accompanying file README.md file or copy at http://opensource.org/licenses/MIT)
import hashlib
from torchmdnet.utils import ATOMIC_NUMBERS
import numpy as np
import os
import torch as pt
from torchmd... |
57632721cd8e090a18c311f6527f1eae02b6f53901d82fdb02f1c2f9b21c14bd | Python | 5,408 | 113 | # Author: Fabi Prezja <faprezja@fairn.fi>
# Copyright (C) 2023 Fabi Prezja
# License: MIT License (see LICENSE.txt for details)
import tensorflow as tf
from tensorflow.keras.layers import Flatten, GlobalAveragePooling2D, BatchNormalization, Dense, Dropout
from tensorflow.keras.regularizers import l1, l2
from tensorflo... |
cc1a377b43bc93b5633d8f66689d500f33b688abb6677b555b283fe6046b9418 | Python | 5,408 | 181 | from multiprocessing import Pool
from os.path import join
from subprocess import run
from h5py import File
from consts import ATOM2SYM, MAX_ANGULAR_MOMENTUM
from util import path_check
def dftb_calc(opts):
r"""Run DFTB+ calculations in parallel
Args:
opts (dict): options
Returns:
None
... |
1f56d9562224b0fb129176d22d33dc9dede53fd61959a60365fd73887b46aabd | Python | 5,409 | 118 | import torch
from torch.utils.data import DataLoader, TensorDataset
import multiprocessing
import pandas as pd
import copy
import numpy as np
class DatasetReader(torch.utils.data.Dataset):
def __init__(self, data_dict, reverse = False, data_type = 'distribute', maxlength_seq = 192, device='cpu'):
super()._... |
823b6da0539571977b03f5f228f50eeed5ef1b556fde5fbe1085e4f821d3ff5a | Python | 5,409 | 165 | # Copyright Universitat Pompeu Fabra 2020-2023 https://www.compscience.org
# Distributed under the MIT License.
# (See accompanying file README.md file or copy at http://opensource.org/licenses/MIT)
"""
Benchmark script for inference.
This script compiles a model using torch.compile and measures the time it takes to ... |
8080a510696f507462f6eb690ef73824d34833754aed60e80b1391e3f35406d4 | Python | 5,419 | 178 | import torch
import torch.nn as nn
import torch.nn.functional as F
import torch.optim as optim
from torch.autograd import Variable
from torch.nn.parameter import Parameter
import math
import utils
import argparse
import data_loader
from ipdb import set_trace
from sklearn import metrics
SEQ_LEN = 48
def binary_cros... |
85c0d0b33c9fa50edf6a910ad7708966f7248f8732676d0fefdd360f82b3197b | Python | 5,421 | 149 | import p4.func
from p4.p4exceptions import P4Error
class Constraints(object):
"""A container for tree topology constraints.
Constraints are defined with a partially-resolved tree. We can
then use a constraints object to ask whether a query tree has
those constraints. In addition a constrained root... |
8ca8d3fcb7f5dffd25fed5829ed80120c5b2fc61f1960e0e56e84924b074a4f1 | Python | 5,427 | 141 | #!/usr/bin/env python
from __future__ import print_function
from __future__ import division
"""
filterFreebayes.py
Applies BCBIO developed filters to the freebayes somatic output.
2 main filters applied:
1. LOD Tumor, LOD Normal > 3.5
2. Freq of Tumor / Freq Normal > 2.7
"""
import argparse
import sys
CHROM_INDEX =... |
8e80bbbb947d400775249ba3d8b1ea28607512bde485bacbe0570dc1c8ca4756 | Python | 5,428 | 170 | import sys
sys.path.append('versatile_diffusion')
import os
import os.path as osp
import PIL
from PIL import Image
from pathlib import Path
import numpy as np
import numpy.random as npr
import torch
import torchvision.transforms as tvtrans
from lib.cfg_helper import model_cfg_bank
from lib.model_zoo import get_model
f... |
eaf6e39cb3d98cb53a8d207e9da4c6e75221645a6a055e5f09c37d82623a2936 | Python | 5,431 | 140 | # Copyright (c) OpenMMLab. All rights reserved.
# Copyright (c) 2019 Western Digital Corporation or its affiliates.
import torch
import torch.nn.functional as F
from mmcv.cnn import ConvModule
from mmcv.runner import BaseModule
from ..builder import NECKS
class DetectionBlock(BaseModule):
"""Detection block in ... |
22fdb602565c006616fcd3d5e9244701ddd40355fa3abea2e5b7695e6b26a6a9 | Python | 5,432 | 169 | from __future__ import print_function
from __future__ import absolute_import
import numpy as np
from keras.models import Model
from keras.layers import Input
from keras.layers import Lambda
from keras.layers import Reshape
from keras.layers import Conv2D
from keras.layers import Activation
from keras.lay... |
589a40f44a71d367a97df9fc0dcd19d3898166c2cf0814caaf4c2bd309d51442 | Python | 5,433 | 161 | """
TAKEN FROM: https://github.com/syrte/ndtest
Using a 2D KS test, implemented in python with the "ndtest" package (https://github.com/syrte/ndtest), which is based off methods in Peacock (1983) and Fasano & Franceschini (1987).
"""
from __future__ import division
import numpy as np
from numpy import random
from sci... |
8f86c22b62334a4670033fd7b86333833e0bb7a4e17bd4ad23a12e0ed5ba572d | Python | 5,434 | 127 | from pydentate import net_tunedrev, neuron_tools
from grid_model import grid_simulate
import shelve
import time
import numpy as np
import scipy.stats as stats
import copy
start = time.time()
"""Setup"""
neuron_tools.load_compiled_mechanisms(path='/home/baris/pydentate/mechs/x86_64/libnrnmech.so')
"""Parameters"""
g... |
91b85d7345ee91b6acab18c0e875fd619bec143aaa074fd3518bf6376ee834ba | Python | 5,438 | 170 | import requests
import json
import utils
# Testing API key
api_key = 's4624iv14eij'
key_secret = 'd0ifs7vd3m80pa1'
endpoint = "https://kconnect-kb.s4.ontotext.com/v1/sparql"
lld_sparql_json_api = 'http://linkedlifedata.com/sparql.json'
lld_autocomplete_api = 'http://linkedlifedata.com/autocomplete.json?q={term}&type=... |
c2bd249f799e4c9cee1b324ba4327ed2ed756e4ea3f94f2b3dd466ec5c3c4a00 | Python | 5,443 | 144 | # Copyright (c) OpenMMLab. All rights reserved.
import bisect
import math
from collections import defaultdict
from unittest.mock import MagicMock
import numpy as np
import pytest
from mmdet.datasets import (ClassBalancedDataset, ConcatDataset, CustomDataset,
MultiImageMixDataset, RepeatDat... |
17e766c8347689cf9869b043bd30db6cc2002ae331d7f551bf5eeb88fdde958e | Python | 5,446 | 149 | import os
import random
from PIL import Image
import torch.utils.data as data
from tifffile import imread
import cv2
import numpy as np
#
def image_norm(img):
if len(img.shape) == 2:
imgmax = img.max()
imgmin = img.min()
imgnew = (img - imgmin) / (imgmax - imgmin)
else:
imgnew =... |
9aa0164f650c24d1321bd76a355028c15c5e02161f99ce78948bbe85240fbd46 | Python | 5,449 | 187 | # Copyright (c) OpenMMLab. All rights reserved.
import pytest
import torch
from mmpose.models.backbones.hrformer import (HRFomerModule, HRFormer,
HRFormerBlock)
def test_hrformer_module():
norm_cfg = dict(type='BN')
block = HRFormerBlock
# Test multiscale for... |
174711d968974c00ce9de4899b9fa73ec74ae5dc372a4ea323bbdb145ee120d3 | Python | 5,454 | 182 | _base_ = [
'../../../../_base_/default_runtime.py',
'../../../../_base_/datasets/coco.py'
]
evaluation = dict(interval=10, metric='mAP', save_best='AP')
optimizer = dict(
type='Adam',
lr=5e-4,
)
optimizer_config = dict(grad_clip=None)
# learning policy
lr_config = dict(
policy='step',
warmup='l... |
c3692fb00afe9ce1f58dffb85b130f81096782ce803748700c213c456e449824 | Python | 5,454 | 148 | import os.path
import h5py
from PIL import Image
from data.base_dataset import BaseDataset, get_params, get_transform
class NucleiDataset(BaseDataset):
"""A dataset class for paired image dataset.
It assumes that the directory '/path/to/data/train' contains image pairs in the form of {A,B}.
During test... |
4ec889488005a3e57c6a95c7ffbacc9da7fc21ccd7f9762bcea4a5e1e098c0b9 | Python | 5,460 | 168 | # This file is part of sbi, a toolkit for simulation-based inference. sbi is licensed
# under the Apache License Version 2.0, see <https://www.apache.org/licenses/>
import sys
import pytest
import torch
from torch import eye, ones, zeros
from torch.distributions import (
Categorical,
Exponential,
Independ... |
1c36755f4cd91a4462ea80ea20ffa4c912ca3e2891204e822a6ccf6c08c3b6cd | Python | 5,464 | 169 | import argparse
import os
import pandas as pd
import numpy as np
from sklearn.model_selection import train_test_split
parser = argparse.ArgumentParser(description='Splits data into train/eval', formatter_class=argparse.ArgumentDefaultsHelpFormatter)
parser.add_argument('--csv', type=str, help='CSV file', required=Tr... |
39372195639167e83a30bc0e52a5d71e7a685799bf4c9973d88a4be5227e7fa3 | Python | 5,465 | 102 | """Optional ConvSV finish kernel: layouts, derivatives and fallback contracts."""
import math
import pytest
import torch
pytest.importorskip("triton")
from aimnet.kernels.conv_finish_triton import _reference, conv_finish
@pytest.mark.parametrize("trainable_weights", [False, True])
@pytest.mark.parametrize("masked... |
24b83ce41198923007d7a3b10ae159399320f055ce306fd6d66cb25d49b98c5d | Python | 5,469 | 183 | from typing import Annotated, Literal
from pydantic import BaseModel, ConfigDict, Field, NonNegativeInt, PositiveInt, model_validator
from typing_extensions import Self
from oligo_designer_toolsuite.config._general_models import HomopolymericRunThreshold
from oligo_designer_toolsuite.config._types import (
DRNAT,... |
fd55aa80c6e7816ca7848e504cfad2d2ea5c97f57fa02e6361f312bbf3008041 | Python | 5,471 | 170 | # -*- coding: utf-8 -*-
# Copyright 2019 Tomoki Hayashi
# MIT License (https://opensource.org/licenses/MIT)
"""STFT-based Loss modules."""
from distutils.version import LooseVersion
import torch
import torch.nn.functional as F
is_pytorch_17plus = LooseVersion(torch.__version__) >= LooseVersion("1.7")
def stft(x... |
91de76d70f36dd4ac69a1bae290517d423ee8aa9033f5ece16d806d2876e05ec | Python | 5,474 | 117 | # Copyright (c) OpenMMLab. All rights reserved.
import mmcv
def wider_face_classes():
return ['face']
def voc_classes():
return [
'aeroplane', 'bicycle', 'bird', 'boat', 'bottle', 'bus', 'car', 'cat',
'chair', 'cow', 'diningtable', 'dog', 'horse', 'motorbike', 'person',
'pottedplant'... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.