repo stringlengths 2 99 | file stringlengths 13 225 | code stringlengths 0 18.3M | file_length int64 0 18.3M | avg_line_length float64 0 1.36M | max_line_length int64 0 4.26M | extension_type stringclasses 1
value |
|---|---|---|---|---|---|---|
CoTr | CoTr-main/nnUNet/nnunet/utilities/recursive_rename_taskXX_to_taskXXX.py | # Copyright 2020 Division of Medical Image Computing, German Cancer Research Center (DKFZ), Heidelberg, Germany
#
# 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://w... | 1,770 | 41.166667 | 114 | py |
CoTr | CoTr-main/nnUNet/nnunet/run/default_configuration.py | # Copyright 2020 Division of Medical Image Computing, German Cancer Research Center (DKFZ), Heidelberg, Germany
#
# 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://w... | 3,818 | 46.148148 | 119 | py |
CoTr | CoTr-main/nnUNet/nnunet/run/run_training_DDP.py | # Copyright 2020 Division of Medical Image Computing, German Cancer Research Center (DKFZ), Heidelberg, Germany
#
# 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://w... | 9,856 | 55.976879 | 135 | py |
CoTr | CoTr-main/nnUNet/nnunet/run/run_training.py | # Copyright 2020 Division of Medical Image Computing, German Cancer Research Center (DKFZ), Heidelberg, Germany
#
# 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://w... | 8,977 | 51.811765 | 135 | py |
CoTr | CoTr-main/nnUNet/nnunet/run/__init__.py | from __future__ import absolute_import
from . import * | 54 | 26.5 | 38 | py |
CoTr | CoTr-main/nnUNet/nnunet/run/run_training_DP.py | # Copyright 2020 Division of Medical Image Computing, German Cancer Research Center (DKFZ), Heidelberg, Germany
#
# 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://w... | 9,863 | 56.017341 | 135 | py |
CoTr | CoTr-main/nnUNet/nnunet/experiment_planning/nnUNet_convert_decathlon_task.py | # Copyright 2020 Division of Medical Image Computing, German Cancer Research Center (DKFZ), Heidelberg, Germany
#
# 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://w... | 4,015 | 60.784615 | 121 | py |
CoTr | CoTr-main/nnUNet/nnunet/experiment_planning/DatasetAnalyzer.py | # Copyright 2020 Division of Medical Image Computing, German Cancer Research Center (DKFZ), Heidelberg, Germany
#
# 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://w... | 11,051 | 42.003891 | 118 | py |
CoTr | CoTr-main/nnUNet/nnunet/experiment_planning/summarize_plans.py | # Copyright 2020 Division of Medical Image Computing, German Cancer Research Center (DKFZ), Heidelberg, Germany
#
# 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://w... | 4,189 | 51.375 | 225 | py |
CoTr | CoTr-main/nnUNet/nnunet/experiment_planning/experiment_planner_baseline_2DUNet.py | # Copyright 2020 Division of Medical Image Computing, German Cancer Research Center (DKFZ), Heidelberg, Germany
#
# 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://w... | 8,764 | 54.125786 | 120 | py |
CoTr | CoTr-main/nnUNet/nnunet/experiment_planning/experiment_planner_baseline_3DUNet.py | # Copyright 2020 Division of Medical Image Computing, German Cancer Research Center (DKFZ), Heidelberg, Germany
#
# 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://w... | 26,490 | 52.73428 | 147 | py |
CoTr | CoTr-main/nnUNet/nnunet/experiment_planning/nnUNet_plan_and_preprocess.py | # Copyright 2020 Division of Medical Image Computing, German Cancer Research Center (DKFZ), Heidelberg, Germany
#
# 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://w... | 7,009 | 49.431655 | 148 | py |
CoTr | CoTr-main/nnUNet/nnunet/experiment_planning/utils.py | # Copyright 2020 Division of Medical Image Computing, German Cancer Research Center (DKFZ), Heidelberg, Germany
#
# 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://w... | 9,635 | 42.210762 | 120 | py |
CoTr | CoTr-main/nnUNet/nnunet/experiment_planning/experiment_planner_baseline_2DUNet_v21.py | # Copyright 2020 Division of Medical Image Computing, German Cancer Research Center (DKFZ), Heidelberg, Germany
#
# 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://w... | 4,537 | 57.935065 | 120 | py |
CoTr | CoTr-main/nnUNet/nnunet/experiment_planning/common_utils.py | # Copyright 2020 Division of Medical Image Computing, German Cancer Research Center (DKFZ), Heidelberg, Germany
#
# 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://w... | 10,545 | 38.350746 | 217 | py |
CoTr | CoTr-main/nnUNet/nnunet/experiment_planning/change_batch_size.py | from batchgenerators.utilities.file_and_folder_operations import *
import numpy as np
if __name__ == '__main__':
input_file = '/home/fabian/data/nnUNet_preprocessed/Task004_Hippocampus/nnUNetPlansv2.1_plans_3D.pkl'
output_file = '/home/fabian/data/nnUNet_preprocessed/Task004_Hippocampus/nnUNetPlansv2.1_LISA_pl... | 500 | 54.666667 | 111 | py |
CoTr | CoTr-main/nnUNet/nnunet/experiment_planning/__init__.py | from __future__ import absolute_import
from . import * | 54 | 26.5 | 38 | py |
CoTr | CoTr-main/nnUNet/nnunet/experiment_planning/experiment_planner_baseline_3DUNet_v21.py | # Copyright 2020 Division of Medical Image Computing, German Cancer Research Center (DKFZ), Heidelberg, Germany
#
# 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://w... | 10,252 | 55.961111 | 147 | py |
CoTr | CoTr-main/nnUNet/nnunet/experiment_planning/alternative_experiment_planning/experiment_planner_baseline_3DUNet_v21_3convperstage.py | # Copyright 2020 Division of Medical Image Computing, German Cancer Research Center (DKFZ), Heidelberg, Germany
#
# 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://w... | 1,932 | 46.146341 | 116 | py |
CoTr | CoTr-main/nnUNet/nnunet/experiment_planning/alternative_experiment_planning/experiment_planner_baseline_3DUNet_v21_11GB.py | # Copyright 2020 Division of Medical Image Computing, German Cancer Research Center (DKFZ), Heidelberg, Germany
#
# 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://w... | 6,712 | 52.704 | 147 | py |
CoTr | CoTr-main/nnUNet/nnunet/experiment_planning/alternative_experiment_planning/experiment_planner_baseline_3DUNet_v22.py | # Copyright 2020 Division of Medical Image Computing, German Cancer Research Center (DKFZ), Heidelberg, Germany
#
# 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://w... | 3,151 | 51.533333 | 123 | py |
CoTr | CoTr-main/nnUNet/nnunet/experiment_planning/alternative_experiment_planning/experiment_planner_residual_3DUNet_v21.py | # Copyright 2020 Division of Medical Image Computing, German Cancer Research Center (DKFZ), Heidelberg, Germany
#
# 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://w... | 7,394 | 54.601504 | 147 | py |
CoTr | CoTr-main/nnUNet/nnunet/experiment_planning/alternative_experiment_planning/experiment_planner_baseline_3DUNet_v21_32GB.py | # Copyright 2020 Division of Medical Image Computing, German Cancer Research Center (DKFZ), Heidelberg, Germany
#
# 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://w... | 6,710 | 53.560976 | 147 | py |
CoTr | CoTr-main/nnUNet/nnunet/experiment_planning/alternative_experiment_planning/experiment_planner_baseline_3DUNet_v23.py | # Copyright 2020 Division of Medical Image Computing, German Cancer Research Center (DKFZ), Heidelberg, Germany
#
# 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://w... | 1,337 | 45.137931 | 114 | py |
CoTr | CoTr-main/nnUNet/nnunet/experiment_planning/alternative_experiment_planning/normalization/experiment_planner_3DUNet_nonCT.py | # Copyright 2020 Division of Medical Image Computing, German Cancer Research Center (DKFZ), Heidelberg, Germany
#
# 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://w... | 1,765 | 39.136364 | 117 | py |
CoTr | CoTr-main/nnUNet/nnunet/experiment_planning/alternative_experiment_planning/normalization/experiment_planner_3DUNet_CT2.py | # Copyright 2020 Division of Medical Image Computing, German Cancer Research Center (DKFZ), Heidelberg, Germany
#
# 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://w... | 2,016 | 42.847826 | 129 | py |
CoTr | CoTr-main/nnUNet/nnunet/experiment_planning/alternative_experiment_planning/pooling_and_convs/experiment_planner_baseline_3DUNet_allConv3x3.py | # Copyright 2020 Division of Medical Image Computing, German Cancer Research Center (DKFZ), Heidelberg, Germany
#
# 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://w... | 7,689 | 53.928571 | 147 | py |
CoTr | CoTr-main/nnUNet/nnunet/experiment_planning/alternative_experiment_planning/pooling_and_convs/experiment_planner_baseline_3DUNet_poolBasedOnSpacing.py | # Copyright 2020 Division of Medical Image Computing, German Cancer Research Center (DKFZ), Heidelberg, Germany
#
# 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://w... | 6,758 | 53.072 | 147 | py |
CoTr | CoTr-main/nnUNet/nnunet/experiment_planning/alternative_experiment_planning/patch_size/experiment_planner_3DUNet_isotropic_in_voxels.py | # Copyright 2020 Division of Medical Image Computing, German Cancer Research Center (DKFZ), Heidelberg, Germany
#
# 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://w... | 6,300 | 53.318966 | 122 | py |
CoTr | CoTr-main/nnUNet/nnunet/experiment_planning/alternative_experiment_planning/patch_size/experiment_planner_3DUNet_isotropic_in_mm.py | # Copyright 2020 Division of Medical Image Computing, German Cancer Research Center (DKFZ), Heidelberg, Germany
#
# 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://w... | 7,007 | 53.325581 | 147 | py |
CoTr | CoTr-main/nnUNet/nnunet/experiment_planning/alternative_experiment_planning/target_spacing/experiment_planner_baseline_3DUNet_targetSpacingForAnisoAxis.py | # Copyright 2020 Division of Medical Image Computing, German Cancer Research Center (DKFZ), Heidelberg, Germany
#
# 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://w... | 3,624 | 55.640625 | 120 | py |
CoTr | CoTr-main/nnUNet/nnunet/experiment_planning/old/old_plan_and_preprocess_task.py | # Copyright 2020 Division of Medical Image Computing, German Cancer Research Center (DKFZ), Heidelberg, Germany
#
# 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://w... | 5,224 | 57.055556 | 121 | py |
CoTr | CoTr-main/nnUNet/nnunet/inference/segmentation_export.py | # Copyright 2020 Division of Medical Image Computing, German Cancer Research Center (DKFZ), Heidelberg, Germany
#
# 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://w... | 11,710 | 50.139738 | 120 | py |
CoTr | CoTr-main/nnUNet/nnunet/inference/ensemble_predictions.py | # Copyright 2020 Division of Medical Image Computing, German Cancer Research Center (DKFZ), Heidelberg, Germany
#
# 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://w... | 6,300 | 47.844961 | 124 | py |
CoTr | CoTr-main/nnUNet/nnunet/inference/predict_simple.py | # Copyright 2020 Division of Medical Image Computing, German Cancer Research Center (DKFZ), Heidelberg, Germany
#
# 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://w... | 13,593 | 59.150442 | 125 | py |
CoTr | CoTr-main/nnUNet/nnunet/inference/__init__.py | from __future__ import absolute_import
from . import * | 54 | 26.5 | 38 | py |
CoTr | CoTr-main/nnUNet/nnunet/inference/change_trainer.py | # Copyright 2020 Division of Medical Image Computing, German Cancer Research Center (DKFZ), Heidelberg, Germany
#
# 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://w... | 2,683 | 50.615385 | 158 | py |
CoTr | CoTr-main/nnUNet/nnunet/inference/predict.py | # Copyright 2020 Division of Medical Image Computing, German Cancer Research Center (DKFZ), Heidelberg, Germany
#
# 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://w... | 42,543 | 51.98132 | 182 | py |
CoTr | CoTr-main/nnUNet/nnunet/inference/pretrained_models/collect_pretrained_models.py | # Copyright 2020 Division of Medical Image Computing, German Cancer Research Center (DKFZ), Heidelberg, Germany
#
# 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://w... | 14,191 | 51.176471 | 125 | py |
CoTr | CoTr-main/nnUNet/nnunet/inference/pretrained_models/download_pretrained_model.py | # Copyright 2020 Division of Medical Image Computing, German Cancer Research Center (DKFZ), Heidelberg, Germany
#
# 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://w... | 19,076 | 55.946269 | 191 | py |
CoTr | CoTr-main/nnUNet/nnunet/preprocessing/preprocessing.py | # Copyright 2020 Division of Medical Image Computing, German Cancer Research Center (DKFZ), Heidelberg, Germany
#
# 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://w... | 35,625 | 49.821683 | 136 | py |
CoTr | CoTr-main/nnUNet/nnunet/preprocessing/cropping.py | # Copyright 2020 Division of Medical Image Computing, German Cancer Research Center (DKFZ), Heidelberg, Germany
#
# 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://w... | 8,571 | 38.502304 | 120 | py |
CoTr | CoTr-main/nnUNet/nnunet/preprocessing/sanity_checks.py | # Copyright 2020 Division of Medical Image Computing, German Cancer Research Center (DKFZ), Heidelberg, Germany
#
# 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://w... | 11,771 | 42.925373 | 187 | py |
CoTr | CoTr-main/nnUNet/nnunet/preprocessing/__init__.py | from __future__ import absolute_import
from . import * | 54 | 26.5 | 38 | py |
CoTr | CoTr-main/CoTr_package/setup.py | from setuptools import setup, find_namespace_packages
setup(name='CoTr',
packages=find_namespace_packages(include=["CoTr", "CoTr.*"]),
version='0.0.1'
)
| 172 | 23.714286 | 67 | py |
CoTr | CoTr-main/CoTr_package/CoTr/configuration.py | import os
default_num_threads = 8 if 'nnUNet_def_n_proc' not in os.environ else int(os.environ['nnUNet_def_n_proc'])
RESAMPLING_SEPARATE_Z_ANISO_THRESHOLD = 3 # determines what threshold to use for resampling the low resolution axis
# separately (with NN) | 257 | 50.6 | 116 | py |
CoTr | CoTr-main/CoTr_package/CoTr/__init__.py | from __future__ import absolute_import
print("This is CoTr\n")
from . import * | 80 | 15.2 | 38 | py |
CoTr | CoTr-main/CoTr_package/CoTr/training/__init__.py | from __future__ import absolute_import
from . import * | 54 | 26.5 | 38 | py |
CoTr | CoTr-main/CoTr_package/CoTr/training/model_restore.py | import CoTr
import torch
from batchgenerators.utilities.file_and_folder_operations import *
import importlib
import pkgutil
from nnunet.training.network_training.nnUNetTrainer import nnUNetTrainer
def recursive_find_python_class(folder, trainer_name, current_module):
tr = None
for importer, modname, ispkg in ... | 4,979 | 43.070796 | 130 | py |
CoTr | CoTr-main/CoTr_package/CoTr/training/network_training/nnUNetTrainerV2_ResTrans.py | from collections import OrderedDict
from typing import Tuple
import numpy as np
import torch
import shutil
from nnunet.training.loss_functions.deep_supervision import MultipleOutputLoss2
from nnunet.utilities.to_torch import maybe_to_torch, to_cuda
from nnunet.training.data_augmentation.default_data_augmentation impor... | 18,610 | 46.843188 | 151 | py |
CoTr | CoTr-main/CoTr_package/CoTr/training/network_training/__init__.py | from __future__ import absolute_import
from . import * | 54 | 26.5 | 38 | py |
CoTr | CoTr-main/CoTr_package/CoTr/training/network_training/network_trainer.py | # Copyright 2020 Division of Medical Image Computing, German Cancer Research Center (DKFZ), Heidelberg, Germany
#
# 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://w... | 30,846 | 41.372253 | 150 | py |
CoTr | CoTr-main/CoTr_package/CoTr/training/network_training/nnUNetTrainer.py | # Copyright 2020 Division of Medical Image Computing, German Cancer Research Center (DKFZ), Heidelberg, Germany
#
# 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://w... | 39,572 | 53.061475 | 142 | py |
CoTr | CoTr-main/CoTr_package/CoTr/network_architecture/neural_network.py | # Copyright 2020 Division of Medical Image Computing, German Cancer Research Center (DKFZ), Heidelberg, Germany
#
# 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://w... | 44,025 | 52.107358 | 137 | py |
CoTr | CoTr-main/CoTr_package/CoTr/network_architecture/CNNBackbone.py | # ------------------------------------------------------------------------
# CNN encoder
# ------------------------------------------------------------------------
import torch
import torch.nn as nn
import torch.nn.functional as F
from torch.autograd import Variable
import math
from functools import partial
class Co... | 6,314 | 37.272727 | 152 | py |
CoTr | CoTr-main/CoTr_package/CoTr/network_architecture/__init__.py | from __future__ import absolute_import
from . import * | 54 | 26.5 | 38 | py |
CoTr | CoTr-main/CoTr_package/CoTr/network_architecture/ResTranUnet.py | # ------------------------------------------------------------------------
# CoTr
# ------------------------------------------------------------------------
import torch
import torch.nn as nn
import torch.nn.functional as F
import numpy as np
from CoTr.network_architecture import CNNBackbone
from CoTr.network_architec... | 9,009 | 41.701422 | 191 | py |
CoTr | CoTr-main/CoTr_package/CoTr/network_architecture/DeTrans/position_encoding.py | """
Positional encodings for the transformer.
"""
import math
import torch
from torch import nn
from typing import Optional
from torch import Tensor
class PositionEmbeddingSine(nn.Module):
"""
This is a more standard version of the position embedding, very similar to the one
used by the Attention is all yo... | 3,032 | 39.986486 | 109 | py |
CoTr | CoTr-main/CoTr_package/CoTr/network_architecture/DeTrans/DeformableTrans.py | # ------------------------------------------------------------------------
# 3D Deformable Transformer
# ------------------------------------------------------------------------
# Modified from Deformable DETR
# Copyright (c) 2020 SenseTime. All Rights Reserved.
# Licensed under the Apache License, Version 2.0 [see LI... | 7,149 | 38.502762 | 132 | py |
CoTr | CoTr-main/CoTr_package/CoTr/network_architecture/DeTrans/ops/functions/ms_deform_attn_func.py | # ------------------------------------------------------------------------
# 3D Deformable Self-attention
# ------------------------------------------------------------------------
# Modified from Deformable DETR
# Copyright (c) 2020 SenseTime. All Rights Reserved.
# Licensed under the Apache License, Version 2.0 [see ... | 1,798 | 55.21875 | 161 | py |
CoTr | CoTr-main/CoTr_package/CoTr/network_architecture/DeTrans/ops/modules/__init__.py | from .ms_deform_attn import MSDeformAttn
| 41 | 20 | 40 | py |
CoTr | CoTr-main/CoTr_package/CoTr/network_architecture/DeTrans/ops/modules/ms_deform_attn.py | # ------------------------------------------------------------------------
# 3D Deformable Self-attention
# ------------------------------------------------------------------------
# Modified from Deformable DETR
# Copyright (c) 2020 SenseTime. All Rights Reserved.
# Licensed under the Apache License, Version 2.0 [see ... | 5,082 | 51.402062 | 193 | py |
CoTr | CoTr-main/CoTr_package/CoTr/run/default_configuration.py | import nnunet
from nnunet.paths import network_training_output_dir, preprocessing_output_dir, default_plans_identifier
from batchgenerators.utilities.file_and_folder_operations import *
from nnunet.experiment_planning.summarize_plans import summarize_plans
from nnunet.training.model_restore import recursive_find_python... | 3,076 | 46.338462 | 119 | py |
CoTr | CoTr-main/CoTr_package/CoTr/run/run_training.py | # ------------------------------------------------------------------------
# Main
# ------------------------------------------------------------------------
import argparse
from batchgenerators.utilities.file_and_folder_operations import *
from CoTr.run.default_configuration import get_default_configuration
from nnune... | 7,006 | 49.775362 | 142 | py |
CoTr | CoTr-main/CoTr_package/CoTr/run/__init__.py | from __future__ import absolute_import
from . import * | 54 | 26.5 | 38 | py |
Wasserstein-Q-learning | Wasserstein-Q-learning-main/Q_learning.py | # -*- coding: utf-8 -*-
"""
Robust Q Learning
"""
import numpy as np
from tqdm import tqdm
from scipy.optimize import minimize
import copy
def robust_q_learning(X,
A,
r,
c,
P_0, # Simulation of next state in dependence of x and a
p_0,
... | 7,677 | 32.094828 | 159 | py |
Pytorch-implementation-of-SRNet | Pytorch-implementation-of-SRNet-master/test.py | """This module is used to test the Srnet model."""
from glob import glob
import torch
import numpy as np
import imageio as io
from model import Srnet
TEST_BATCH_SIZE = 40
COVER_PATH = "/path/to/cover/images/"
STEGO_PATH = "/path/to/stego/images/"
CHKPT = "./checkpoints/Srnet_model_weights.pt"
cover_image_names = glob... | 1,824 | 27.968254 | 71 | py |
Pytorch-implementation-of-SRNet | Pytorch-implementation-of-SRNet-master/train.py | """This module is use to train the Srnet model."""
import logging
import os
import sys
import time
import torch
from torch import nn
from torch.utils.data import DataLoader
from torchvision import transforms
from dataset import dataset
from opts.options import arguments
from model.model import Srnet
from utils.utils... | 5,885 | 29.816754 | 80 | py |
Pytorch-implementation-of-SRNet | Pytorch-implementation-of-SRNet-master/dataset/dataset.py | """This module provide the data sample for training."""
import os
from typing import Tuple
import torch
from torch import Tensor
from torch.utils.data import Dataset
import imageio as io
from opts.options import arguments
opt = arguments()
# pylint: disable=E1101
device = torch.device("cuda:0" if torch.cuda.is_avai... | 2,091 | 29.318841 | 77 | py |
Pytorch-implementation-of-SRNet | Pytorch-implementation-of-SRNet-master/dataset/__init__.py | 1 | 0 | 0 | py | |
Pytorch-implementation-of-SRNet | Pytorch-implementation-of-SRNet-master/opts/options.py | """This module provides method to enter various input to the model training."""
import argparse
def arguments() -> str:
"""This function returns arguments."""
parser = argparse.ArgumentParser()
parser.add_argument(
"--cover_path",
default="D:\\Github\\Toy-Bossbase-dataset\\bossbase_toy_da... | 1,235 | 33.333333 | 87 | py |
Pytorch-implementation-of-SRNet | Pytorch-implementation-of-SRNet-master/opts/__init__.py | 0 | 0 | 0 | py | |
Pytorch-implementation-of-SRNet | Pytorch-implementation-of-SRNet-master/utils/utils.py | """This module provides utility function for training."""
import os
import re
from typing import Any, Dict
import torch
from torch import nn
from opts.options import arguments
opt = arguments()
def saver(state: Dict[str, float], save_dir: str, epoch: int) -> None:
torch.save(state, save_dir + "net_" + str(epoch... | 1,504 | 29.714286 | 75 | py |
Pytorch-implementation-of-SRNet | Pytorch-implementation-of-SRNet-master/utils/__init__.py | 0 | 0 | 0 | py | |
Pytorch-implementation-of-SRNet | Pytorch-implementation-of-SRNet-master/model/utils.py | """This module provide building blocks for SRNet."""
from torch import nn
from torch import Tensor
class ConvBn(nn.Module):
"""Provides utility to create different types of layers."""
def __init__(self, in_channels: int, out_channels: int) -> None:
"""Constructor.
Args:
in_channe... | 3,652 | 27.317829 | 68 | py |
Pytorch-implementation-of-SRNet | Pytorch-implementation-of-SRNet-master/model/model.py | """ This module creates SRNet model."""
import torch
from torch import Tensor
from torch import nn
from model.utils import Type1, Type2, Type3, Type4
class Srnet(nn.Module):
"""This is SRNet model class."""
def __init__(self) -> None:
"""Constructor."""
super().__init__()
self.type1s ... | 1,424 | 26.403846 | 74 | py |
Pytorch-implementation-of-SRNet | Pytorch-implementation-of-SRNet-master/model/__init__.py | 0 | 0 | 0 | py | |
Seq-Att-Affect | Seq-Att-Affect-master/file_walker.py | import os
def walk( path ):
""" Use to walk through all objects in a directory.
Yields either File() or Folder() objects."""
for f in os.listdir(path):
if os.path.isfile(path):
yield File(os.path.join(path, f))
else:
yield Folder(os.path.join(path, f))
class PathEn... | 1,711 | 27.065574 | 76 | py |
Seq-Att-Affect | Seq-Att-Affect-master/utils.py | import numpy as np
import re
import cv2
from operator import truediv
import matplotlib
#matplotlib.use('Agg')
import matplotlib.pyplot as plt
from pathlib import Path
#import tensorflow as tf
import random
import csv
#from config import *
from scipy.integrate.quadrature import simps
import math
from scipy.stats import... | 78,260 | 31.676827 | 204 | py |
Seq-Att-Affect | Seq-Att-Affect-master/model.py | import torch
import torch.nn as nn
import torch.nn.functional as F
import numpy as np
from operator import truediv
class Combiner(nn.Module):
"""Combiner based on discriminator"""
def __init__(self, image_size=128, conv_dim=64, c_dim=5, repeat_num=4, inputC = 3):
super(Combiner, self).__init__()
... | 67,049 | 33.795018 | 137 | py |
Seq-Att-Affect | Seq-Att-Affect-master/main_red_test.py | import os
import argparse
from solver import Solver
from data_loader import get_loader
from torch.backends import cudnn
from model import Generator,Combiner
from model import Discriminator,DiscriminatorM,DiscriminatorMST, DiscriminatorMZ,\
DiscriminatorMZR, Combiner,CombinerSeq,CombinerSeqL,CombinerSeqAtt,CombinerSeqAt... | 40,371 | 38.972277 | 237 | py |
Seq-Att-Affect | Seq-Att-Affect-master/main_gan_single_reduction.py | import os
import argparse
from solver import Solver
from data_loader import get_loader
from torch.backends import cudnn
from model import Generator, Discriminator, GeneratorM, GeneratorMZ, GeneratorMZR, DiscriminatorM,
DiscriminatorMST,DiscriminatorMZ,DiscriminatorMZR,DiscriminatorMZRL,CombinerSeqAtt
from torch.autog... | 44,327 | 36.156748 | 237 | py |
Seq-Att-Affect | Seq-Att-Affect-master/FacialDataset.py | from math import sqrt
import re
from PIL import Image,ImageFilter
import torch
from torch.utils import data
import torchvision.transforms as transforms
import torchvision.utils as vutils
import csv
import torchvision.transforms.functional as F
import numbers
from torchvision.transforms import RandomRotation,RandomRes... | 111,306 | 37.381724 | 243 | py |
PROTES | PROTES-main/setup.py | import os
import re
from setuptools import setup
def find_packages(package, basepath):
packages = [package]
for name in os.listdir(basepath):
path = os.path.join(basepath, name)
if not os.path.isdir(path):
continue
packages.extend(find_packages('%s.%s'%(package, name), path... | 2,467 | 34.257143 | 208 | py |
PROTES | PROTES-main/protes/protes.py | import jax
import jax.numpy as jnp
import optax
from time import perf_counter as tpc
def protes(f, d, n, m, k=100, k_top=10, k_gd=1, lr=5.E-2, r=5, seed=0,
is_max=False, log=False, log_ind=False, info={}, P=None,
with_info_i_opt_list=False, with_info_full=False):
time = tpc()
info.update... | 5,895 | 28.333333 | 78 | py |
PROTES | PROTES-main/protes/protes_general.py | import jax
import jax.numpy as jnp
import optax
from time import perf_counter as tpc
def protes_general(f, n, m, k=100, k_top=10, k_gd=1, lr=5.E-2, r=5, seed=0,
is_max=False, log=False, log_ind=False, info={}, P=None,
with_info_i_opt_list=False, with_info_full=False):
time = ... | 5,369 | 25.453202 | 78 | py |
PROTES | PROTES-main/protes/__init__.py | __version__ = '0.3.2'
from .animation import animation
from .protes import protes
from .protes_general import protes_general
| 127 | 17.285714 | 42 | py |
PROTES | PROTES-main/protes/animation.py | import jax.numpy as jnp
import matplotlib as mpl
from matplotlib import cm
from matplotlib.animation import FuncAnimation
import matplotlib.pyplot as plt
from matplotlib.ticker import FormatStrFormatter
from matplotlib.ticker import LinearLocator
import numpy as np
import os
from time import perf_counter as tpc
from ... | 4,670 | 30.993151 | 80 | py |
PROTES | PROTES-main/demo/demo_qubo.py | import numpy as np
from time import perf_counter as tpc
from protes import protes
def func_build():
"""Binary knapsack problem."""
d = 50
n = 2
w = [
80, 82, 85, 70, 72, 70, 66, 50, 55, 25, 50, 55, 40, 48, 59, 32, 22,
60, 30, 32, 40, 38, 35, 32, 25, 28, 30, 22, 50, 30, 45, 30, 60, ... | 2,591 | 33.105263 | 80 | py |
PROTES | PROTES-main/demo/demo_func.py | import jax.numpy as jnp
from time import perf_counter as tpc
from protes import protes
def func_build(d, n):
"""Ackley function. See https://www.sfu.ca/~ssurjano/ackley.html."""
a = -32.768 # Grid lower bound
b = +32.768 # Grid upper bound
par_a = 20. # Standard parameter v... | 2,206 | 30.084507 | 78 | py |
PROTES | PROTES-main/calc/calc_one.py | import numpy as np
import os
from time import perf_counter as tpc
from jax.config import config
config.update('jax_enable_x64', True)
os.environ['JAX_PLATFORM_NAME'] = 'cpu'
from protes import protes
from teneva_bm import BmQuboKnapAmba
from opti import *
Optis = {
'Our': OptiProtes,
'BS-1': OptiTTOpt,
... | 1,716 | 22.202703 | 75 | py |
PROTES | PROTES-main/calc/construct_TT.py | ## Code from https://github.com/G-Ryzhakov/Constructive-TT
import numpy as np
from time import perf_counter as tpc
from numba import jit, njit
def G0(n):
res = np.zeros([n, n], dtype=int)
for i in range(n):
res[i, :i+1] = 1
return res
def main_core(f, n, m):
return main_core_list([f(i) for... | 25,218 | 27.690557 | 114 | py |
PROTES | PROTES-main/calc/calc.py | import matplotlib as mpl
import numpy as np
import os
import pickle
import sys
from time import perf_counter as tpc
mpl.rcParams.update({
'font.family': 'normal',
'font.serif': [],
'font.sans-serif': [],
'font.monospace': [],
'font.size': 12,
'text.usetex': False,
})
import matplotlib.cm as ... | 7,201 | 25.477941 | 79 | py |
PROTES | PROTES-main/calc/constr.py | import numpy as np
import os
from construct_TT import tens
import teneva
def gen_func_pair(num_ones=3):
def f0(x):
if x == 0 or x == num_ones:
return 0
def f1(x):
return min(num_ones, x + 1)
return [f0, f1]
def gen_func_pair_last(num_ones=3):
def f0(x):
if x == ... | 1,429 | 21.34375 | 77 | py |
PROTES | PROTES-main/calc/opti/opti_portfolio.py | import numpy as np
from opti import Opti
try:
import nevergrad as ng
with_ng = True
except Exception as e:
with_ng = False
class OptiPortfolio(Opti):
def __init__(self, name='portfolio', *args, **kwargs):
super().__init__(name, *args, **kwargs)
def _init(self):
if not with_ng:
... | 464 | 19.217391 | 58 | py |
PROTES | PROTES-main/calc/opti/opti_ttopt.py | from opti import Opti
import numpy as np
try:
from ttopt import TTOpt
with_ttopt = True
except Exception as e:
with_ttopt = False
class OptiTTOpt(Opti):
def __init__(self, name='ttopt', *args, **kwargs):
super().__init__(name, *args, **kwargs)
def opts(self, with_qtt=True):
self... | 1,042 | 24.439024 | 76 | py |
PROTES | PROTES-main/calc/opti/opti.py | import numpy as np
from time import perf_counter as tpc
class Opti:
def __init__(self, name='opti', with_arg_list=False, log=False):
self.name = name
self.with_arg_list = with_arg_list
self.log = log
self.err = ''
self.is_prep = False
self.is_done = False
... | 3,667 | 23.291391 | 77 | py |
PROTES | PROTES-main/calc/opti/opti_protes.py | from opti import Opti
try:
from protes import protes
with_protes = True
except Exception as e:
with_protes = False
class OptiProtes(Opti):
def __init__(self, name='protes', *args, **kwargs):
super().__init__(name, *args, **kwargs)
def opts(self, k=100, k_top=10, k_gd=1, lr=5.E-2, r=5, P... | 923 | 25.4 | 74 | py |
PROTES | PROTES-main/calc/opti/opti_pso.py | import numpy as np
from opti import Opti
try:
import nevergrad as ng
with_ng = True
except Exception as e:
with_ng = False
class OptiPSO(Opti):
def __init__(self, name='pso', *args, **kwargs):
super().__init__(name, *args, **kwargs)
def _init(self):
if not with_ng:
s... | 446 | 18.434783 | 52 | py |
PROTES | PROTES-main/calc/opti/opti_nb.py | import numpy as np
from opti import Opti
try:
import nevergrad as ng
with_ng = True
except Exception as e:
with_ng = False
class OptiNB(Opti):
def __init__(self, name='nb', *args, **kwargs):
super().__init__(name, *args, **kwargs)
def _init(self):
if not with_ng:
sel... | 452 | 18.695652 | 52 | py |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.