sha256
stringlengths
64
64
language
stringclasses
28 values
size
int32
1
491k
lines
int32
1
23.2k
content
stringlengths
1
200k
044653f9fabdc60013c5ed6f2a0397663674ee1832a160c58728a883147c831d
Python
29,284
728
""" Author: Mingjian He <mh1@stanford.edu> Dynamic programming (also known as belief propagation) algorithms for exact inference """ import torch import numpy as np from scipy.linalg import solve_triangular def forward_backward(A, py_x, p1=None, compute_edge=False): """ Classical forward-backward algorithm ...
882a23fd3bf0234c7c415dcae8e5d9b75be9ee0ed7d7b02be719c303709a4b60
Python
29,288
721
""" Scheduler Tests Tests for learning rate schedulers in timm.scheduler. """ import math import pytest import torch from torch.nn import Parameter from timm.scheduler import ( CosineLRScheduler, StepLRScheduler, MultiStepLRScheduler, PlateauLRScheduler, PolyLRScheduler, TanhLRScheduler, W...
e11344e014055dbbd40fdea1ac38ae8a157eeb95aceaa1c6e11bce4d73507c19
Python
29,468
508
# -*- coding: utf-8 -*- """ @author: bartulem Read in sync events from all desired data streams. Neuropixel recordings are saved into a *1D binary vector*, from a 2D array organised as 385 rows (channels) x n columns (samples). The data are written to file from this matrix in column-major (F) order, i.e., the first...
71376b3d66751f23d4fa325775e6d840ad04589c3edbf78263d8feec05913f48
Python
29,490
900
# # Copyright (C) 2014 Paul Schultz and the SWIPO Project # # Authors (this file): # Stefan Schinkel <stefan.schinkel@gmail.com> # Paul Schultz pschultz@pik-potsdam.de> # # # References: [Schultz2014]_, [Schultz2014a]_, # # ToDo: # - included Schultz' Predictor and growth algorithm (among others) """ Module cont...
f012ba741a1a962a072083c7208779e17f0dff84095b08d5e0f574994e7467b8
Python
29,491
890
""" PP-HGNet (V1 & V2) SSLD pretrained weights: * `Beyond Self-Supervision: A Simple Yet Effective Network Distillation Alternative to Improve Backbones` - https://arxiv.org/abs/2103.05959 Reference: https://github.com/PaddlePaddle/PaddleClas/blob/develop/docs/zh_CN/models/ImageNet1k/PP-HGNetV2.md The Paddle Implemen...
2c3827a0b21992e2ea4efd3c8b61e0f94cf79ede167980d664b341d5ebf6ce2d
Python
29,518
573
from functools import partial from collections.abc import Callable import centriole.smooth import centriole.cpmorphology import scipy.ndimage import numpy from numpy.typing import NDArray from typing import Optional, Tuple, Annotated, cast from typing_extensions import TypeAlias from pydantic import Field, validate_cal...
477b144b4694bee00ee5a4fa26367dec19055a30ed6266c91e6198863195c380
Python
29,592
709
""" Author: "Keitaro Yamashita, Garib N. Murshudov" MRC Laboratory of Molecular Biology This software is released under the Mozilla Public License, version 2.0; see LICENSE. """ from __future__ import absolute_import, division, print_function, generators from servalcat.utils import logger from servalcat.utils impo...
ad93a6317171df3ad63edb765831997f7e06467683a35a835bb83ccaa61da225
Python
29,597
867
from enum import Enum import numpy as np from numpy.random.mtrand import RandomState import scipy.sparse import centriole.index from typing import Tuple from numpy.typing import NDArray from ..types import ObjectLabel, ObjectSegmentation class SPARSE_FIELD(Enum): label = "label" c = "c" t = "t" z = "z"...
3e919df1acafd7fea607cd8b743c13332f5581cd8cc9fe16f6d8213d44d0cb80
Python
29,638
706
# coding=utf-8 # Copyright 2020 The SimCLR 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 or...
c2e5b4a507bd22cb110a20f0309bc80453f2916b72cfabb1585b6695d7035d52
Python
29,644
865
from os.path import exists, basename, join, dirname import nibabel as nib import numpy as np from scipy.signal import cubic from scipy.sparse import kron, lil_array from traitlets import (Instance, Integer, Unicode, Bool, Dict,...
cbad1c19e224d28766d61a8461c4bc6efee400dfb26b372f7d7dfbbbbfc05448
Python
29,859
715
import logging import os import sys import uuid import wx from cellprofiler_core.preferences import report_progress from cellprofiler_core.setting import FileCollectionDisplay from ..pipeline import Pipeline from ..utilities.module_view import edit_control_name from ...icons import get_builtin_image LOGGER = logging...
67e8ba38c84bcf3e7dcdbefc206161071c47eba3261f3741d67b6f2cf23462ba
Python
29,954
607
# -*- coding: utf-8 -*- import time import torch import torchvision from torchvision import transforms,datasets import numpy as np import os import sys import subprocess #加载tidigits数据集 from python_speech_features import fbank import numpy as np import scipy.io.wavfile as wav from sklearn.preprocessing impo...
f1089a1f5e4bd646a462dfa6b8af1a8ed0269ed5b75431992e07166792ea92e3
Python
29,985
884
"""Tests for the ordinal re-coder.""" import itertools import os import tempfile from concurrent.futures import ThreadPoolExecutor from functools import cache as fcache from typing import Any, Tuple, Type, TypeVar import numpy as np import pytest from .._typing import EvalsLog from ..compat import import_cudf from ....
f6340b4fdf2cd84687f793996058f5870ad0f0eb4d54e9606b6c9dad4e5278d7
Python
30,048
796
""" Vision Transformer (ViT) in PyTorch A PyTorch implement of Vision Transformers as described in: * `Exploring Plain Vision Transformer Backbones for Object Detection` - https://arxiv.org/abs/2203.16527 * `Segment Anything` - https://arxiv.org/abs/2304.02643 * `An Image is Worth 16x16 Words: Transformers for Image ...
ae9b135194d22a63a21968a0c7ed73c4debb734d6a1596dca0fa11f0393d9a3f
Python
30,077
710
import scanpy as sc import pandas as pd import numpy as np import math from scipy.sparse import csr_matrix, find import matplotlib.pyplot as plt import time from scipy.stats import norm from joblib import Parallel, delayed def which(x): n = len(x) m = sum(x) y = np.zeros(m) j = -1 for i in range(...
00290f4bc8da38dfc07d35630e1689a92db33925a7d3d2ee27aeb5b0f50ea0a6
Python
30,115
521
#### Master Script 05b: Prepare environment to calculate TimeSHAP for dynAPM_DeepMN models #### # # Shubhayu Bhattacharyay # University of Cambridge # email address: sb2406@cam.ac.uk # ### Contents: # I. Initialisation # II. Identify transition points in testing set predictions for TimeSHAP focus # III. Partition signi...
c8fcd3820b535565683680deffabdf2d2a76f108ca298f7f16d2fa96f6758c7b
Python
30,144
715
# Pytorch Tabular # Author: Manu Joseph <manujoseph@gmail.com> # For license information, see LICENSE.TXT """Config""" import logging import os from dataclasses import MISSING, dataclass, field from typing import Any, Dict, List, Optional from omegaconf import OmegaConf logger = logging.getLogger(__name__) def _rea...
faac827d17e3822bc908d3b2f783d209332cef20edc7da7b606e78f96357cecf
Python
30,231
925
import numpy import six.moves import cellprofiler_core.image import cellprofiler_core.measurement from cellprofiler_core.constants.measurement import COLTYPE_INTEGER, COLTYPE_FLOAT, NEIGHBORS, R_FIRST_OBJECT_NUMBER, \ R_SECOND_OBJECT_NUMBER from cellprofiler_core.measurement import RelationshipKey import cellprof...
8ee36602a1a1692d5bd4276038e40c353f1aad43cea0288bb32a6707fa81ad74
Python
30,314
623
import numpy as np import scipy as sp # import pandas as pd import tensorflow as tf from tensorflow.keras.models import Sequential from tensorflow.keras.layers import Activation, Lambda, Dense from tensorflow.python.keras import backend as K from tensorflow.keras.datasets import mnist, fashion_mnist from extra_keras_d...
cd53cfad5121bffc6b41364a60e52d4175b35e682127abcbbd9f126a28be8a6d
Python
30,414
903
import numpy as np import centriole.outline import cellprofiler_library.functions.segmentation as lib_seg from cellprofiler_library.functions.segmentation import SPARSE_FIELD def _check_indices(indices, indices_expected): assert len(indices) == len(indices_expected) for labels, labels_expected in zip(indices,...
61b44039bd6c896b76bf641cd329d2e074169661b47b8d11c1e024bd5329db7e
Python
30,623
673
"""PROVONE-RDF serializers for ProvONEDocument """ import base64 from collections import OrderedDict import datetime import io import dateutil.parser from prov.constants import ( PROV, PROV_ACTIVITY, PROV_ALTERNATE, PROV_ASSOCIATION, PROV_ATTR_ENDER, PROV_ATTR_ENDTIME, PROV_ATTR_INFORMANT, ...
e4bb95aace35c7e7c94da7cbf243ea124ec29ff52ab5ec3bd3b256851c9c9297
Python
30,652
898
""" TinyViT Papers: * `TinyViT: Fast Pretraining Distillation for Small Vision Transformers` - https://arxiv.org/abs/2207.10666 Adapted from official impl at https://github.com/microsoft/Cream/tree/main/TinyViT """ __all__ = ['TinyVit'] import itertools from functools import partial from typing import Dict, List, O...
8a7455abb28032527ab69f6b386470885fcc3d9ff742458ff5276dda5efdf78d
Python
30,767
728
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Mon Feb 17 17:56:34 2022 @author: Manuel Set general functions and variables. """ __author__ = "Manuel R. Popp" #### parse arguments----------------------------------------------------------- import argparse import urllib.request # in case it i...
f5e12c46a91325e68504e389c50add30f7bf91d4f28a0bef413f2e7357159b14
Python
30,896
609
import torch import torchvision import torch.nn.functional as f import math from tqdm import tqdm from utils import radam import utils.viz_utils as viz_utils from models.style_networks import StyleEncoderE2VID, SemSegE2VID import training.base_trainer from evaluation.metrics import MetricsSemseg from utils.loss_funct...
c042710cf1b871e02f0cc0221e4c643aae5e306d1cf251c6c6a940a91d8ab3ec
Python
31,025
738
from typing import Iterable, Tuple, Union, List, Optional, Sequence, Dict from numbers import Number from pathlib import Path import warnings from tqdm import tqdm import numpy as np import nibabel as nib import torch import torchio as tio from torchio import Subject, RandomAffine, IntensityTransform, CropOrPad, Re...
bac9e162b1e36249786e0fc5f7049c417c3870ef560bb463e6fee89890b8758c
Python
31,045
820
# -*- coding: utf-8 -*- # (C) Copyright 2020, 2021, 2022, 2023 IBM. All Rights Reserved. # # This code is licensed under the Apache License, Version 2.0. You may # obtain a copy of this license in the LICENSE.txt file in the root directory # of this source tree or at http://www.apache.org/licenses/LICENSE-2.0. # # Any...
0d17c30c8e77be785224651152a932a8e4e7c78e5d04b1280733ef86c27f9b1b
Python
31,166
638
# -*- coding: utf-8 -*- """ ------------------------------------------------------------------------------ Copyright (C) 2019 Université catholique de Louvain (UCLouvain), Belgium. Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License....
bf17deb2cbdb33d6cc7ac3e775fb952460763f4e8f2625f33ea36f2f5a99a4b7
Python
31,202
901
import matplotlib as mpl mpl.use('agg') from matplotlib.testing.compare import compare_images from tempfile import NamedTemporaryFile import os.path import shutil import pygenometracks.plotTracks import sys ROOT = os.path.join(os.path.dirname(os.path.abspath(__file__)), "test_data") browser_tracks...
6d7b004badfb625dff380ed382b78981a14a012598a4d650b4e842c90ae4f4f5
Python
31,309
366
"""Directory for tests of individual modules """ import logging import base64 import hashlib import numpy as np import os import unittest import tempfile import functools import scipy.io.matlab.mio import numpy import skimage.io from urllib.request import URLopener import cellprofiler_core.utilities.legacy from cellpr...
66a0226cca8fb437a54425ce88b779d5d6a929a5d3984360c0882f99a9989c77
Python
31,388
696
import math import dgl import torch from torch import nn from dgl import function as fn from src.utils.graph_norm import GraphNorm import sys def get_non_lin(type, negative_slope): if type == 'swish': return nn.SiLU() else: assert type == 'lkyrelu' return nn.LeakyReLU(negative_slope=ne...
5544b7039096a737fe9886ba4b459118a3d7c4cb42fe73b2e7b9de5365d5a786
Python
31,459
763
""" CrossViT Model Papers: * `CrossViT: Cross-Attention Multi-Scale Vision Transformer for Image Classification` - https://arxiv.org/abs/2103.14899 @inproceedings{ chen2021crossvit, title={{CrossViT: Cross-Attention Multi-Scale Vision Transformer for Image Classification}}, author={Chun-Fu (Richard) Chen ...
50057f227f65e915f3b9dd2a586fae0cf3e2f3e593c9d843120a8c19e3964f9c
Python
31,610
753
import collections import io import logging import os import queue import subprocess import sys import tempfile import threading import re import numpy import psutil from .event import Finished from .event import Paused from .event import Progress from .event import Resumed from .event import Started from . import re...
a56cc522f0aaad4c337c7b19b9d402ddf8591e83a18dbfbbda9ce3ab94ae3c03
Python
31,650
771
""" Author: "Keitaro Yamashita, Garib N. Murshudov" MRC Laboratory of Molecular Biology This software is released under the Mozilla Public License, version 2.0; see LICENSE. """ from __future__ import absolute_import, division, print_function, generators import gemmi import numpy import subprocess import shlex imp...
86dd2d505479c05c262f990afa6b179bc4f1518b7c155b8092b3d449169888f3
Python
31,742
717
# encoding: utf-8 # Author : Floyed<Floyed_Shen@outlook.com> # Datetime : 2022/4/28 14:56 # User : Floyed # Product : PyCharm # Project : braincog # File : main_simplified.py # explain : Simplified training script. Remove support for DDP, IMAGENET, Augment, etc. import argparse import time import ...
25498edba93982b27face21154a91c677b3382fad9858d8b34610c6e77571718
Python
31,856
626
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Thu May 28 09:56:19 2020 @author: nozais Si les fichiers 4D sont tous dans le même dossier, avec donc des noms différents du type "mySubXXX.nii.gz", les fichiers de sortie seront placés dans des dossiers nommés "*/mySubXXX_functionnectome/" Bold paths and...
3683e74d1e52368daf15cfcb38d6facf5e6b1ec9441112d9159754d0d3bdd172
Python
31,920
984
import reprlib from collections.abc import Iterator, Sequence from dataclasses import dataclass from functools import lru_cache from pathlib import Path from typing import ( Any, Literal, Protocol, ) import numpy as np import polars as pl from sklearn.model_selection import train_test_split from sklearn.pr...
dfe65137d65e982d439b0089852e338bea20e642c47c814a25a05c557f6c77d1
Python
32,006
899
""" pysteps.noise.fftgenerators =========================== Methods for noise generators based on FFT filtering of white noise. The methods in this module implement the following interface for filter initialization depending on their parametric or nonparametric nature:: initialize_param_2d_xxx_filter(field, **kwar...
fe23635750e649116863019d6f2f04c097304e9fb5e74eed98919e3a1c4ebcc7
Python
32,063
898
# This file is part of pyunicorn. # Copyright (C) 2008--2026 Jonathan F. Donges and pyunicorn authors # URL: <https://www.pik-potsdam.de/members/donges/software-2/software> # License: BSD (3-clause) # # Please acknowledge and cite the use of this software and its authors # when results are used in publications or publi...
e9b0e81ea0b5f74cb783659f2b8dc731da439d09f09b8abade00ea6920f3062c
Python
32,070
799
"""Knowledge distillation training tasks and components.""" import logging from typing import Any, Dict, Optional, Tuple, Union import torch import torch.nn as nn import torch.nn.functional as F from timm.models import create_model, group_parameters from timm.utils import unwrap_model from .classification import res...
997424374e46ec7981402fc2c7fd596b590d217bd27ae732182397d5fafaf769
Python
32,112
592
""" Maked example plots. @author: bartulem """ import os import sys import json import numpy as np import pandas as pd import matplotlib.pyplot as plt import matplotlib.colorbar as cbar from scipy.stats import sem import neural_activity import select_clusters plt.rcParams['font.sans-serif'] = ['Helvetica'] class Pl...
5a665bf3db4e47a2544eaba4c7d09b14a68c86d809cec1650bcfc449fec9d596
Python
32,123
803
from __future__ import annotations import re import sys from datetime import date, datetime from decimal import Decimal from enum import Enum from typing import Any, Dict, List, Literal, Optional, Union from pydantic.version import VERSION as PYDANTIC_VERSION if int(PYDANTIC_VERSION[0]) >= 2: from pydantic impor...
a6e02f34a2a7feb2eeb5f16369e1340eea491e72d17ebb20ca6fdb43e9a43f61
Python
32,137
684
# imports ##################################################################### import matplotlib.pyplot as plt import copy import pickle import tensorflow as tf from tensorflow.keras.models import Sequential from tensorflow.keras.layers import Activation, Lambda, Dense from tensorflow.python.keras import backend as ...
7f6deee0d743a851bb48cd8dd255895a954af0be1def8a1a02f2525c9cd41cab
Python
32,255
945
"""Tests for multi-target training.""" # pylint: disable=unbalanced-tuple-unpacking import json import pickle from types import ModuleType from typing import Any, Callable, Dict, List, Optional, Tuple, Union import numpy as np import pytest from sklearn.datasets import ( make_classification, make_multilabel_c...
828f7ca64beb11ae06d0ac1972773e94ae09db19b21337d01bf2a983747e16f0
Python
32,283
972
"""Python implementation of the ProvONE Model Specification References: ProvONE: http://vcvcomputing.com/provone/provone.html """ import io import logging import os import shutil import tempfile from urllib.parse import urlparse from prov.constants import ( PROV_ASSOCIATION, PROV_ATTR_COLLECTION, PROV_AT...
d590e2a1feabb1eb0b0cc4336b7e6929243cf711f81a352c3c0a070c0a71d31f
Python
32,321
609
""" Adapted from: https://github.com/uzh-rpg/rpg_ev-transfer """ from __future__ import division import torch from tqdm import tqdm tqdm.monitor_interval = 0 import numpy as np from tensorboardX import SummaryWriter from utils.saver import CheckpointSaver from datasets.wrapper_dataloader import WrapperDataset import...
08fa385b68d1235edd36a3b979d4cf15cbd2eeccb1837548d48c01560348d749
Python
32,325
374
#### Master Script 6c: Calculate metrics for test set performance for sensitivity analysis #### # # Shubhayu Bhattacharyay # University of Cambridge # email address: sb2406@cam.ac.uk # ### Contents: # I. Initialisation # II. Calculate testing set sensitivity analysis metrics based on provided bootstrapping resample row...
bfd6f933359b23afed12ffcb43b1fc7db1b35bd5fb8cbdd5d9b0fd8b7edf7828
Python
32,331
716
# encoding: utf-8 # Author : Floyed<Floyed_Shen@outlook.com> # Datetime : 2022/4/28 14:56 # User : Floyed # Product : PyCharm # Project : braincog # File : main_simplified.py # explain : Simplified training script. Remove support for DDP, IMAGENET, Augment, etc. import argparse import time import ...
fd59a82269e5cbd1cdc8d35a006a4e2b5352788ff65a29050b68a8012b8941b3
Python
32,343
811
import contextlib import os import pickle import tempfile import numpy import pytest import cellprofiler_core.image import cellprofiler_core.measurement from cellprofiler_core.constants.measurement import COLTYPE_FLOAT, COLTYPE_INTEGER import cellprofiler.modules.classifyobjects import cellprofiler_core.object impo...
9c9ddcd186b45dcd821dd352e725ce173dfea87f962cb94a758b20dcb61171cf
Python
32,374
823
#!/public/EM/anaconda3/envs/relion-5.0/bin/python import argparse import math import sys, os from pathlib import Path import numpy as np import pandas as pd import starfile import torch import torch.nn as nn import torch.nn.functional as F import mrcfile import matplotlib matplotlib.use("Agg") # non-GUI backend, no...
077306461015f73d23b65947d63f291e6f96974982e4fff8ba40e9952be7e72c
Python
32,422
693
from numpy import identity import torch import torch.nn as nn from torch.nn import init import functools from torch.optim import lr_scheduler import math ############################################################################### # Helper Functions ##################################################################...
3fcfcd5c3db07ade233c861612180bc5efb3c8f0ced5a0dac1551b7e5bd07225
Python
32,511
738
"""This program provides a tool to complete a linear regression on nidm files""" import csv import os from statistics import mean import sys import tempfile import warnings import click import numpy as np import pandas as pd from patsy.contrasts import ContrastMatrix, Diff, Helmert, Sum, Treatment from patsy.highlevel...
a5101aee789ba6d863002fc3087f32402c26de65e97f77e1fde95e9a8dbf52d2
Python
32,554
983
import os import warnings import numpy as np import pdb2sql from deeprank.features import FeatureClass class AtomicFeature(FeatureClass): def __init__(self, pdbfile, chain1='A', chain2='B', param_charge=None, param_vdw=None, patch_file=None, contact_cutoff=8.5, verbose=False): ...
9ac57baff414e416aae68aeb3fc9cf73543e0ef5c805d37ec88bd5bd621ace3c
Python
32,788
809
""" Author: "Keitaro Yamashita, Garib N. Murshudov" MRC Laboratory of Molecular Biology This software is released under the Mozilla Public License, version 2.0; see LICENSE. """ from __future__ import absolute_import, division, print_function, generators import numpy import scipy.optimize import pandas import gemm...
12cb2af80bc737e15944ec205c02b8b9ac46b509b3e70b664b6f807b7ab862d8
Python
32,927
815
import contextlib import os import tempfile import numpy import pytest import six.moves from cellprofiler_core.constants.measurement import COLTYPE_INTEGER from cellprofiler_core.constants.workspace import DISPOSITION_CONTINUE, DISPOSITION_SKIP import tests.frontend.modules import cellprofiler_core.image import cellp...
7955e81edc184c2396b0928e7cc396657e94041b0fe773c98e6afce53044a2c7
Python
32,967
1,057
import json import sys from abc import abstractmethod from collections.abc import Iterable from copy import copy from importlib import import_module from multiprocessing import cpu_count from os import getcwd, linesep from os.path import splitext import numpy as np from numpy import arange, split from traitlets import...
d3fad9dcc9944588ffac06846b19f3dac975890fe05232d7be98839e7a93d8f2
Python
33,183
799
""" Relative Position Vision Transformer (ViT) in PyTorch NOTE: these models are experimental / WIP, expect changes Papers: * `An Image is Worth 16x16 Words: Transformers for Image Recognition at Scale` - https://arxiv.org/abs/2010.11929 * `Swin Transformer V2: Scaling Up Capacity and Resolution` - https://arxiv.org/...
4f7b5da21510285f1c21e700f4dd13d833d850512b67c5cf4ddad6cd82c2bd31
Python
33,226
1,097
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Thu Jun 20 22:15:11 2019 @author: Nikolai M Chapochnikov In this file are functions to simulate the original/default similarity matching circuit as well as the olfactory circuit. There are classes for the default similarity matching and the olfactory circ...
1e67ce1c298423e1e17ad60aa56f992237dd21ae2407f284c9630114e079b40e
Python
33,326
689
#!/usr/bin/env python # MIT License # # Copyright (c) 2022 Matthis Ebel, Mario Stanke # # 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 limitat...
0041f44afb0d3480eccd6915c9b666eebf9dea25005a656150e396f3ac263f0c
Python
33,329
950
import math import torch import pandas as pd import pytorch_lightning as pl from pathlib import Path from typing import List, Optional import torch.nn as nn import torch.nn.functional as F from torch.optim.lr_scheduler import OneCycleLR from pysmilesutils.augment import SMILESAugmenter from molbart.tokeniser import ...
762287e34cef2112eaad63fed3d5938d4314bfd86144f881f13c1269aeaf4f6c
Python
33,346
717
import numpy from ..constants.image import CT_OBJECTS from ..constants.measurement import COLTYPE_INTEGER, COLTYPE_VARCHAR, IMAGE from ..constants.measurement import C_FILE_NAME from ..constants.measurement import C_METADATA from ..constants.measurement import C_OBJECTS_FILE_NAME from ..constants.measurement import C_...
138edb7aa65cde7ee4a6aadb5a62789a0eb44a368009cd3aa7aefb1c78330d19
Python
33,369
923
""" EfficientViT (by MSRA) Papers: * `EfficientViT: Memory Efficient Vision Transformer with Cascaded Group Attention` - https://arxiv.org/abs/2305.07027 Adapted from official impl at https://github.com/microsoft/Cream/tree/main/EfficientViT """ __all__ = ['EfficientVitMsra'] import itertools from collections import...
e78cf9f4f96ad8436f1e702d9351d406fb5aa92305610cdd3622df94862c17da
Python
33,490
739
import math import random import string from typing import List, Tuple from Bio import SeqIO import esm import numpy as np import pandas as pd import torch import torch.nn as nn import torch.nn.functional as F import torch_cluster import torch_geometric import torch_scatter from atom3d.datasets import LMDBDataset from...
6433459f10d958dae9b14e6f53d9d8b1317349ceb33f551c227ab4e9cac68004
Python
33,560
771
from __future__ import print_function import numpy as np from collections import deque from allensdk.core.brain_observatory_cache import BrainObservatoryCache import allensdk.brain_observatory.stimulus_info as si from scipy.ndimage.interpolation import zoom import os import sys import copy from scipy.ndimage.filters i...
8d51ec793d30bee759324b6adf86c19fbc856a5d7f16124a91ee680b71618942
Python
33,567
962
""" DaViT: Dual Attention Vision Transformers Papers: * `DaViT: Dual Attention Vision Transformers` - https://arxiv.org/abs/2204.03645 * `Florence-2: Advancing a Unified Representation for a Variety of Vision Tasks` - https://arxiv.org/abs/2311.06242 Input size invariant transformer architecture that combines channel...
03d605c6885e1a75a3e1dc70ffb70daf9b320c9608287e6fef6831be1ed4179c
Python
33,596
969
""" EfficientFormer-V2 Papers: * `Rethinking Vision Transformers for MobileNet Size and Speed` - https://arxiv.org/abs/2212.08059 @article{ li2022rethinking, title={Rethinking Vision Transformers for MobileNet Size and Speed}, author={Li, Yanyu and Hu, Ju and Wen, Yang and Evangelidis, Georgios and Salahi...
0ed07e6e4c73b21eb7414861173c0975d2026938060adff4cc9d91ea8a93edb2
Python
33,659
891
# The help text for various thresholding options whose code resides here is in modules/identify.py from __future__ import absolute_import from __future__ import division import inspect import math import numpy as np import scipy.ndimage import scipy.sparse import scipy.interpolate from .otsu import otsu, entropy, ot...
1efc1f0fdeac5969bd4027e185079707d51bbee8cfab70ddf58e93738ff76715
Python
33,710
991
"""Publication figures for the AFIDs Validator education paper. Regenerates all five manuscript figures from source (the MNI human FCSV templates and the cached MNI152NLin2009cAsym T1w volume). Outputs 300-dpi PNG and vector PDF to paper_figures/. python make_figures.py The inter-template variability analysis (F...
8020b15d44096fb9479f818036c6f1dbf760bb1310f297d2c799f6a6dc850d20
Python
33,755
913
import os import sys import time import logging import h5py import matplotlib import matplotlib.pyplot as plt import matplotlib.ticker as mtick import numpy as np import warnings import tempfile import torch import torch.cuda import torch.nn as nn import torch.nn.functional as F import torch.optim as optim import tor...
96bbb24e1a5a4c37266bac4f1a533e9d84d0a620be9dcc0a377fb781ce56e131
Python
33,817
1,033
import functools import numpy import numpy.testing import pytest import six.moves import skimage.util import tests.frontend.modules import cellprofiler_core.image import cellprofiler_core.measurement import cellprofiler_core.module import cellprofiler.modules.imagemath import cellprofiler_core.object import cellpro...
4180d0f54f990c03abfbd3a5e6632f7f38ddda8d318eae683908b039bbc9107e
Python
33,926
849
""" NaFlex (NaViT + FlexiViT) Transforms and Collation Implements PyTorch versions of the transforms described in the NaViT and FlexiViT papers: - NaViT: https://arxiv.org/abs/2307.14995 - FlexiViT: https://arxiv.org/abs/2212.08013 Enables variable resolution/aspect ratio image handling with efficient patching. Hack...
f3685f0a36252556580fad53671c82fa6c4b21d295e17610740c85ead5d5b8cd
Python
33,964
794
"""DeepSeek Vision Transformer Vision encoder of the DeepSeek-V4 / V4.1 multimodal models from DeepSeek-AI. Papers: * `DeepSeek-V4.1-Flash: Pushing the Limits of KV Cache Compression` - https://arxiv.org/abs/2609.19969 A plain pre-norm ViT with RMSNorm, fused QKV with bias, a bias-free SwiGLU MLP and axial 2D RoPE (...
b49869ea90b2d7a46ebd1d38b28617960c207138b692f34d8fda8d593c1a7a63
Python
34,105
734
""" Author: Mingjian He <mh1@stanford.edu> traditional module contains traditional methods for switching inference """ from somata.basic_models import StateSpaceModel as Ssm from somata.exact_inference import forward_backward, logdet, inverse import numpy as np def switching(ssm_array, y=None, method='static', dwel...
ff600ae2fede9417f898b0c74aae7ce9de0f8d86a8bc4e86489d59790faa5f92
Python
34,172
1,234
import math import centriole.outline import numpy import numpy.testing import pytest import skimage.measure import skimage.segmentation import cellprofiler_core.image import cellprofiler_core.measurement from cellprofiler_core.constants.measurement import EXPERIMENT, COLTYPE_FLOAT, C_LOCATION import cellprofiler.mo...
c5f868739698ae155275b5530b03140848f0d3eba99440cb0b0d949bbf6811fb
Python
34,175
855
""" Crop ==== **Crop** crops or masks an image. This module crops images into a rectangle, ellipse, an arbitrary shape provided by you, the shape of object(s) identified by an **Identify** module, or a shape created using a previous **Crop** module in the pipeline. Keep in mind that cropping changes the size of your...
3ef7b3f1f28d3068eb82c8372475c977afba1700cfe4aa0ffe60337819f80431
Python
34,244
894
""" MLP-Mixer, ResMLP, and gMLP in PyTorch This impl originally based on MLP-Mixer paper. Official JAX impl: https://github.com/google-research/vision_transformer/blob/linen/vit_jax/models_mixer.py Paper: * `MLP-Mixer: An all-MLP Architecture for Vision` - https://arxiv.org/abs/2105.01601 @article{tolstikhin2021, ...
f72873879575b527b602e725e93546256e5166dc0e04b26530548b059fc52642
Python
34,278
788
from __future__ import print_function import numpy as np from collections import deque from allensdk.core.brain_observatory_cache import BrainObservatoryCache import allensdk.brain_observatory.stimulus_info as si from scipy.ndimage.interpolation import zoom import os import sys import copy from scipy.ndimage.filters i...
350bd3ccce7e707265f05c9d7fb91100bc6cd898402183de6ae0bc0af054f175
Python
34,342
887
"""LowFormer LowFormer: Hardware Efficient Design for Convolutional Transformer Backbones (WACV 2025) - `LowFormer: Hardware Efficient Design for Convolutional Transformer Backbones` - https://arxiv.org/abs/2409.03460 - code: https://github.com/altair199797/LowFormer @article{Nottebaum2024LowFormerHE, title={LowForme...
a72925e656831f7b9aa52848642f15ba93290f1a989b93b35652013b7b83d63f
Python
34,554
930
# -*- coding: utf-8 -*- # (C) Copyright 2020, 2021, 2022, 2023 IBM. All Rights Reserved. # # This code is licensed under the Apache License, Version 2.0. You may # obtain a copy of this license in the LICENSE.txt file in the root directory # of this source tree or at http://www.apache.org/licenses/LICENSE-2.0. # # Any...
0e8f7c6dd70f71af88445dcc5a4b6c2c86972dcda5669127e2ba407548d76cb8
Python
34,632
842
import numpy as np import itertools class gabor_wavelet_preprocessing_linquad: def __init__(self, stimulus, movie_hz=30, temporal_window=11, spatial_frequencies=[0,2,4,8,16], temporal_frequencies=[0,2,4], simpl...
fbe4a9d96e895fc27e53f0ea9e98cff230f464f10edef1f342b95c4bbd8b3d2c
Python
34,759
765
# -*- coding: utf-8 -*- """ @author: bartulem Compute cluster quality measures for 'good' and 'mua' clusters. This script computes various cluster quality measures for clusters labeled as 'good' or 'mua' in the cluster_info.tsv file. Measures include various waveform metrics (SNR, spike duration, FWHM, PT-ratio), c...
f3fbaf20191c1d07e67428899a159eeca6c522282968882fa7f0f953d2cfcec6
Python
34,794
979
import io import centriole.threshold import numpy import cellprofiler_core.image import cellprofiler_core.measurement from cellprofiler_core.constants.measurement import COLTYPE_FLOAT, EXPERIMENT from cellprofiler_core.constants.module._identify import O_FOREGROUND, O_THREE_CLASS, O_WEIGHTED_VARIANCE, O_TWO_CLASS, \ ...
43454f848f527909647e5b4cc2949bbc2890aa8f36363792116bd03ed947cd89
Python
34,814
863
""" Author: "Keitaro Yamashita, Garib N. Murshudov" MRC Laboratory of Molecular Biology This software is released under the Mozilla Public License, version 2.0; see LICENSE. """ from __future__ import absolute_import, division, print_function, generators from servalcat.utils import logger from servalcat.utils impo...
859bf441abf8fb1f236efe3e0ea23d5e4282818c353f45a940d6c6c587d6141f
Python
34,856
671
import random import sys import math import numpy as np import damask import pandas as pd import seaborn as sns import matplotlib.pyplot as plt from PIL import Image, ImageOps import time from dragen.generation.DiscreteRsa3D import DiscreteRsa3D from dragen.generation.DiscreteTesselation3D import Tesselation3D from dr...
a90abe64ee95e0e2fc589b1bc86e2c9ef90f5aa57b07c2961bdbb03b79c942e3
Python
34,869
863
# This file is part of pyunicorn. # Copyright (C) 2008--2026 Jonathan F. Donges and pyunicorn authors # URL: <https://www.pik-potsdam.de/members/donges/software-2/software> # License: BSD (3-clause) # # Please acknowledge and cite the use of this software and its authors # when results are used in publications or publi...
47ce957320cf7d0168575fb0187f3d1868acf72cbf22471379866165147454ce
Python
34,926
971
import math import torch import pandas as pd import pytorch_lightning as pl from pathlib import Path from typing import List, Optional import torch.nn as nn import torch.nn.functional as F from torch.optim.lr_scheduler import OneCycleLR from pysmilesutils.augment import SMILESAugmenter from molbart.tokeniser import ...
2af7b930a05fc7111929bb5872dc4374177dce492be4624e0e3db0608bded4fe
Python
35,000
725
import os import pandas as pd import numpy as np from sklearn.preprocessing import StandardScaler import matplotlib.pyplot as plt from matplotlib import gridspec import matplotlib.transforms as transforms from matplotlib.colors import LinearSegmentedColormap from matplotlib import cm from matplotlib.colors import List...
0d4ac6f4374e4538bb32ae120da0295e9bbe962d922f3928cb2912db007ee8bc
Python
35,054
900
"""CSATv2 A frequency-domain vision model using DCT transforms with spatial attention. Paper: TBD This model created by members of MLPA Lab. Welcome feedback and suggestion, questions. gusdlf93@naver.com juno.demie.oh@gmail.com Refined for timm by Ross Wightman """ import math import warnings from functools import ...
026b923a7f047c42623306483ba578404a6b838892030ff2624ffbb3d47a6c9f
Python
35,076
1,006
# This file is part of pyunicorn. # Copyright (C) 2008--2026 Jonathan F. Donges and pyunicorn authors # URL: <https://www.pik-potsdam.de/members/donges/software-2/software> # License: BSD (3-clause) # # Please acknowledge and cite the use of this software and its authors # when results are used in publications or publi...
0892d76ea42cc8d64c94cfcf49dc485428e08a9b709fc7d56d96a0e5c913a41d
Python
35,122
698
import logging import pytorch_lightning as pl import torch import numpy as np import pandas as pd from torchvision.transforms import ( Compose, ) from pytorch_lightning.loggers import TensorBoardLogger from utils import get_model_by_name import torch.nn.functional as F from dataset import COPDGeneSubtyping, Subtypi...
701a598c5144e57ca5fabbe39289e6aa58ad1c4000b023122ddab5212ef0b289
Python
35,139
826
# -*- coding: utf-8 -*- import datetime import numpy as np import pytest import pysteps from pysteps import blending, cascade # fmt:off steps_arg_values = [ (1, 3, 4, 8, 'steps', None, None, False, "spn", True, 4, False, False, 0, False, None, None, None), (1, 3, 4, 8,'steps', "obs", None, False, "spn", Tru...
317c698daa841a956ff9054d1161c5d96eeeedb4b9e3d87ddb588b9257bfeae4
Python
35,243
882
import numpy import scipy.ndimage from cellprofiler.modules import _help, threshold from cellprofiler_core.constants.measurement import ( FF_CHILDREN_COUNT, FF_PARENT, FTR_CENTER_Z, FTR_CENTER_Y, FTR_CENTER_X, C_LOCATION, C_NUMBER, FTR_OBJECT_NUMBER, C_PARENT, C_CHILDREN, C...
17e88bae22f862d0a447084323d4561561dc5e64694ab183c40ee5009669eabe
Python
35,256
843
""" NasNet-A (Large) nasnetalarge implementation grabbed from Cadene's pretrained models https://github.com/Cadene/pretrained-models.pytorch Papers: * `Learning Transferable Architectures for Scalable Image Recognition` - https://arxiv.org/abs/1707.07012 """ from functools import partial from typing import List, Opt...
2e6109fee84a809b9e6db1626d2a1d28fa040983f3b8c207f52042855e8afc65
Python
35,266
994
"""iFormer iFormer: Integrating ConvNet and Transformer for Mobile Application (ICLR 2025) - `iFormer: Integrating ConvNet and Transformer for Mobile Application` - https://arxiv.org/abs/2501.15369 - code: https://github.com/ChuanyangZheng/iFormer @inproceedings{zheng2025iformer, title={iformer: Integrating convnet a...
69e2bb802d43c6783d22a05b0dd918383ce8026107df4c008e9a6e310a2f5fbc
Python
35,307
859
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Tue Apr 19 10:04:52 2022 @author: obernauer """ import os import random import pickle import numpy as np import matplotlib.pyplot as plt import tensorflow as tf from tensorflow import keras from tqdm import tqdm from stm import STM import matplotlib from ...
9ab73bb2dbd89d32225597d5ee65fbad323b624a1b871e51623bdb5cdb7ee34e
Python
35,463
990
import io import json import os import tempfile import cellprofiler_core.constants.measurement import cellprofiler_core.constants.modules.images import cellprofiler_core.constants.modules.metadata import cellprofiler_core.measurement import cellprofiler_core.modules.images import cellprofiler_core.modules.metadata imp...
23d0eaa9b39dce7cc8c5c141042d506d4eccb54969f809b7a4516de13df61369
Python
35,800
619
#### Master Script 05c: Calculating TimeSHAP for dynAPM_DeepMN models in parallel #### # # Shubhayu Bhattacharyay # University of Cambridge # email address: sb2406@cam.ac.uk # ### Contents: # I. Initialisation # II. Calculate testing set TimeSHAP values based on provided TimeSHAP partition row index ### I. Initialisat...
ab4e86988b2fdfbc914a31a0cb3aef573b63ef2615df9d9a0770b9fcd86bd26c
Python
35,803
990
# -*- coding: utf-8 -*- """ pysteps.io.exporters ==================== Methods for exporting forecasts of 2d precipitation fields into various file formats. Each exporter method in this module has its own initialization function that implements the following interface:: initialize_forecast_exporter_xxx(outpath, out...
e366c0aaf9d99c0e1d8155d8456f07570d0f937e1acf67e3bd6c818baffd88ea
Python
35,822
1,003
# Usage # # (c) TGEN 2020 # requires python 3.0 with pandas, numpy, pysam packages # # print("Importing Packages") # Configure Enviroment import pandas as pd import numpy as np import pysam import sys import os.path import re import argparse from subprocess import call import itertools # Variables minimum_count_thre...
9a9759f5c71af6381c715371f45c0454b45fde50887b3b13866b5ddd0054e518
Python
35,909
998
""" AutoAugment, RandAugment, AugMix, and 3-Augment for PyTorch This code implements the searched ImageNet policies with various tweaks and improvements and does not include any of the search code. AA and RA Implementation adapted from: https://github.com/tensorflow/tpu/blob/master/models/official/efficientnet/au...
535c0698286b37d3a66fb885f5413c516a696390b24ec97ffb7bcf1d2923731e
Python
36,262
1,098
#!/usr/bin/python3 def inv_rank(m, tol=1E-8, method='auto', logger=None, mpc=0, qr=0, **ka): """Computes matrix (pseudo-)inverse and rank with SVD. Eigenvalues smaller than tol*largest eigenvalue are set to 0. Rank of inverted matrix is also returned. Provides to limit the number of eigenvalues to speed up computa...