sha256 stringlengths 64 64 | language stringclasses 28
values | size int32 1 491k | lines int32 1 23.2k | content stringlengths 1 200k |
|---|---|---|---|---|
c029de585d77f53505a4eda5a9387365fa3e164ca492659f168c794a98556a86 | Python | 5,474 | 140 | """
Created on Tue Mar 1 13:33:57 2022
@author: oliver braganza
"""
import pandas as pd
import os
import shelve
import numpy as np
import matplotlib as mpl
import matplotlib.pyplot as plt
import pickle
mpl.rcParams['pdf.fonttype'] = 42
mpl.rcParams['ps.fonttype'] = 42
from load_spikes_olli2 import load_data
from ... |
18c8671d51cec32c2255b8b3b522fe2fe8205bf96c463723f119e04bf9c41928 | Python | 5,475 | 151 | import ete3
import numpy as np
import pandas as pd
import argparse
# argument parser
arp = argparse.ArgumentParser()
# Add the arguments to the parser
arp.add_argument("-t", "--tree", required=True, help="newick file with species tree")
arp.add_argument("-i", "--in", required=True, ... |
a06e5a382f55428ec369df0fc42e60f81a144977bbbcbb6c1f111a74e7635538 | Python | 5,481 | 143 | # Copyright (c) OpenMMLab. All rights reserved.
import argparse
import mmcv
from mmcv import Config, DictAction
from mmcv.parallel import MMDataParallel
from mmdet.apis import single_gpu_test
from mmdet.datasets import (build_dataloader, build_dataset,
replace_ImageToTensor)
def parse_ar... |
b249beff6f602a4f8c1951f733c2d5fe32059517115baad718f11244ad94c5d7 | Python | 5,487 | 167 | # Copyright (c) OpenMMLab. All rights reserved.
import numpy as np
import pytest
import torch
from mmpose.models.detectors import DisentangledKeypointRegressor
def test_dekr_forward():
model_cfg = dict(
type='DisentangledKeypointRegressor',
pretrained=None,
backbone=dict(
type... |
019fe18331f96cb90d254bc72a178b92509d787877822eff35ec1837ec3981ce | Python | 5,489 | 191 | _base_ = [
'../../../../_base_/default_runtime.py',
'../../../../_base_/datasets/coco_wholebody.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
... |
6d21e5f28541b04ca7d246a5576078a0acfa0d11b8420187ac6f78d92c56bf30 | Python | 5,489 | 209 | """mobilenet in pytorch
[1] Andrew G. Howard, Menglong Zhu, Bo Chen, Dmitry Kalenichenko, Weijun Wang, Tobias Weyand, Marco Andreetto, Hartwig Adam
MobileNets: Efficient Convolutional Neural Networks for Mobile Vision Applications
https://arxiv.org/abs/1704.04861
"""
import logging
import torch.nn as nn
... |
0921169b0dfafb7670ae56c3c880ffe348fed434e35dce822c37b228bdc9a8e7 | Python | 5,490 | 191 | _base_ = [
'../../../../_base_/default_runtime.py',
'../../../../_base_/datasets/coco_wholebody.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
... |
4699dddc60f5778e7c5b8abf7eb1d6d58b83d6a74c10d0b36c365ced2bada18b | Python | 5,490 | 133 | # Copyright (c) OpenMMLab. All rights reserved.
import pytest
import torch
import torch.nn as nn
from mmcv.runner import DefaultOptimizerConstructor
from mmpose.core import (OPTIMIZER_BUILDERS, build_optimizer_constructor,
build_optimizers)
class ExampleModel(nn.Module):
def __init__(se... |
6968966f651926f4a99a52bf20600cc259db409f0dd8c5ce172fbea89b9667e0 | Python | 5,490 | 191 | _base_ = [
'../../../../_base_/default_runtime.py',
'../../../../_base_/datasets/coco_wholebody.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
... |
c5a9f5d27474655cf552de83d37bc9e44b1e5da299c90d7a2eedaaa0a15bbeec | Python | 5,490 | 191 | _base_ = [
'../../../../_base_/default_runtime.py',
'../../../../_base_/datasets/coco_wholebody.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
... |
2a9fc51316dc807d5eec556b87ba8aac31d2c7dfa140a7c8c1b807d52a6ae1ff | Python | 5,491 | 170 | # Copyright (c) OpenMMLab. All rights reserved.
import argparse
import os.path as osp
import time
from datetime import datetime
import mmcv
import numpy as np
import torch
from mmcv import Config
from mmcv.cnn import fuse_conv_bn
from mmcv.runner import IterLoader
from mmcv.runner.fp16_utils import wrap_fp16_model
fr... |
9f75961cf676808e571203d0dcf9d0f4f033fde1a914fb4e64975158b0da64a3 | Python | 5,495 | 153 | #!usr/bin/env python
#coding:utf-8
"""
@author: Haidong Zhang
@contact: haidong_zhang14@yahoo.com
@time: 2021/1/10 8:58
@project: MalariaDetection
@description:
"""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import argparse
import os
... |
65e07562c5c453e357d368c4554f8224826b4192ebb9fa78706cd956ef2bde49 | Python | 5,496 | 167 | # -*- coding: utf-8 -*-
"""
Created on Mon Nov 1 21:45:58 2021
@author: fhu14
"""
"""
A test for regular expression parsing of charges and dipoles
"""
#%% Imports, definitions
import os
import pickle
import re
from copy import deepcopy
import numpy as np
from Auorg_1_1 import ParDict
from DFTBPlus import add_dftb
f... |
ec7e9953096fe4f23ccead69769db75a85f1e60974211235660d6cb95bf6f182 | Python | 5,497 | 193 | _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 ... |
0413f6939046f2d7cd8f95e6c08b51016af9a8c67bb3de460f9068390815b3eb | Python | 5,498 | 193 | _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 ... |
5b6cc6cb51b425d92127d1b83a96c2a0cd80ee1fa2c4bb76ceffb9ee73c24b38 | Python | 5,498 | 193 | _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 ... |
e0885bc8fc64063b83551963296ccc5415f6afbf11ec5a09e042e96dfda4a4fc | Python | 5,498 | 193 | _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 ... |
fd256be98ba14470250c8b0f00fc5880adec15059d7802ada72add438a2ad0d6 | Python | 5,503 | 188 | # -*- coding: utf-8 -*-
"""
This file is part of the cerebellar-task-dependent repository (Xie et al. 2023)
Copyright (C) 2023 Marjorie Xie and Ashok Litwin-Kumar
See README for more information
Library which includes functions for computing the kernel of a ReLU network
analytically and also the generalization error.... |
ca1f44880be91696fe32eab09607da29df823cfc42f1ef53aa0b09dc15fbaaad | Python | 5,508 | 142 | #!usr/bin/env python
#coding:utf-8
"""
@author: Haidong Zhang
@contact: haidong_zhang14@yahoo.com
@time: 2021/1/17 1:34
@project: MalariaDetection
@description: https://github.com/Wanke15/HAN-keras/blob/master/HAN-keras.ipynb
"""
import keras
from keras import backend as K
from keras import initializers
... |
c0f8a8ecb9f68e270ec4d8007ea19a4be91d7a96c16148aaf164358c2a400f47 | Python | 5,517 | 113 | import argparse
import math
import os
import pandas as pd
import numpy as np
import torch
from nets.classification import CleftNet, CleftSegNet
from loaders.cleft_dataset import CleftDataModule, CleftSegDataModule
from transforms.volumetric import CleftTrainTransforms, CleftEvalTransforms, CleftSegTrainTransforms, ... |
cf40a46fd422551a5ccfcf1a0352c3e3886023a1e16314e6d3a3e32623327ce7 | Python | 5,520 | 153 | # Copyright (c) OpenMMLab. All rights reserved.
from itertools import zip_longest
from typing import Dict, List, Optional, Union
import numpy as np
from ...utils import get_config_path
from ..node import Node
from ..registry import NODES
try:
from mmdet.apis import inference_detector, init_detector
has_mmdet... |
ab4e495f54be2323d2b3d753dd3d6fa2ef8ba84d5cb793fd5a0419f43b72a8e6 | Python | 5,523 | 155 | # Copyright (c) OpenMMLab. All rights reserved.
import itertools
import torch
import torch.nn as nn
from mmcv.cnn import xavier_init
from ..builder import HEADS
@HEADS.register_module()
class MultiModalSSAHead(nn.Module):
"""Sparial-temporal Semantic Alignment Head proposed in "Improving the
performance of ... |
23d3bf9c069c64b955f7c5dfd2ade36cb0f249e26b2268f0c00039db557035df | Python | 5,530 | 143 | import networkx as nx
import numpy as np
class TopologyManager:
def __init__(self, n, b_symmetric, undirected_neighbor_num=5, out_directed_neighbor=5):
self.n = n
self.b_symmetric = b_symmetric
self.undirected_neighbor_num = undirected_neighbor_num
self.out_directed_neighbor = out... |
6378cd2c7254a31d14d5a6dabfb7ddcd6024daa253a8e8351768af5fc0ffe86b | Python | 5,532 | 125 | # test_dit_simple.py
# This file compares admUI with the algorithm implemented in dit
# on some simple distributions.
#
# Distributed under the terms of the GNU General Public License v3
from __future__ import print_function
import dit
import time
from admUI import computeQUI
# Examples with probability distributions... |
16e2b299bd6616e4ff3769d9908dd33b824529bd54202fbe5ce1e1ef4e98aa53 | Python | 5,537 | 154 | # -*- coding: utf-8 -*-
"""
Created on Fri Sep 4 11:49:01 2020
@author: CS
"""
import cv2
import numpy as np
from skimage import transform as trans
def Match_based_flann_knnMatch(des_fix, des_mov, ratio = 0.8):
######
###
#
FLANN_INDEX_KDTREE = 1
index_params = dict(algorithm = FLANN_INDEX_KDTR... |
1bfbb64f186a00242a72bd97f873b4fae4e3e642a9dfe7312603217719248dd6 | Python | 5,547 | 160 | """Warp kernel for cell-list based neighbor list computation.
Uses a 1-thread-per-atom approach: each thread determines its cell, iterates
over 27 neighbor cells, and checks all atoms within each neighbor cell.
Supports orthogonal PBC (diagonal box) only.
"""
import warp as wp
from .utils import add_module, get_wp_f... |
dc07d9b1e07df4f2ea379a025dfea6169b74bc03f3964b11a6b196b47d27c969 | Python | 5,547 | 142 | from __future__ import print_function
import os
import argparse
import torch
import numpy as np
from torch.optim import Adam, lr_scheduler
from torch.nn import functional as F
import data
import utils
import metrics
import config_bayesian as cfg
from models.BayesianModels.Bayesian3Conv3FC import BBB3Conv3FC
from mod... |
5fe045762276034c0418da625f30337744e31b8f567d995c160b42a10e67279c | Python | 5,551 | 105 | # Generated by Django 3.1.6 on 2021-03-19 17:14
import django.contrib.postgres.fields
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
dependencies = [
]
operations = [
migrations.CreateModel(
name='... |
6da0a72f3dfa45154657985637a954deacd5a44b82beb1792596044f785af2cf | Python | 5,552 | 140 | import abc
import argparse
import os
import pickle
import typing
import pandas as pd
import sklearn
import models.abstract
from models.abstract import ModelClassMetaData, ReportOptions, EvaluateResults, FitResults
class SklearnModelMeta(models.abstract.AbstractModelMeta):
@property
def model_class_meta_data... |
1b7457c386a0618bbdd46d0aa2fd1dcc56cb3b56c276e36a9afc6a9cf14d254e | Python | 5,553 | 145 | # This file contains experimental modules
import numpy as np
import torch
import torch.nn as nn
from models.common import Conv, DWConv
from utils.google_utils import attempt_download
class CrossConv(nn.Module):
# Cross Convolution Downsample
def __init__(self, c1, c2, k=3, s=1, g=1, e=1.0, shortcut=False):
... |
6db518162518c1b6c6757bd38300e637eff7b728298f1abcd2144add1e144281 | Python | 5,554 | 170 | # Copyright (c) OpenMMLab. All rights reserved.
import copy
import tempfile
from unittest.mock import MagicMock
import pytest
from numpy.testing import assert_almost_equal
from mmpose.datasets import DATASETS
from tests.utils.data_utils import convert_db_to_output
def test_face_300W_dataset_compatibility():
dat... |
f3b048c6b40ac85a582880021ab298139e682097b79b6411acfe63503c7a795e | Python | 5,554 | 146 | """Sing generator."""
import numpy as np
import torch
class SineGen(torch.nn.Module):
"""Definition of sine generator."""
def __init__(
self,
samp_rate,
harmonic_num=0,
sine_amp=0.1,
noise_std=0.003,
voiced_threshold=0,
flag_for_pulse=False,
):
... |
95ae3481165769f55b1aab8b51ead714d5206a79bec7570b2e59866d00d76c73 | Python | 5,555 | 178 | _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(
... |
d1f52c6dff5ce019c163cb4f73ca3a5f29f9a0cf54b1aa8c54cd9396f44dd73f | Python | 5,556 | 135 | # Copyright (c) OpenMMLab. All rights reserved.
import torch
from ..builder import BBOX_ASSIGNERS
from ..iou_calculators import build_iou_calculator
from ..transforms import bbox_xyxy_to_cxcywh
from .assign_result import AssignResult
from .base_assigner import BaseAssigner
@BBOX_ASSIGNERS.register_module()
class Uni... |
17d2b3f1f460e80563d451b957d80515d32e4c693c495e6cb08e5766d290b8d0 | Python | 5,561 | 161 | # __author__ = haitham elmarakeby
# from file_browser_testing import get_models
from os.path import join, exists
from config_path import TEST_RESULTS_PATH, PLOTS_PATH
from os import listdir
import pandas as pd
import numpy as np
from sklearn.metrics import *
# from utils.evaluate import evalualte
from paper_analysis_re... |
1025cb64c79bad8f8bf5cc45cb74001359fb38ee13e3b2b49a6cf2e33a20131a | Python | 5,562 | 171 | # 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 logging
import pyro
import torch
from pyro import distributions as pdist
from torch import Tensor
SIM_PARAMS = {
"mixture_locs_factor": [1.0... |
28b770bd8d895054c45b41389b17aa40b2543f4c0412abbfa938a0b6f4438527 | Python | 5,564 | 191 | _base_ = [
'../../../../_base_/default_runtime.py',
'../../../../_base_/datasets/aic.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 =... |
d5b4a367e520e570ba194edd85361cc395f8085bc012b6f0f66e948ebdad1f28 | Python | 5,570 | 152 | #!usr/bin/env python
#coding:utf-8
"""
@author: Haidong Zhang
@contact: haidong_zhang14@yahoo.com
@time: 2021/1/10 8:58
@project: MalariaDetection
@description:
"""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import argparse
import os
... |
7942c752ed60bc146c704ab57556db83c455ce3197da10ed5fc1c88704e9dfc0 | Python | 5,574 | 98 | #!/usr/bin/env python3
# Author: Francois Aguet
import argparse
import numpy as np
import pandas as pd
import os
import gzip
from datetime import datetime
import subprocess
import io
parser = argparse.ArgumentParser(description='Filter significant SNP-gene pairs from FastQTL results using FDR cutoff')
parser.add_argu... |
4133ae41fc64f5531cd001d2e883bd3ab89283ddea9ffdf5659960cc8bd37918 | Python | 5,578 | 155 | import torch
import torch.nn as nn
import math
def compared_version(ver1, ver2):
"""
:param ver1
:param ver2
:return: ver1< = >ver2 False/True
"""
list1 = str(ver1).split(".")
list2 = str(ver2).split(".")
for i in range(len(list1)) if len(list1) < len(list2) else range(len(list2)):... |
5ca1cfd96f74392d01f7caf04dfc807898fb79e391d9a75cf8ea07cbcfcee4d4 | Python | 5,581 | 161 | # -*- coding: utf-8 -*-
"""
Created on Wed Sep 8 12:19:10 2021
@author: fhu14
This test is to ensure that the ordering of critical datafields (e.g. atomic numbers)
obeys two conditions:
1) Invariant to permutations in the input arguments to get_ani1data (or equivalent retrival
function)
2) Every molec... |
5aff886ddf2420e692be8ae814adc52dc489c4400e78fff11e7d7cc1dbf8c302 | Python | 5,584 | 193 | _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 ... |
89722d17748a80d5cf0e4d2284f7aae3fa0fe54f487ca99b15057ddd4ad7779a | Python | 5,584 | 193 | _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 ... |
96f138d1f9c0fd0abb5c480409015d391abaa1ea337e98faaf29950055922e69 | Python | 5,584 | 193 | _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 ... |
8396686e8fe240fdf17308e891c2fc36ca7a1c12d6969fd13d4c5ee1b06c0da9 | Python | 5,586 | 184 | from __future__ import annotations
import os
import pickle as pkl
from _pickle import UnpicklingError
from collections import Counter
from itertools import combinations
from time import time
from typing import Optional, Iterable
import matplotlib as mpl
from h5py import File
from .consts import ATOM2SYM
class Time... |
0c0e7dcb289055ab1e8940ac667e699f77c4a1eab48786993a6554a7766225af | Python | 5,587 | 192 | _base_ = [
'../../../../_base_/default_runtime.py',
'../../../../_base_/datasets/crowdpose.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_co... |
1fde5152a0dc180b01cabf1aa5dcfa39bf670fdca026018398e089e2440e5896 | Python | 5,587 | 192 | _base_ = [
'../../../../_base_/default_runtime.py',
'../../../../_base_/datasets/crowdpose.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_co... |
bddcd6c9211a52ec81df58bdc203b4e08738cabd974a8ade28ffce0bf9c31499 | Python | 5,587 | 192 | _base_ = [
'../../../../_base_/default_runtime.py',
'../../../../_base_/datasets/crowdpose.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_co... |
75303cf654bac98a041a32393494bea3e3951688f8659b4ceada6dcc07cc3f2f | Python | 5,597 | 146 | """
Cross‑validated Pearson‑correlation, implemented with himalaya MultipleKernelRidgeCV.
----------------------
If the solver's diagonalisation step with `diagonalize_method='eigh'` fails
(e.g. because the kernel is ill‑conditioned), the code automatically
retries with `diagonalize_method='svd'`. This behaviour is f... |
5676e6c27081dcc014d998fc1457b56c20e4cfe45c6a2d93cb215b329be55448 | Python | 5,598 | 98 | import argparse
import matplotlib.pyplot as plt
import matplotlib.animation as animation
from my_tools import *
def brodmann_color_dictionaries():
# area - function association from http://www.brainm.com/software/pubs/dg/BA_10-20_ROI_Talairach/Brodmann%20Atlas%20-%20Functions%20associated%20with%20area%20-%20CLICK... |
cd18ff1a6839f61d24739682637c4dc969971a5a25e6b892130b4c4499dd3204 | Python | 5,598 | 140 | # Copyright (c) OpenMMLab. All rights reserved.
import torch
from mmdet.core import multi_apply
from ..builder import HEADS
from ..losses import CrossEntropyLoss, SmoothL1Loss, carl_loss, isr_p
from .ssd_head import SSDHead
# TODO: add loss evaluator for SSD
@HEADS.register_module()
class PISASSDHead(SSDHead):
... |
18763b9a0b7a3489028266b956bc97ecb2f06600065de2ec5e1d6f5649e8eb8a | Python | 5,600 | 112 | import logging
import traceback
import time
from fedml_api.distributed.fedgan.message_define import MyMessage
from fedml_api.distributed.fedgan.utils import transform_tensor_to_list
from fedml_core.distributed.communication.message import Message
from fedml_core.distributed.server.server_manager import ServerManager
... |
1fc6c3bf4139d21ddaa579505b19bedc749c96eea2f51230d4df9b319960e536 | Python | 5,602 | 160 | import sys
import os
import multiprocessing
import time
from datetime import timedelta
import signal
import traceback
import pickle
def _pool_initializer():
"""Ignore CTRL+C in the worker process"""
signal.signal(signal.SIGINT, signal.SIG_IGN)
class ParallelProcess():
"""Handles the asynchronous running o... |
5e1ca05a5d31a44144f33f4570bd86964dbcfc93c9dbd84dc9184ea44673eed9 | Python | 5,603 | 203 | # Copyright (C) 2022-2025 ETH Zurich, Niels Maeder and other DASH contributors.
import os
from typing import OrderedDict
import pytest
from numpy import array_equal
from rdkit import Chem
from torch import device, load
from torch.nn.functional import mse_loss
from torch.optim import Adam
from torch.cuda import is_ava... |
31b70cebfd6dcb431282fe89bbc5f2a2118a69ef8e64c365e41c7e07c5e1551c | Python | 5,608 | 119 | #!/usr/bin/env python3
# Author: Francois Aguet
import argparse
import os
import numpy as np
import subprocess
import gzip
import multiprocessing as mp
import contextlib
from datetime import datetime
import tempfile
import glob
@contextlib.contextmanager
def cd(cd_path):
saved_path = os.getcwd()
os.chdir(cd_pa... |
8833ae46dd8e1732abd1cd5f0935d2d4f47e182b347b82050f9d68ea2d3404c9 | Python | 5,609 | 230 | """Tranform classes to process data.
Data generator objects can apply these transforms to data upon loading.
"""
import numpy as np
class Compose(object):
"""Composes several transforms together.
Adapted from pytorch source code:
https://pytorch.org/docs/stable/_modules/torchvision/transforms/transform... |
dcdaa7468fb743f7bff4a0351e20c2b4d9310bbbe37520a663fcd544d9fb7c3a | Python | 5,610 | 111 | import logging
import traceback
import time
from fedml_api.distributed.fedmedgan.message_define import MyMessage
# from fedml_api.distributed.fedmedgan.utils import transform_tensor_to_list
from fedml_core.distributed.communication.message import Message
from fedml_core.distributed.server.server_manager import ServerMa... |
0310fd08ee4718e3341c478e118ecf51204321baeedf98d42a9d1cdb22cc1f90 | Python | 5,614 | 164 | # Copyright (c) OpenMMLab. All rights reserved.
import copy
import platform
import random
from functools import partial
import numpy as np
import torch
from mmcv.parallel import collate
from mmcv.runner import get_dist_info
from mmcv.utils import Registry, build_from_cfg, is_seq_of
from mmcv.utils.parrots_wrapper impo... |
ab9e9a98fac99006a41e6fda8c1fb70be23ad8d05b48f0102337c48aeb1bb59f | Python | 5,616 | 145 | #!usr/bin/env python
#coding:utf-8
"""
@author: Haidong Zhang
@contact: haidong_zhang14@yahoo.com
@time: 2021/1/17 1:34
@project: MalariaDetection
@description: https://github.com/Wanke15/HAN-keras/blob/master/HAN-keras.ipynb
"""
import keras
from keras import backend as K
from keras import initializers
imp... |
bc34859e70c240869cfef0027b058461d22912166ff76329b48ce7bef1908540 | Python | 5,616 | 128 | # Imports #
import kivy
import zipimport
import sys
import os
import configparser
from kivy.app import App
from kivy.uix.widget import Widget
from kivy.uix.button import Button
from kivy.uix.image import Image
from kivy.uix.label import Label
from kivy.uix.dropdown import DropDown
from kivy.uix.floatlayout import Float... |
606c2769a5269377c1bdf718bfd00d66cbe8898e6689aebdbc0dd2f123f0aa17 | Python | 5,617 | 145 | #!usr/bin/env python
#coding:utf-8
"""
@author: Haidong Zhang
@contact: haidong_zhang14@yahoo.com
@time: 2021/1/17 1:34
@project: MalariaDetection
@description: https://github.com/Wanke15/HAN-keras/blob/master/HAN-keras.ipynb
"""
import keras
from keras import backend as K
from keras import initializers
imp... |
f1e163ec0ae77f157530f0f382e3d736a84d8fe40d58e7de7045f8aa77f8e5c3 | Python | 5,617 | 146 | import torch
import torch.nn as nn
from mmcv.runner import auto_fp16, force_fp32
from mmdet.core import mask_target
from mmdet.models.builder import HEADS
from mmdet.models.dense_heads.atss_head import reduce_mean
from mmdet.models.utils import build_transformer
from .fcn_mask_head import FCNMaskHead
@HEADS.register... |
e6c7ed5764bc46c95b7ef1f4441e80ca490598277cbda43f3ad65f9a8b22f3c1 | Python | 5,622 | 142 | # Author: Fabi Prezja <faprezja@fairn.fi>
# Copyright (C) 2023 Fabi Prezja
# License: MIT License (see LICENSE.txt for details)
import os
import numpy as np
from tensorflow.keras.preprocessing.image import ImageDataGenerator
def create_predict_datagen(preprocess_input_func):
"""
Create an ImageDataGenerator i... |
073ad494e1b867e1e91e5f32bac3cec9ccb81a597cbd26a797b17eecd34c83f1 | Python | 5,628 | 173 | import json
import os
import re
from itertools import combinations
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
import seaborn as sns
from matplotlib.colors import from_levels_and_colors
from scipy.stats import wilcoxon
def mse(y_true: np.ndarray, y_pred: np.ndarray) -> np.ndarray:
"""C... |
5c6f464a0d7caf239c1ca9dacb24bc255ea2e0b9ea5b9ce6aaf9139b89ba7125 | Python | 5,631 | 168 | # -*- coding: utf-8 -*-
"""
Created on Wed Mar 17 13:48:30 2021
@author: Anandita
"""
import datetime, sys, os, time
from collections import defaultdict
import numpy as np
from scipy import linalg as sla
import matplotlib.pyplot as plt
import pickle
gen_fn_dir = os.path.abspath('..') + '/shared_scrip... |
aff3e94dd0f066f1953df4fdc90e3858621c768407af114a5fe0ac3cb5978d0b | Python | 5,631 | 209 | # -*- coding: utf-8 -*-
"""
Created on Tue Jun 8 15:32:54 2021
@author: fhu14
Simple driver file for running all tests
NOTE: For best results, the test_files directory should be the most
up to date and DFTB+ version 20+ should be installed (preferably a unix/linux environment)
The regex test can ONLY be run using... |
c54cfe936f879e4eb58b81eae3773ae59ca72c20f9a72d6e18e2563ed450a4dc | Python | 5,632 | 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/>
from abc import ABC, abstractmethod
from typing import Callable, Type
import torch
from torch import Tensor
PREDICTORS = {}
def get_predictor(
nam... |
6f5813f691faa03e98c2dba3711be71b10638c419828a2ea5d429ec7ec820bfa | Python | 5,636 | 123 | # -*- coding: utf-8 -*-
"""
Created on Tue Jun 8 19:46:00 2021
@author: fhu14
Module containing logic used to generate folds from molecules
TODO: Add fancy logic for distributions, randomizations, etc.
"""
#%% Imports, definitions
from typing import List, Dict
from .util import count_nheavy
import random
from .ani1... |
7d7f5911e36b8abfb2db6c3102a6d37c35b1668ea594ab7d5791b2fadebd30ae | Python | 5,643 | 160 | import json
import os
import pathlib
import random
import unittest
import torch
import torchvision.transforms as T
from PIL import Image
from .. import figure
from ..figures.scale.dataset import ScaleBarDataset
from ..figures.scale.engine import evaluate
from ..figures.scale.utils import collate_fn
class TestScaleD... |
000b839ec61e55becf89976db4d56f6b7e14dc832066ec19db41739d3a3dcf96 | Python | 5,647 | 156 | # Copyright (c) OpenMMLab. All rights reserved.
import math
import torch
import torch.nn as nn
from mmcv.cnn import ConvModule, DepthwiseSeparableConvModule
from mmcv.runner import BaseModule
from ..builder import NECKS
from ..utils import CSPLayer
@NECKS.register_module()
class YOLOXPAFPN(BaseModule):
"""Path ... |
4d37d75df1fd5dafda04e027545c826b275dd80e73d6c70c5dc7670597bc0ee1 | Python | 5,647 | 193 | from typing import Optional
from .gradient_descent_base import L1BaseGradientDescent
from .gradient_descent_base import L2BaseGradientDescent
from .gradient_descent_base import LinfBaseGradientDescent
from .gradient_descent_base import AdamOptimizer, Optimizer
import eagerpy as ep
class L1BasicIterativeAttack(L1Base... |
4675767f3559b09de2958f378b9399cee9614b81d3721e4cfd6b2804216ac135 | Python | 5,656 | 103 | import nengo
import nengo.spa as spa
import numpy as np
from nengo.spa.module import Module
from nengo.spa.assoc_mem import AssociativeMemory
class AssociativeMemoryAccumulator(AssociativeMemory):
"""Associative memory module with accumulator that keeps track of retrieval status.
Parameters - for accumulatio... |
a8bc6b9f89126867cd89d005a3c4e6e9a55cda7b815cc0ccde07b1d641901b01 | Python | 5,662 | 166 | """This module implements an abstract base class (ABC) 'BaseDataset' for datasets.
It also includes common transformation functions (e.g., get_transform, __scale_width), which can be later used in subclasses.
"""
import random
import numpy as np
import torch.utils.data as data
from PIL import Image
import torchvision.... |
536a108f61f7a9fa566516a21de07a300d344ffe1dd2fa4409424e8d79285bb4 | Python | 5,669 | 158 | import collections
import contextlib
import sys
import wave
import webrtcvad
def read_wave(path):
"""Reads a .wav file.
Takes the path, and returns (PCM audio data, sample rate).
"""
with contextlib.closing(wave.open(path, 'rb')) as wf:
num_channels = wf.getnchannels()
assert num_cha... |
d1e47865c6fd0887fae1a5f9ebf968d4200e39c2714156171ed268f93bd26b00 | Python | 5,671 | 193 | import abc
import inspect
import argparse
import dataclasses
import typing
from osgeo import osr
import pandas as pd
__all__ = ['AbstractModelMeta',
'AbstractModel',
'ModelClassMetaData',
'ModelResults',
'FitResults',
'EvaluateResults',
'input_data',
... |
29e723fd316d111342acf3aa4f354622db607c2c2ae0fe2bd4682b93b0f7f09f | Python | 5,672 | 138 | # Copyright (c) OpenMMLab. All rights reserved.
executor_cfg = dict(
# Basic configurations of the executor
name='Pose Estimation',
camera_id=0,
# Define nodes.
# The configuration of a node usually includes:
# 1. 'type': Node class name
# 2. 'name': Node name
# 3. I/O buffers (e.g... |
0a636fb44be83d290e819acd8ac26eb019ed099f6ff771e2168ea2d3168b2f9f | Python | 5,676 | 195 | _base_ = [
'../../../../_base_/default_runtime.py',
'../../../../_base_/datasets/coco_wholebody.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
... |
0c58d72704dd0da7a0137a6cd790505badd19f8e342891b4fefbd72d9e10585e | Python | 5,677 | 195 | _base_ = [
'../../../../_base_/default_runtime.py',
'../../../../_base_/datasets/coco_wholebody.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
... |
4021b4533a7cb2161f303ca9b3bccd8c47ec9685dc0fde019cb165aef5d90101 | Python | 5,677 | 195 | _base_ = [
'../../../../_base_/default_runtime.py',
'../../../../_base_/datasets/coco_wholebody.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
... |
b8d3ea9de6df07211aca8389b18b4a499fca8ff62dd24080ad2f36bf2fea7124 | Python | 5,677 | 195 | _base_ = [
'../../../../_base_/default_runtime.py',
'../../../../_base_/datasets/coco_wholebody.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
... |
5e066eec30bd08276e0f511ecce01560f9996ce49892e4a210bcfbbf1d5edb3a | Python | 5,684 | 183 | _base_ = [
'../../../../_base_/default_runtime.py',
'../../../../_base_/datasets/interhand3d.py'
]
checkpoint_config = dict(interval=1)
evaluation = dict(
interval=1,
metric=['MRRPE', 'MPJPE', 'Handedness_acc'],
save_best='MPJPE_all')
optimizer = dict(
type='Adam',
lr=2e-4,
)
optimizer_conf... |
6abde747c5bb932b1ac5ebd133a2cfe4a9ecea446f023020af6ebcdab34be4a0 | Python | 5,685 | 197 | _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 ... |
81ce6f5baa5bcf12d1799bfcf42ee73d162cb6ca819e2b36025036c4ab1a28d0 | Python | 5,685 | 197 | _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 ... |
f7833fba9c7ad8c1cc291850977eba72e4fc8baa5d70c4f6a841ec8b44850dbd | Python | 5,685 | 197 | _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 ... |
ed3111315ff97126d3bd201cea83495f04127782abfd38233ec831f3bebb922f | Python | 5,686 | 123 | # 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 math
from typing import Optional, Tuple, Union
import torch
from torch import Tensor
from torch.distributions import Distribution
from sbi.infere... |
0726bfb822cfdddea61ea6e23f9a18685a9dcbda156af2653612afcf0f851a16 | Python | 5,688 | 196 | _base_ = [
'../../../../_base_/default_runtime.py',
'../../../../_base_/datasets/crowdpose.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_co... |
10db409225ced50862e01e4d88450d7a1b65b68b8e9031544494383127375484 | Python | 5,688 | 196 | _base_ = [
'../../../../_base_/default_runtime.py',
'../../../../_base_/datasets/crowdpose.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_co... |
bbc0b65ccdaf0195589df335402b42d9d3dd3b48bbd9810c4cee85e746d0f7cf | Python | 5,689 | 196 | _base_ = [
'../../../../_base_/default_runtime.py',
'../../../../_base_/datasets/crowdpose.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_co... |
323422ebae966b7f1c4a1feea464898912f47fd18e659439ce1805d47d774997 | Python | 5,690 | 139 | import utils
from elasticsearch import Elasticsearch
import nltk
import itertools
import csv
import json
from nltk.tokenize import sent_tokenize
import codecs
_es_host = 'http://localhost:9200/'
_es_instance = None
_es_index_name = 'hepcpos_300'
_es_doc_type = 'eprdoc'
_window_size = 100
vocabulary_size = 8000
unkno... |
7ea138908b38e0b45ee2c4a3ef602158db4cf72aa7be8e287a7f112009b65070 | Python | 5,699 | 176 | """Write Evolutionary Compression (.ecomp) archives."""
from __future__ import annotations
import gzip
import json
import struct
import zlib
from copy import deepcopy
from dataclasses import dataclass
from hashlib import sha256
from pathlib import Path
from typing import Iterable, Optional, Tuple, Union
from Bio.Ali... |
f3fc237ed66b2c100c776da4f61e1c20618d66ee03bbc49730cf5d2f24c2c041 | Python | 5,703 | 124 | # -*- coding: utf-8 -*-
"""
Created on Mon Jun 7 19:17:13 2021
@author: fhu14
"""
#%% Imports, definitions
from .base_classes import LossModel
from .external_funcs import compute_charges
from typing import List, Dict
import numpy as np
import torch
Tensor = torch.Tensor
import torch.nn as nn
#%% Code behind
class D... |
a48f9bbe4d4ffad98b47d6bb468746365391fd4ec0aec2d014d14b58098b7ce5 | Python | 5,706 | 172 | from logging import getLogger
from os.path import join
import numpy as np
import torch
from hydra.core.hydra_config import HydraConfig
from hydra.utils import to_absolute_path
from omegaconf import OmegaConf
from torch import nn
from base.config import Config
logger = getLogger(__name__)
def _weights_init(m):
... |
8faad4b7402f26b80296d33e888cbb6f3f09d08fc994a6e7dfd16736b0d8fb4e | Python | 5,712 | 154 | # Copyright (c) OpenMMLab. All rights reserved.
import math
from mmcv.cnn import build_conv_layer, build_norm_layer
from ..builder import BACKBONES
from ..utils import ResLayer
from .resnet import Bottleneck as _Bottleneck
from .resnet import ResNet
class Bottleneck(_Bottleneck):
expansion = 4
def __init__... |
d4a0681be77c608d71f427d6d72d4885032bb79fd833f62de9c5a14001bdead8 | Python | 5,715 | 188 | from InitialParametersClass import GUI1
import matplotlib.pyplot as plt
import tkinter as tk
from PerfusionClass import Perfusion
from PerfusionClass import CreateImage, continue1
from IPython.display import display, HTML
display(HTML("<style>.container {width:100% !important; }</style>"))
if __name__ == '__... |
9cf9f4fd7ac2f1e7e826af8c9844b7ba1c1784975f0b4f3c15639f9eb2a6fee1 | Python | 5,716 | 156 | """Temporal MLP model implemented in PyTorch."""
from torch import nn
from daart.models.base import BaseModel, get_activation_func_from_str
# to ignore imports for sphix-autoapidoc
__all__ = ['TemporalMLP']
class TemporalMLP(BaseModel):
"""MLP network with initial 1D convolution layer."""
def __init__(self... |
4e8be6a1c932d5f810a1ac5ae283a7ed498988b609803d8f9730ed558e0b3a5b | Python | 5,717 | 164 | #!usr/bin/env python
#coding:utf-8
"""
@author: Haidong Zhang
@contact: haidong_zhang14@yahoo.com
@time: 2021/1/10 8:58
@project: MalariaDetection
@description:
"""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import argparse
import os
... |
c09655b1037f31a1fd3499f374602f4f5cd58f2589067312ab5b8753c393bc3b | Python | 5,722 | 142 | # Copyright (c) OpenMMLab. All rights reserved.
from itertools import groupby
from typing import Dict, List, Optional, Union
import cv2
import numpy as np
from ...utils import get_eye_keypoint_ids, load_image_from_disk_or_url
from ..base_visualizer_node import BaseVisualizerNode
from ..registry import NODES
@NODES.... |
8e923a15fb000a3af377f664285e87c8c28a5b195013f819de5cd19fa9daa19d | Python | 5,724 | 135 | import os
import typing
from dataclasses import dataclass
from typing import Dict, Optional
import numpy as np
import pandas as pd
from osgeo import osr
from bathymetry_estimations_utils import BathymetryEstimations
from georeferenced_data import GeoreferencedData, _T
from geotransformations import geo_to_pix
from mo... |
31ab40cd4c7ab4f917a69095253a5936d9795daf3b352dae0520d23b31555f75 | Python | 5,725 | 148 | import os
import pandas as pd
import matplotlib.pyplot as plt
import numpy as np
import seaborn as sns
import pickle
import shelve
plt.style.use('seaborn-poster')
data_path = '/network/lustre/iss01/wyart/analyses/2pehaviour/MLR_analyses/ML_pipeline_output/fig6/'
df_summary = pd.read_csv('/network/lustre/iss01/wyart/a... |
a331194e6429b188aa484336f438b39e7048868a8ca9325521fb388be31cc830 | Python | 5,729 | 132 | #!/usr/bin/env python
# Copyright [1999-2017] EMBL-European Bioinformatics Institute
#
# 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
#
# Unl... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.