repo stringlengths 7 90 | file_url stringlengths 81 315 | file_path stringlengths 4 228 | content stringlengths 0 32.8k | language stringclasses 1
value | license stringclasses 7
values | commit_sha stringlengths 40 40 | retrieved_at stringdate 2026-01-04 14:38:15 2026-01-05 02:33:18 | truncated bool 2
classes |
|---|---|---|---|---|---|---|---|---|
Snooz82/robotframework-datadriver | https://github.com/Snooz82/robotframework-datadriver/blob/d2d519666250324478bdccd7ccd65206a9110bf4/atest/TestCases/custom_reader/custom_reader.py | atest/TestCases/custom_reader/custom_reader.py | # Copyright 2018- René Rohner
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,... | python | Apache-2.0 | d2d519666250324478bdccd7ccd65206a9110bf4 | 2026-01-05T07:13:20.041560Z | false |
Snooz82/robotframework-datadriver | https://github.com/Snooz82/robotframework-datadriver/blob/d2d519666250324478bdccd7ccd65206a9110bf4/src/DataDriver/ReaderConfig.py | src/DataDriver/ReaderConfig.py | # Copyright 2018- René Rohner
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,... | python | Apache-2.0 | d2d519666250324478bdccd7ccd65206a9110bf4 | 2026-01-05T07:13:20.041560Z | false |
Snooz82/robotframework-datadriver | https://github.com/Snooz82/robotframework-datadriver/blob/d2d519666250324478bdccd7ccd65206a9110bf4/src/DataDriver/xls_reader.py | src/DataDriver/xls_reader.py | # Copyright 2018- René Rohner
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,... | python | Apache-2.0 | d2d519666250324478bdccd7ccd65206a9110bf4 | 2026-01-05T07:13:20.041560Z | false |
Snooz82/robotframework-datadriver | https://github.com/Snooz82/robotframework-datadriver/blob/d2d519666250324478bdccd7ccd65206a9110bf4/src/DataDriver/AbstractReaderClass.py | src/DataDriver/AbstractReaderClass.py | # Copyright 2018- René Rohner
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,... | python | Apache-2.0 | d2d519666250324478bdccd7ccd65206a9110bf4 | 2026-01-05T07:13:20.041560Z | false |
Snooz82/robotframework-datadriver | https://github.com/Snooz82/robotframework-datadriver/blob/d2d519666250324478bdccd7ccd65206a9110bf4/src/DataDriver/argument_utils.py | src/DataDriver/argument_utils.py | import sys
from enum import IntEnum
from robot.libraries.BuiltIn import BuiltIn # type: ignore
from robot.run import USAGE # type: ignore
from robot.utils.argumentparser import ArgumentParser # type: ignore
SINGLE_ARG_CHARACTERS = ".?hTX"
class ArgumentState(IntEnum):
ANALYZE_NEXT = 0
ONE_KNOWN = 1
T... | python | Apache-2.0 | d2d519666250324478bdccd7ccd65206a9110bf4 | 2026-01-05T07:13:20.041560Z | false |
Snooz82/robotframework-datadriver | https://github.com/Snooz82/robotframework-datadriver/blob/d2d519666250324478bdccd7ccd65206a9110bf4/src/DataDriver/search.py | src/DataDriver/search.py | # Copyright 2008-2015 Nokia Networks
# Copyright 2016- Robot Framework Foundation
#
# 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
... | python | Apache-2.0 | d2d519666250324478bdccd7ccd65206a9110bf4 | 2026-01-05T07:13:20.041560Z | false |
Snooz82/robotframework-datadriver | https://github.com/Snooz82/robotframework-datadriver/blob/d2d519666250324478bdccd7ccd65206a9110bf4/src/DataDriver/xlsx_reader.py | src/DataDriver/xlsx_reader.py | # Copyright 2018- René Rohner
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,... | python | Apache-2.0 | d2d519666250324478bdccd7ccd65206a9110bf4 | 2026-01-05T07:13:20.041560Z | false |
Snooz82/robotframework-datadriver | https://github.com/Snooz82/robotframework-datadriver/blob/d2d519666250324478bdccd7ccd65206a9110bf4/src/DataDriver/csv_reader.py | src/DataDriver/csv_reader.py | # Copyright 2018- René Rohner
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,... | python | Apache-2.0 | d2d519666250324478bdccd7ccd65206a9110bf4 | 2026-01-05T07:13:20.041560Z | false |
Snooz82/robotframework-datadriver | https://github.com/Snooz82/robotframework-datadriver/blob/d2d519666250324478bdccd7ccd65206a9110bf4/src/DataDriver/generic_csv_reader.py | src/DataDriver/generic_csv_reader.py | # Copyright 2018- René Rohner
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,... | python | Apache-2.0 | d2d519666250324478bdccd7ccd65206a9110bf4 | 2026-01-05T07:13:20.041560Z | false |
Snooz82/robotframework-datadriver | https://github.com/Snooz82/robotframework-datadriver/blob/d2d519666250324478bdccd7ccd65206a9110bf4/src/DataDriver/DataDriver.py | src/DataDriver/DataDriver.py | # Copyright 2018- René Rohner
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,... | python | Apache-2.0 | d2d519666250324478bdccd7ccd65206a9110bf4 | 2026-01-05T07:13:20.041560Z | true |
Snooz82/robotframework-datadriver | https://github.com/Snooz82/robotframework-datadriver/blob/d2d519666250324478bdccd7ccd65206a9110bf4/src/DataDriver/json_reader.py | src/DataDriver/json_reader.py | # Copyright 2018- René Rohner
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,... | python | Apache-2.0 | d2d519666250324478bdccd7ccd65206a9110bf4 | 2026-01-05T07:13:20.041560Z | false |
Snooz82/robotframework-datadriver | https://github.com/Snooz82/robotframework-datadriver/blob/d2d519666250324478bdccd7ccd65206a9110bf4/src/DataDriver/glob_reader.py | src/DataDriver/glob_reader.py | # Copyright 2021- René Rohner
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,... | python | Apache-2.0 | d2d519666250324478bdccd7ccd65206a9110bf4 | 2026-01-05T07:13:20.041560Z | false |
Snooz82/robotframework-datadriver | https://github.com/Snooz82/robotframework-datadriver/blob/d2d519666250324478bdccd7ccd65206a9110bf4/src/DataDriver/utils.py | src/DataDriver/utils.py | import math
import re
from enum import Enum, auto
from typing import Any, List
from robot.api import logger # type: ignore
from robot.libraries.BuiltIn import BuiltIn # type: ignore
from .argument_utils import is_pabot_testlevelsplit
class Encodings(Enum):
"""
Python comes with a number of codecs built-in... | python | Apache-2.0 | d2d519666250324478bdccd7ccd65206a9110bf4 | 2026-01-05T07:13:20.041560Z | false |
Snooz82/robotframework-datadriver | https://github.com/Snooz82/robotframework-datadriver/blob/d2d519666250324478bdccd7ccd65206a9110bf4/src/DataDriver/rerunfailed.py | src/DataDriver/rerunfailed.py | """Pre-run modifier that excludes tests that run PASS last time.
"""
import re
from pathlib import Path
from robot.api import ExecutionResult, ResultVisitor, SuiteVisitor # type: ignore
try:
from robot.running.model import Variable # type: ignore
except ImportError:
from robot.running.resourcemodel import V... | python | Apache-2.0 | d2d519666250324478bdccd7ccd65206a9110bf4 | 2026-01-05T07:13:20.041560Z | false |
Snooz82/robotframework-datadriver | https://github.com/Snooz82/robotframework-datadriver/blob/d2d519666250324478bdccd7ccd65206a9110bf4/src/DataDriver/pict_reader.py | src/DataDriver/pict_reader.py | # Copyright 2018- René Rohner
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,... | python | Apache-2.0 | d2d519666250324478bdccd7ccd65206a9110bf4 | 2026-01-05T07:13:20.041560Z | false |
Snooz82/robotframework-datadriver | https://github.com/Snooz82/robotframework-datadriver/blob/d2d519666250324478bdccd7ccd65206a9110bf4/src/DataDriver/__init__.py | src/DataDriver/__init__.py | from .DataDriver import DataDriver # noqa: F401
| python | Apache-2.0 | d2d519666250324478bdccd7ccd65206a9110bf4 | 2026-01-05T07:13:20.041560Z | false |
Snooz82/robotframework-datadriver | https://github.com/Snooz82/robotframework-datadriver/blob/d2d519666250324478bdccd7ccd65206a9110bf4/example/demo_web_server/server.py | example/demo_web_server/server.py | #!/usr/bin/env python
"""Simple HTTP server for Robot Framework web testing demo.
Usage: server.py [port]
This server serves HTML pages under `html` directory. Server is started simply
by running this script from the command line or double-clicking it in a file
manager. In the former case the server can be shut dow... | python | Apache-2.0 | d2d519666250324478bdccd7ccd65206a9110bf4 | 2026-01-05T07:13:20.041560Z | false |
xujinglin/FineDiving | https://github.com/xujinglin/FineDiving/blob/a2b80579326364b08fbf94ccf8e68266a7ed7e7e/main.py | main.py | import os
import sys
import torch
from tools import train_net, test_net
from utils import parser
os.environ["CUDA_VISIBLE_DEVICES"] = '0,1'
def main():
args = parser.get_args()
parser.setup(args)
print(args)
if args.test:
test_net(args)
else:
train_net(args)
if __name__ == '__... | python | MIT | a2b80579326364b08fbf94ccf8e68266a7ed7e7e | 2026-01-05T07:13:19.060820Z | false |
xujinglin/FineDiving | https://github.com/xujinglin/FineDiving/blob/a2b80579326364b08fbf94ccf8e68266a7ed7e7e/tools/runner.py | tools/runner.py | import numpy as np
import torch
import torch.nn as nn
from scipy import stats
from tools import builder, helper
from utils import misc
import time
import pickle
def train_net(args):
print('Trainer start ... ')
# build dataset
train_dataset, test_dataset = builder.dataset_builder(args)
train_dataloader... | python | MIT | a2b80579326364b08fbf94ccf8e68266a7ed7e7e | 2026-01-05T07:13:19.060820Z | false |
xujinglin/FineDiving | https://github.com/xujinglin/FineDiving/blob/a2b80579326364b08fbf94ccf8e68266a7ed7e7e/tools/helper.py | tools/helper.py | import os, sys
BASE_DIR = os.path.dirname(os.path.abspath(__file__))
sys.path.append(BASE_DIR)
sys.path.append(os.path.join(BASE_DIR, "../"))
import torch
import torch.nn as nn
import time
import numpy as np
from utils.misc import segment_iou, cal_tiou, seg_pool_1d, seg_pool_3d
def network_forward_train(base_model,... | python | MIT | a2b80579326364b08fbf94ccf8e68266a7ed7e7e | 2026-01-05T07:13:19.060820Z | false |
xujinglin/FineDiving | https://github.com/xujinglin/FineDiving/blob/a2b80579326364b08fbf94ccf8e68266a7ed7e7e/tools/__init__.py | tools/__init__.py | from .runner import train_net, test_net | python | MIT | a2b80579326364b08fbf94ccf8e68266a7ed7e7e | 2026-01-05T07:13:19.060820Z | false |
xujinglin/FineDiving | https://github.com/xujinglin/FineDiving/blob/a2b80579326364b08fbf94ccf8e68266a7ed7e7e/tools/builder.py | tools/builder.py | import os, sys
BASE_DIR = os.path.dirname(os.path.abspath(__file__))
sys.path.append(BASE_DIR)
sys.path.append(os.path.join(BASE_DIR, "../"))
import torch
import torch.optim as optim
from models import I3D_backbone
from models.PS import PSNet
from utils.misc import import_class
from torchvideotransforms import video_t... | python | MIT | a2b80579326364b08fbf94ccf8e68266a7ed7e7e | 2026-01-05T07:13:19.060820Z | false |
xujinglin/FineDiving | https://github.com/xujinglin/FineDiving/blob/a2b80579326364b08fbf94ccf8e68266a7ed7e7e/data_preparation/data_process.py | data_preparation/data_process.py | import glob
import os
import subprocess
video_dir = "./FINADiving"
video_list = glob.glob(os.path.join(video_dir, "*.mp4"))
base_dir = "./FINADiving_jpgs"
save_dir = "./FINADiving_jpgs_256"
#################### step 1: video2frames ####################
for vid in video_list:
vid_dir = vid.split("/")[-1][:-4]
... | python | MIT | a2b80579326364b08fbf94ccf8e68266a7ed7e7e | 2026-01-05T07:13:19.060820Z | false |
xujinglin/FineDiving | https://github.com/xujinglin/FineDiving/blob/a2b80579326364b08fbf94ccf8e68266a7ed7e7e/datasets/__init__.py | datasets/__init__.py | from .FineDiving_Pair import FineDiving_Pair_Dataset as FineDiving
| python | MIT | a2b80579326364b08fbf94ccf8e68266a7ed7e7e | 2026-01-05T07:13:19.060820Z | false |
xujinglin/FineDiving | https://github.com/xujinglin/FineDiving/blob/a2b80579326364b08fbf94ccf8e68266a7ed7e7e/datasets/FineDiving_Pair.py | datasets/FineDiving_Pair.py | import torch
import numpy as np
import os
import pickle
import random
import glob
from os.path import join
from PIL import Image
class FineDiving_Pair_Dataset(torch.utils.data.Dataset):
def __init__(self, args, subset, transform):
random.seed(args.seed)
self.subset = subset
self.transforms ... | python | MIT | a2b80579326364b08fbf94ccf8e68266a7ed7e7e | 2026-01-05T07:13:19.060820Z | false |
xujinglin/FineDiving | https://github.com/xujinglin/FineDiving/blob/a2b80579326364b08fbf94ccf8e68266a7ed7e7e/models/vit_decoder.py | models/vit_decoder.py | import torch
import torch.nn as nn
from timm.models.layers import DropPath, trunc_normal_
import numpy as np
class Mlp(nn.Module):
def __init__(self, in_features, hidden_features=None, out_features=None, act_layer=nn.GELU, drop=0.):
super().__init__()
out_features = out_features or in_features
... | python | MIT | a2b80579326364b08fbf94ccf8e68266a7ed7e7e | 2026-01-05T07:13:19.060820Z | false |
xujinglin/FineDiving | https://github.com/xujinglin/FineDiving/blob/a2b80579326364b08fbf94ccf8e68266a7ed7e7e/models/Backbone.py | models/Backbone.py | import torch.nn as nn
import torch
from .i3d import I3D
import logging
class I3D_backbone(nn.Module):
def __init__(self, I3D_class):
super(I3D_backbone, self).__init__()
print('Using I3D backbone')
self.backbone = I3D(num_classes=I3D_class, modality='rgb', dropout_prob=0.5)
def... | python | MIT | a2b80579326364b08fbf94ccf8e68266a7ed7e7e | 2026-01-05T07:13:19.060820Z | false |
xujinglin/FineDiving | https://github.com/xujinglin/FineDiving/blob/a2b80579326364b08fbf94ccf8e68266a7ed7e7e/models/i3d.py | models/i3d.py | import math
import os
import numpy as np
import torch
from torch.nn import ReplicationPad3d
import torch.nn as nn
def get_padding_shape(filter_shape, stride):
def _pad_top_bottom(filter_dim, stride_val):
pad_along = max(filter_dim - stride_val, 0)
pad_top = pad_along // 2
pad_bottom = pad... | python | MIT | a2b80579326364b08fbf94ccf8e68266a7ed7e7e | 2026-01-05T07:13:19.060820Z | false |
xujinglin/FineDiving | https://github.com/xujinglin/FineDiving/blob/a2b80579326364b08fbf94ccf8e68266a7ed7e7e/models/PS.py | models/PS.py | import torch.nn as nn
from models.PS_parts import *
class PSNet(nn.Module):
def __init__(self, n_channels=6):
super(PSNet, self).__init__()
self.inc = inconv(n_channels, 12)
self.down1 = down(12, 24)
self.down2 = down(24, 48)
self.down3 = down(48, 96)
self.down4 = ... | python | MIT | a2b80579326364b08fbf94ccf8e68266a7ed7e7e | 2026-01-05T07:13:19.060820Z | false |
xujinglin/FineDiving | https://github.com/xujinglin/FineDiving/blob/a2b80579326364b08fbf94ccf8e68266a7ed7e7e/models/MLP.py | models/MLP.py | import torch
import torch.nn as nn
class MLP_score(nn.Module):
def __init__(self, in_channel, out_channel):
super(MLP_score, self).__init__()
self.activation_1 = nn.ReLU()
self.layer1 = nn.Linear(in_channel, 256)
self.layer2 = nn.Linear(256, 64)
self.layer3 = nn.Linear(64, ... | python | MIT | a2b80579326364b08fbf94ccf8e68266a7ed7e7e | 2026-01-05T07:13:19.060820Z | false |
xujinglin/FineDiving | https://github.com/xujinglin/FineDiving/blob/a2b80579326364b08fbf94ccf8e68266a7ed7e7e/models/PS_parts.py | models/PS_parts.py | import torch
import torch.nn as nn
class double_conv(nn.Module):
def __init__(self, in_ch, out_ch):
super(double_conv, self).__init__()
self.conv = nn.Sequential(
nn.Conv1d(in_ch, out_ch, 3, padding=1),
nn.BatchNorm1d(out_ch),
nn.ReLU(inplace=True),
n... | python | MIT | a2b80579326364b08fbf94ccf8e68266a7ed7e7e | 2026-01-05T07:13:19.060820Z | false |
xujinglin/FineDiving | https://github.com/xujinglin/FineDiving/blob/a2b80579326364b08fbf94ccf8e68266a7ed7e7e/models/__init__.py | models/__init__.py | from .Backbone import I3D_backbone
from .vit_decoder import decoder_fuser
from .MLP import MLP_score
from .PS import PSNet | python | MIT | a2b80579326364b08fbf94ccf8e68266a7ed7e7e | 2026-01-05T07:13:19.060820Z | false |
xujinglin/FineDiving | https://github.com/xujinglin/FineDiving/blob/a2b80579326364b08fbf94ccf8e68266a7ed7e7e/utils/parser.py | utils/parser.py | import os
import yaml
import argparse
def get_args():
parser = argparse.ArgumentParser()
parser.add_argument('--archs', type = str, choices=['TSA'], help = 'our approach')
parser.add_argument('--benchmark', type = str, choices=['FineDiving'], help = 'dataset')
parser.add_argument('--prefix', type = str... | python | MIT | a2b80579326364b08fbf94ccf8e68266a7ed7e7e | 2026-01-05T07:13:19.060820Z | false |
xujinglin/FineDiving | https://github.com/xujinglin/FineDiving/blob/a2b80579326364b08fbf94ccf8e68266a7ed7e7e/utils/misc.py | utils/misc.py | import cv2.cv2
import torch
import numpy as np
import os
from os.path import join
from pydoc import locate
import sys
import torch.nn as nn
import torch.nn.functional as F
def import_class(name):
return locate(name)
def worker_init_fn(worker_id):
np.random.seed(np.random.get_state()[1][0] + worker_id)
def fi... | python | MIT | a2b80579326364b08fbf94ccf8e68266a7ed7e7e | 2026-01-05T07:13:19.060820Z | false |
lartpang/ZoomNet | https://github.com/lartpang/ZoomNet/blob/9c65e6ca8c5ec2f23c4ad0c0413881f78546d4f8/main.py | main.py | # -*- coding: utf-8 -*-
import argparse
import json
import os
import os.path
import shutil
from itertools import chain
import numpy as np
import torch
from tqdm import tqdm
from utils import builder, configurator, io, misc, ops, pipeline, recorder
def parse_config():
parser = argparse.ArgumentParser("Training ... | python | MIT | 9c65e6ca8c5ec2f23c4ad0c0413881f78546d4f8 | 2026-01-05T07:13:20.623530Z | false |
lartpang/ZoomNet | https://github.com/lartpang/ZoomNet/blob/9c65e6ca8c5ec2f23c4ad0c0413881f78546d4f8/test.py | test.py | # -*- coding: utf-8 -*-
import argparse
import json
import os
import os.path
import numpy as np
import torch
from tqdm import tqdm
from utils import builder, configurator, io, misc, ops, pipeline, recorder
def parse_config():
parser = argparse.ArgumentParser("Training and evaluation script")
parser.add_arg... | python | MIT | 9c65e6ca8c5ec2f23c4ad0c0413881f78546d4f8 | 2026-01-05T07:13:20.623530Z | false |
lartpang/ZoomNet | https://github.com/lartpang/ZoomNet/blob/9c65e6ca8c5ec2f23c4ad0c0413881f78546d4f8/tools/run_it.py | tools/run_it.py | # -*- coding: utf-8 -*-
# @Time : 2021/3/6
# @Author : Lart Pang
# @GitHub : https://github.com/lartpang
import argparse
import os.path
import subprocess
import time
from enum import Enum
from multiprocessing import Process
import pynvml
pynvml.nvmlInit()
class STATUS(Enum):
NORMAL = 0
GPU_BUSY = 1
... | python | MIT | 9c65e6ca8c5ec2f23c4ad0c0413881f78546d4f8 | 2026-01-05T07:13:20.623530Z | false |
lartpang/ZoomNet | https://github.com/lartpang/ZoomNet/blob/9c65e6ca8c5ec2f23c4ad0c0413881f78546d4f8/methods/__init__.py | methods/__init__.py | from .classic_methods.CMWNet import CMWNet_V16
from .classic_methods.CPD import CPD_R50
from .classic_methods.HDFNet import HDFNet_Res50
from .classic_methods.MINet import MINet_Res50, MINet_VGG16
from .zoomnet.zoomnet import ZoomNet, ZoomNet_CK
| python | MIT | 9c65e6ca8c5ec2f23c4ad0c0413881f78546d4f8 | 2026-01-05T07:13:20.623530Z | false |
lartpang/ZoomNet | https://github.com/lartpang/ZoomNet/blob/9c65e6ca8c5ec2f23c4ad0c0413881f78546d4f8/methods/classic_methods/CMWNet.py | methods/classic_methods/CMWNet.py | # -*- coding: utf-8 -*-
# @Time : 2021/6/3
# @Author : Lart Pang
# @GitHub : https://github.com/lartpang
import torch
import torch.nn as nn
from torchvision.models import vgg
from methods.module.base_model import BasicModelClass
from utils.builder import MODELS
from utils.ops.module_ops import load_params_for_ne... | python | MIT | 9c65e6ca8c5ec2f23c4ad0c0413881f78546d4f8 | 2026-01-05T07:13:20.623530Z | false |
lartpang/ZoomNet | https://github.com/lartpang/ZoomNet/blob/9c65e6ca8c5ec2f23c4ad0c0413881f78546d4f8/methods/classic_methods/HDFNet.py | methods/classic_methods/HDFNet.py | # -*- coding: utf-8 -*-
# @Time : 2021/5/25
# @Author : Lart Pang
# @GitHub : https://github.com/lartpang
import timm
import torch
import torch.nn as nn
import torch.nn.functional as F
from methods.module.base_model import BasicModelClass
from methods.module.conv_block import ConvBNReLU
from utils.builder import ... | python | MIT | 9c65e6ca8c5ec2f23c4ad0c0413881f78546d4f8 | 2026-01-05T07:13:20.623530Z | false |
lartpang/ZoomNet | https://github.com/lartpang/ZoomNet/blob/9c65e6ca8c5ec2f23c4ad0c0413881f78546d4f8/methods/classic_methods/MINet.py | methods/classic_methods/MINet.py | # -*- coding: utf-8 -*-
import timm
import torch
from torch import nn
from torch.nn.functional import binary_cross_entropy_with_logits
from methods.module.base_model import BasicModelClass
from methods.module.conv_block import ConvBNReLU
from utils.builder import MODELS
from utils.ops.tensor_ops import cus_sample, ups... | python | MIT | 9c65e6ca8c5ec2f23c4ad0c0413881f78546d4f8 | 2026-01-05T07:13:20.623530Z | false |
lartpang/ZoomNet | https://github.com/lartpang/ZoomNet/blob/9c65e6ca8c5ec2f23c4ad0c0413881f78546d4f8/methods/classic_methods/CPD.py | methods/classic_methods/CPD.py | # -*- coding: utf-8 -*-
# @Time : 2021/6/1
# @Author : Lart Pang
# @GitHub : https://github.com/lartpang
import math
import numpy as np
import scipy.stats as st
import torch
import torch.nn as nn
import torch.nn.functional as F
import torchvision.models as models
from torch.nn import Parameter
from methods.modu... | python | MIT | 9c65e6ca8c5ec2f23c4ad0c0413881f78546d4f8 | 2026-01-05T07:13:20.623530Z | false |
lartpang/ZoomNet | https://github.com/lartpang/ZoomNet/blob/9c65e6ca8c5ec2f23c4ad0c0413881f78546d4f8/methods/classic_methods/__init__.py | methods/classic_methods/__init__.py | # -*- coding: utf-8 -*-
# @Time : 2021/7/25
# @Author : Lart Pang
# @GitHub : https://github.com/lartpang
| python | MIT | 9c65e6ca8c5ec2f23c4ad0c0413881f78546d4f8 | 2026-01-05T07:13:20.623530Z | false |
lartpang/ZoomNet | https://github.com/lartpang/ZoomNet/blob/9c65e6ca8c5ec2f23c4ad0c0413881f78546d4f8/methods/module/base_model.py | methods/module/base_model.py | # -*- coding: utf-8 -*-
# @Time : 2021/4/14
# @Author : Lart Pang
# @GitHub : https://github.com/lartpang
import abc
import torch.nn as nn
class BasicModelClass(nn.Module):
def __init__(self):
super(BasicModelClass, self).__init__()
self.is_training = True
def forward(self, *args, **kwa... | python | MIT | 9c65e6ca8c5ec2f23c4ad0c0413881f78546d4f8 | 2026-01-05T07:13:20.623530Z | false |
lartpang/ZoomNet | https://github.com/lartpang/ZoomNet/blob/9c65e6ca8c5ec2f23c4ad0c0413881f78546d4f8/methods/module/__init__.py | methods/module/__init__.py | python | MIT | 9c65e6ca8c5ec2f23c4ad0c0413881f78546d4f8 | 2026-01-05T07:13:20.623530Z | false | |
lartpang/ZoomNet | https://github.com/lartpang/ZoomNet/blob/9c65e6ca8c5ec2f23c4ad0c0413881f78546d4f8/methods/module/conv_block.py | methods/module/conv_block.py | # -*- coding: utf-8 -*-
# @Time : 2020
# @Author : Lart Pang
# @GitHub : https://github.com/lartpang
import torch.nn as nn
from timm.models.layers import to_2tuple
def _get_act_fn(act_name, inplace=True):
if act_name == "relu":
return nn.ReLU(inplace=inplace)
elif act_name == "leaklyrelu":
... | python | MIT | 9c65e6ca8c5ec2f23c4ad0c0413881f78546d4f8 | 2026-01-05T07:13:20.623530Z | false |
lartpang/ZoomNet | https://github.com/lartpang/ZoomNet/blob/9c65e6ca8c5ec2f23c4ad0c0413881f78546d4f8/methods/zoomnet/__init__.py | methods/zoomnet/__init__.py | # -*- coding: utf-8 -*-
# @Time : 2021/7/24
# @Author : Lart Pang
# @GitHub : https://github.com/lartpang
| python | MIT | 9c65e6ca8c5ec2f23c4ad0c0413881f78546d4f8 | 2026-01-05T07:13:20.623530Z | false |
lartpang/ZoomNet | https://github.com/lartpang/ZoomNet/blob/9c65e6ca8c5ec2f23c4ad0c0413881f78546d4f8/methods/zoomnet/zoomnet.py | methods/zoomnet/zoomnet.py | import numpy as np
import timm
import torch
import torch.nn.functional as F
from torch import nn
from torch.utils.checkpoint import checkpoint
from methods.module.base_model import BasicModelClass
from methods.module.conv_block import ConvBNReLU
from utils.builder import MODELS
from utils.ops import cus_sample
class... | python | MIT | 9c65e6ca8c5ec2f23c4ad0c0413881f78546d4f8 | 2026-01-05T07:13:20.623530Z | false |
lartpang/ZoomNet | https://github.com/lartpang/ZoomNet/blob/9c65e6ca8c5ec2f23c4ad0c0413881f78546d4f8/utils/configurator.py | utils/configurator.py | # -*- coding: utf-8 -*-
# @Time : 2021/6/1
# @Author : Lart Pang
# @GitHub : https://github.com/lartpang
import ast
import os.path as osp
import platform
import shutil
import sys
import tempfile
import warnings
from importlib import import_module
from addict import Dict
from yapf.yapflib.yapf_api import FormatCo... | python | MIT | 9c65e6ca8c5ec2f23c4ad0c0413881f78546d4f8 | 2026-01-05T07:13:20.623530Z | false |
lartpang/ZoomNet | https://github.com/lartpang/ZoomNet/blob/9c65e6ca8c5ec2f23c4ad0c0413881f78546d4f8/utils/registry.py | utils/registry.py | # -*- coding: utf-8 -*-
# @Time : 2021/5/22
# @Author : Lart Pang
# @GitHub : https://github.com/lartpang
import importlib
import sys
from typing import Any, Dict, Iterable, Iterator, Tuple
def formatter_for_dict(info_dict: dict, headers: list, name_length=20, obj_str_length=60):
assert len(headers) == 2
... | python | MIT | 9c65e6ca8c5ec2f23c4ad0c0413881f78546d4f8 | 2026-01-05T07:13:20.623530Z | false |
lartpang/ZoomNet | https://github.com/lartpang/ZoomNet/blob/9c65e6ca8c5ec2f23c4ad0c0413881f78546d4f8/utils/misc.py | utils/misc.py | # -*- coding: utf-8 -*-
import copy
import importlib
import os
import random
import shutil
import sys
import warnings
from collections import abc, OrderedDict
from datetime import datetime
from importlib.util import find_spec, module_from_spec
import numpy as np
import torch
from torch import nn
from torch.backends im... | python | MIT | 9c65e6ca8c5ec2f23c4ad0c0413881f78546d4f8 | 2026-01-05T07:13:20.623530Z | false |
lartpang/ZoomNet | https://github.com/lartpang/ZoomNet/blob/9c65e6ca8c5ec2f23c4ad0c0413881f78546d4f8/utils/__init__.py | utils/__init__.py | python | MIT | 9c65e6ca8c5ec2f23c4ad0c0413881f78546d4f8 | 2026-01-05T07:13:20.623530Z | false | |
lartpang/ZoomNet | https://github.com/lartpang/ZoomNet/blob/9c65e6ca8c5ec2f23c4ad0c0413881f78546d4f8/utils/builder.py | utils/builder.py | # -*- coding: utf-8 -*-
# @Time : 2021/5/22
# @Author : Lart Pang
# @GitHub : https://github.com/lartpang
import inspect
from utils.registry import Registry
DATASETS = Registry(name="dataset")
DATASETS.import_module_from_module_names(["dataset"], verbose=False)
MODELS = Registry(name="model")
MODELS.import_modu... | python | MIT | 9c65e6ca8c5ec2f23c4ad0c0413881f78546d4f8 | 2026-01-05T07:13:20.623530Z | false |
lartpang/ZoomNet | https://github.com/lartpang/ZoomNet/blob/9c65e6ca8c5ec2f23c4ad0c0413881f78546d4f8/utils/recorder/excel_recorder.py | utils/recorder/excel_recorder.py | # -*- coding: utf-8 -*-
# @Time : 2021/1/3
# @Author : Lart Pang
# @GitHub : https://github.com/lartpang
import contextlib
import os
import re
from openpyxl import load_workbook, Workbook
from openpyxl.utils import get_column_letter
from openpyxl.worksheet.worksheet import Worksheet
# Thanks:
# - Python_Openpyx... | python | MIT | 9c65e6ca8c5ec2f23c4ad0c0413881f78546d4f8 | 2026-01-05T07:13:20.623530Z | false |
lartpang/ZoomNet | https://github.com/lartpang/ZoomNet/blob/9c65e6ca8c5ec2f23c4ad0c0413881f78546d4f8/utils/recorder/meter_recorder.py | utils/recorder/meter_recorder.py | # -*- coding: utf-8 -*-
# @Time : 2020/7/4
# @Author : Lart Pang
# @GitHub : https://github.com/lartpang
class AvgMeter(object):
__slots__ = ["value", "avg", "sum", "count"]
def __init__(self):
self.value = 0
self.avg = 0
self.sum = 0
self.count = 0
def reset(self):
... | python | MIT | 9c65e6ca8c5ec2f23c4ad0c0413881f78546d4f8 | 2026-01-05T07:13:20.623530Z | false |
lartpang/ZoomNet | https://github.com/lartpang/ZoomNet/blob/9c65e6ca8c5ec2f23c4ad0c0413881f78546d4f8/utils/recorder/timer.py | utils/recorder/timer.py | # -*- coding: utf-8 -*-
# @Time : 2020/12/19
# @Author : Lart Pang
# @GitHub : https://github.com/lartpang
import functools
from datetime import datetime
class TimeRecoder:
__slots__ = ["_start_time", "_has_start"]
def __init__(self):
self._start_time = datetime.now()
self._has_start = ... | python | MIT | 9c65e6ca8c5ec2f23c4ad0c0413881f78546d4f8 | 2026-01-05T07:13:20.623530Z | false |
lartpang/ZoomNet | https://github.com/lartpang/ZoomNet/blob/9c65e6ca8c5ec2f23c4ad0c0413881f78546d4f8/utils/recorder/tensorboard.py | utils/recorder/tensorboard.py | # -*- coding: utf-8 -*-
# @Time : 2020/12/19
# @Author : Lart Pang
# @GitHub : https://github.com/lartpang
from torch.utils.tensorboard import SummaryWriter
from torchvision.utils import make_grid
from utils.misc import check_mkdir
class TBRecorder(object):
__slots__ = ["tb"]
def __init__(self, tb_pat... | python | MIT | 9c65e6ca8c5ec2f23c4ad0c0413881f78546d4f8 | 2026-01-05T07:13:20.623530Z | false |
lartpang/ZoomNet | https://github.com/lartpang/ZoomNet/blob/9c65e6ca8c5ec2f23c4ad0c0413881f78546d4f8/utils/recorder/__init__.py | utils/recorder/__init__.py | # -*- coding: utf-8 -*-
# @Time : 2020/12/19
# @Author : Lart Pang
# @GitHub : https://github.com/lartpang
from .excel_recorder import MetricExcelRecorder
from .meter_recorder import AvgMeter
from .metric_caller import CalTotalMetric
from .msg_logger import TxtLogger
from .tensorboard import TBRecorder
from .time... | python | MIT | 9c65e6ca8c5ec2f23c4ad0c0413881f78546d4f8 | 2026-01-05T07:13:20.623530Z | false |
lartpang/ZoomNet | https://github.com/lartpang/ZoomNet/blob/9c65e6ca8c5ec2f23c4ad0c0413881f78546d4f8/utils/recorder/msg_logger.py | utils/recorder/msg_logger.py | # -*- coding: utf-8 -*-
# @Time : 2020/12/19
# @Author : Lart Pang
# @GitHub : https://github.com/lartpang
class TxtLogger(object):
__slots__ = ["_path"]
def __init__(self, path):
self._path = path
def record(self, msg, show=True):
with open(self._path, "a") as f:
f.writ... | python | MIT | 9c65e6ca8c5ec2f23c4ad0c0413881f78546d4f8 | 2026-01-05T07:13:20.623530Z | false |
lartpang/ZoomNet | https://github.com/lartpang/ZoomNet/blob/9c65e6ca8c5ec2f23c4ad0c0413881f78546d4f8/utils/recorder/visualize_results.py | utils/recorder/visualize_results.py | import matplotlib
import matplotlib.pyplot as plt
import numpy as np
import torch
import torchvision.transforms.functional as tv_tf
from torchvision.utils import make_grid
matplotlib.use("agg")
@torch.no_grad()
def plot_results(data_container, save_path=None):
"""Plot the results conresponding to the batched ima... | python | MIT | 9c65e6ca8c5ec2f23c4ad0c0413881f78546d4f8 | 2026-01-05T07:13:20.623530Z | false |
lartpang/ZoomNet | https://github.com/lartpang/ZoomNet/blob/9c65e6ca8c5ec2f23c4ad0c0413881f78546d4f8/utils/recorder/metric_caller.py | utils/recorder/metric_caller.py | # -*- coding: utf-8 -*-
# @Time : 2020/12/19
# @Author : Lart Pang
# @GitHub : https://github.com/lartpang
import numpy as np
from py_sod_metrics.sod_metrics import Emeasure, Fmeasure, MAE, Smeasure, WeightedFmeasure
class CalTotalMetric(object):
__slots__ = ["cal_mae", "cal_fm", "cal_sm", "cal_em", "cal_wf... | python | MIT | 9c65e6ca8c5ec2f23c4ad0c0413881f78546d4f8 | 2026-01-05T07:13:20.623530Z | false |
lartpang/ZoomNet | https://github.com/lartpang/ZoomNet/blob/9c65e6ca8c5ec2f23c4ad0c0413881f78546d4f8/utils/io/params.py | utils/io/params.py | # -*- coding: utf-8 -*-
# @Time : 2020/12/19
# @Author : Lart Pang
# @GitHub : https://github.com/lartpang
import os
import torch
from torch import nn
def save_params(
model,
state_net_path,
model_ema=None,
full_net_path=None,
exp_name=None,
next_epoch=-1,
optimizer=None,
schedu... | python | MIT | 9c65e6ca8c5ec2f23c4ad0c0413881f78546d4f8 | 2026-01-05T07:13:20.623530Z | false |
lartpang/ZoomNet | https://github.com/lartpang/ZoomNet/blob/9c65e6ca8c5ec2f23c4ad0c0413881f78546d4f8/utils/io/image.py | utils/io/image.py | # -*- coding: utf-8 -*-
# @Time : 2020/8/19
# @Author : Lart Pang
# @GitHub : https://github.com/lartpang
import cv2
import numpy as np
from utils.ops import minmax
def read_gray_array(path, div_255=False, to_normalize=False, thr=-1, dtype=np.float32) -> np.ndarray:
"""
1. read the binary image with the... | python | MIT | 9c65e6ca8c5ec2f23c4ad0c0413881f78546d4f8 | 2026-01-05T07:13:20.623530Z | false |
lartpang/ZoomNet | https://github.com/lartpang/ZoomNet/blob/9c65e6ca8c5ec2f23c4ad0c0413881f78546d4f8/utils/io/genaral.py | utils/io/genaral.py | # -*- coding: utf-8 -*-
# @Time : 2021/5/17
# @Author : Lart Pang
# @GitHub : https://github.com/lartpang
import contextlib
import json
import os
from collections import defaultdict
def read_data_from_json(json_path: str) -> dict:
with open(json_path, mode="r", encoding="utf-8") as f:
data = json.loa... | python | MIT | 9c65e6ca8c5ec2f23c4ad0c0413881f78546d4f8 | 2026-01-05T07:13:20.623530Z | false |
lartpang/ZoomNet | https://github.com/lartpang/ZoomNet/blob/9c65e6ca8c5ec2f23c4ad0c0413881f78546d4f8/utils/io/__init__.py | utils/io/__init__.py | # -*- coding: utf-8 -*-
# @Time : 2021/5/17
# @Author : Lart Pang
# @GitHub : https://github.com/lartpang
from .image import read_color_array, read_gray_array
from .params import load_specific_params, load_weight, save_params, save_weight
| python | MIT | 9c65e6ca8c5ec2f23c4ad0c0413881f78546d4f8 | 2026-01-05T07:13:20.623530Z | false |
lartpang/ZoomNet | https://github.com/lartpang/ZoomNet/blob/9c65e6ca8c5ec2f23c4ad0c0413881f78546d4f8/utils/ops/tensor_ops.py | utils/ops/tensor_ops.py | # -*- coding: utf-8 -*-
# @Time : 2020
# @Author : Lart Pang
# @GitHub : https://github.com/lartpang
from numbers import Number
import torch
import torch.nn.functional as F
def cus_sample(
feat: torch.Tensor,
mode=None,
factors=None,
*,
interpolation="bilinear",
align_corners=False,
) ->... | python | MIT | 9c65e6ca8c5ec2f23c4ad0c0413881f78546d4f8 | 2026-01-05T07:13:20.623530Z | false |
lartpang/ZoomNet | https://github.com/lartpang/ZoomNet/blob/9c65e6ca8c5ec2f23c4ad0c0413881f78546d4f8/utils/ops/array_ops.py | utils/ops/array_ops.py | # -*- coding: utf-8 -*-
import os
import cv2
import numpy as np
def minmax(data_array: np.ndarray, up_bound: float = None) -> np.ndarray:
"""
::
data_array = (data_array / up_bound)
if min_value != max_value:
data_array = (data_array - min_value) / (max_value - min_value)
:p... | python | MIT | 9c65e6ca8c5ec2f23c4ad0c0413881f78546d4f8 | 2026-01-05T07:13:20.623530Z | false |
lartpang/ZoomNet | https://github.com/lartpang/ZoomNet/blob/9c65e6ca8c5ec2f23c4ad0c0413881f78546d4f8/utils/ops/__init__.py | utils/ops/__init__.py | # -*- coding: utf-8 -*-
# @Time : 2020/12/19
# @Author : Lart Pang
# @GitHub : https://github.com/lartpang
from .array_ops import *
from .module_ops import *
from .tensor_ops import *
| python | MIT | 9c65e6ca8c5ec2f23c4ad0c0413881f78546d4f8 | 2026-01-05T07:13:20.623530Z | false |
lartpang/ZoomNet | https://github.com/lartpang/ZoomNet/blob/9c65e6ca8c5ec2f23c4ad0c0413881f78546d4f8/utils/ops/module_ops.py | utils/ops/module_ops.py | # -*- coding: utf-8 -*-
# @Time : 2021/5/17
# @Author : Lart Pang
# @GitHub : https://github.com/lartpang
from typing import Callable
import torch
def replace_module(
model, source_base_class, *, target_object=None, target_class=None, reload_params_func: Callable = None
):
if target_object is None:
... | python | MIT | 9c65e6ca8c5ec2f23c4ad0c0413881f78546d4f8 | 2026-01-05T07:13:20.623530Z | false |
lartpang/ZoomNet | https://github.com/lartpang/ZoomNet/blob/9c65e6ca8c5ec2f23c4ad0c0413881f78546d4f8/utils/pipeline/ema.py | utils/pipeline/ema.py | # -*- coding: utf-8 -*-
# @Time : 2021/7/25
# @Author : Lart Pang
# @GitHub : https://github.com/lartpang
from copy import deepcopy
import torch
from torch import nn
class ModelEma(nn.Module):
def __init__(self, model, decay=0.9999, has_set=False, device=None):
"""Model Exponential Moving Average V2... | python | MIT | 9c65e6ca8c5ec2f23c4ad0c0413881f78546d4f8 | 2026-01-05T07:13:20.623530Z | false |
lartpang/ZoomNet | https://github.com/lartpang/ZoomNet/blob/9c65e6ca8c5ec2f23c4ad0c0413881f78546d4f8/utils/pipeline/tta.py | utils/pipeline/tta.py | # -*- coding: utf-8 -*-
# @Time : 2021/5/31
# @Author : Lart Pang
# @GitHub : https://github.com/lartpang
import ttach as tta
def test_aug(model, data, strategy, reducation="mean", output_key=None):
print(f"We will use Test Time Augmentation with {strategy}!")
merger = tta.base.Merger(type=reducation, n... | python | MIT | 9c65e6ca8c5ec2f23c4ad0c0413881f78546d4f8 | 2026-01-05T07:13:20.623530Z | false |
lartpang/ZoomNet | https://github.com/lartpang/ZoomNet/blob/9c65e6ca8c5ec2f23c4ad0c0413881f78546d4f8/utils/pipeline/optimizer.py | utils/pipeline/optimizer.py | # -*- coding: utf-8 -*-
# @Time : 2020/12/19
# @Author : Lart Pang
# @GitHub : https://github.com/lartpang
import types
from torch import nn
from torch.optim import Adam, AdamW, SGD
def get_optimizer(mode, params, initial_lr, optim_cfg):
if mode == "sgd":
optimizer = SGD(params=params, lr=initial_lr... | python | MIT | 9c65e6ca8c5ec2f23c4ad0c0413881f78546d4f8 | 2026-01-05T07:13:20.623530Z | false |
lartpang/ZoomNet | https://github.com/lartpang/ZoomNet/blob/9c65e6ca8c5ec2f23c4ad0c0413881f78546d4f8/utils/pipeline/__init__.py | utils/pipeline/__init__.py | # -*- coding: utf-8 -*-
# @Time : 2021/5/31
# @Author : Lart Pang
# @GitHub : https://github.com/lartpang
from .dataloader import *
from .ema import ModelEma
from .optimizer import construct_optimizer
from .scheduler import Scheduler
from .tta import test_aug
| python | MIT | 9c65e6ca8c5ec2f23c4ad0c0413881f78546d4f8 | 2026-01-05T07:13:20.623530Z | false |
lartpang/ZoomNet | https://github.com/lartpang/ZoomNet/blob/9c65e6ca8c5ec2f23c4ad0c0413881f78546d4f8/utils/pipeline/dataloader.py | utils/pipeline/dataloader.py | # -*- coding: utf-8 -*-
# @Time : 2021/5/29
# @Author : Lart Pang
# @GitHub : https://github.com/lartpang
from functools import partial
from torch.utils import data
from utils import builder, misc
def get_tr_loader(cfg, shuffle=True, drop_last=True, pin_memory=True):
dataset = builder.build_obj_from_regis... | python | MIT | 9c65e6ca8c5ec2f23c4ad0c0413881f78546d4f8 | 2026-01-05T07:13:20.623530Z | false |
lartpang/ZoomNet | https://github.com/lartpang/ZoomNet/blob/9c65e6ca8c5ec2f23c4ad0c0413881f78546d4f8/utils/pipeline/scheduler.py | utils/pipeline/scheduler.py | # -*- coding: utf-8 -*-
# @Time : 2020/12/19
# @Author : Lart Pang
# @GitHub : https://github.com/lartpang
import copy
import math
import os.path
import warnings
from bisect import bisect_right
import numpy as np
import torch.optim
from scipy import signal
# helper function ------------------------------------... | python | MIT | 9c65e6ca8c5ec2f23c4ad0c0413881f78546d4f8 | 2026-01-05T07:13:20.623530Z | false |
lartpang/ZoomNet | https://github.com/lartpang/ZoomNet/blob/9c65e6ca8c5ec2f23c4ad0c0413881f78546d4f8/dataset/base_dataset.py | dataset/base_dataset.py | # -*- coding: utf-8 -*-
# @Time : 2021/5/16
# @Author : Lart Pang
# @GitHub : https://github.com/lartpang
import random
from collections import abc
import torch
from torch.utils.data import DataLoader, Dataset
from torch.utils.data._utils.collate import default_collate
from utils.ops.tensor_ops import cus_sample... | python | MIT | 9c65e6ca8c5ec2f23c4ad0c0413881f78546d4f8 | 2026-01-05T07:13:20.623530Z | false |
lartpang/ZoomNet | https://github.com/lartpang/ZoomNet/blob/9c65e6ca8c5ec2f23c4ad0c0413881f78546d4f8/dataset/msi_sod.py | dataset/msi_sod.py | # -*- coding: utf-8 -*-
import random
from typing import Dict, List, Tuple
from PIL import Image
from torchvision.transforms import transforms
from dataset.base_dataset import _BaseSODDataset
from utils.builder import DATASETS
from utils.io.genaral import get_datasets_info_with_keys
class RandomHorizontallyFlip(obj... | python | MIT | 9c65e6ca8c5ec2f23c4ad0c0413881f78546d4f8 | 2026-01-05T07:13:20.623530Z | false |
lartpang/ZoomNet | https://github.com/lartpang/ZoomNet/blob/9c65e6ca8c5ec2f23c4ad0c0413881f78546d4f8/dataset/msi_cod.py | dataset/msi_cod.py | # -*- coding: utf-8 -*-
from typing import Dict, List, Tuple
import albumentations as A
import cv2
import torch
from dataset.base_dataset import _BaseSODDataset
from dataset.transforms.resize import ms_resize, ss_resize
from dataset.transforms.rotate import UniRotate
from utils.builder import DATASETS
from utils.io.... | python | MIT | 9c65e6ca8c5ec2f23c4ad0c0413881f78546d4f8 | 2026-01-05T07:13:20.623530Z | false |
lartpang/ZoomNet | https://github.com/lartpang/ZoomNet/blob/9c65e6ca8c5ec2f23c4ad0c0413881f78546d4f8/dataset/__init__.py | dataset/__init__.py | # -*- coding: utf-8 -*-
from .msi_cod import MSICOD_TestDataset, MSICOD_TrainDataset
from .msi_sod import MSISOD_TrainDataset, MSISOD_TestDataset
| python | MIT | 9c65e6ca8c5ec2f23c4ad0c0413881f78546d4f8 | 2026-01-05T07:13:20.623530Z | false |
lartpang/ZoomNet | https://github.com/lartpang/ZoomNet/blob/9c65e6ca8c5ec2f23c4ad0c0413881f78546d4f8/dataset/transforms/resize.py | dataset/transforms/resize.py | import albumentations as A
import cv2
class UniResize(A.DualTransform):
"""UniResize the input to the given height and width.
Args:
height (int): desired height of the output.
width (int): desired width of the output.
interpolation (OpenCV flag): flag that is used to specify the inter... | python | MIT | 9c65e6ca8c5ec2f23c4ad0c0413881f78546d4f8 | 2026-01-05T07:13:20.623530Z | false |
lartpang/ZoomNet | https://github.com/lartpang/ZoomNet/blob/9c65e6ca8c5ec2f23c4ad0c0413881f78546d4f8/dataset/transforms/rotate.py | dataset/transforms/rotate.py | import random
import albumentations as A
import cv2
class UniRotate(A.DualTransform):
"""UniRotate the input by an angle selected randomly from the uniform distribution.
Args:
limit ((int, int) or int): range from which a random angle is picked. If limit is a single int
an angle is picke... | python | MIT | 9c65e6ca8c5ec2f23c4ad0c0413881f78546d4f8 | 2026-01-05T07:13:20.623530Z | false |
lartpang/ZoomNet | https://github.com/lartpang/ZoomNet/blob/9c65e6ca8c5ec2f23c4ad0c0413881f78546d4f8/dataset/transforms/__init__.py | dataset/transforms/__init__.py | # -*- coding: utf-8 -*-
# @Time : 2021/8/16
# @Author : Lart Pang
# @GitHub : https://github.com/lartpang
| python | MIT | 9c65e6ca8c5ec2f23c4ad0c0413881f78546d4f8 | 2026-01-05T07:13:20.623530Z | false |
lartpang/ZoomNet | https://github.com/lartpang/ZoomNet/blob/9c65e6ca8c5ec2f23c4ad0c0413881f78546d4f8/dataset/transforms/composition.py | dataset/transforms/composition.py | import random
import albumentations as A
import numpy as np
from albumentations.core.composition import BaseCompose
class Compose(BaseCompose):
"""Compose transforms and handle all transformations regarding bounding boxes
Args:
transforms (list): list of transformations to compose.
bbox_para... | python | MIT | 9c65e6ca8c5ec2f23c4ad0c0413881f78546d4f8 | 2026-01-05T07:13:20.623530Z | false |
lartpang/ZoomNet | https://github.com/lartpang/ZoomNet/blob/9c65e6ca8c5ec2f23c4ad0c0413881f78546d4f8/configs/_base_/train.py | configs/_base_/train.py | train = dict(
batch_size=10,
num_workers=4,
use_amp=True,
num_epochs=100,
num_iters=30000,
epoch_based=True,
lr=0.0001,
optimizer=dict(
mode="adamw",
set_to_none=True,
group_mode="r3", # ['trick', 'r3', 'all', 'finetune'],
cfg=dict(),
),
grad_acc_... | python | MIT | 9c65e6ca8c5ec2f23c4ad0c0413881f78546d4f8 | 2026-01-05T07:13:20.623530Z | false |
lartpang/ZoomNet | https://github.com/lartpang/ZoomNet/blob/9c65e6ca8c5ec2f23c4ad0c0413881f78546d4f8/configs/_base_/common.py | configs/_base_/common.py | has_test = True
base_seed = 0
deterministic = True
log_interval = dict( # >0 will be logged
txt=20,
tensorboard=0,
)
load_from = ""
resume_from = ""
model_name = ""
experiment_tag = ""
| python | MIT | 9c65e6ca8c5ec2f23c4ad0c0413881f78546d4f8 | 2026-01-05T07:13:20.623530Z | false |
lartpang/ZoomNet | https://github.com/lartpang/ZoomNet/blob/9c65e6ca8c5ec2f23c4ad0c0413881f78546d4f8/configs/_base_/test.py | configs/_base_/test.py | test = dict(
batch_size=8,
num_workers=2,
eval_func="default_test",
clip_range=None,
tta=dict( # based on the ttach lib
enable=False,
reducation="mean", # 'mean', 'gmean', 'sum', 'max', 'min', 'tsharpen'
cfg=dict(
HorizontalFlip=dict(),
VerticalFlip=... | python | MIT | 9c65e6ca8c5ec2f23c4ad0c0413881f78546d4f8 | 2026-01-05T07:13:20.623530Z | false |
lartpang/ZoomNet | https://github.com/lartpang/ZoomNet/blob/9c65e6ca8c5ec2f23c4ad0c0413881f78546d4f8/configs/_base_/dataset/rgbdsod.py | configs/_base_/dataset/rgbdsod.py | datasets = dict(
train=dict(
dataset_type="rgbd_sod_tr",
shape=dict(h=256, w=256),
path=["njudtrdmra_ori", "nlprtrdmra_ori", "dutrgbdtr"],
interp_cfg=dict(),
),
test=dict(
dataset_type="rgbd_sod_te",
shape=dict(h=256, w=256),
path=["dutrgbdte", "njudte... | python | MIT | 9c65e6ca8c5ec2f23c4ad0c0413881f78546d4f8 | 2026-01-05T07:13:20.623530Z | false |
lartpang/ZoomNet | https://github.com/lartpang/ZoomNet/blob/9c65e6ca8c5ec2f23c4ad0c0413881f78546d4f8/configs/zoomnet/sod_zoomnet.py | configs/zoomnet/sod_zoomnet.py | _base_ = [
"../_base_/common.py",
"../_base_/train.py",
"../_base_/test.py",
]
has_test = True
deterministic = True
use_custom_worker_init = False
model_name = "ZoomNet"
train = dict(
batch_size=22,
num_workers=4,
use_amp=True,
num_epochs=50,
epoch_based=True,
lr=0.05,
optimize... | python | MIT | 9c65e6ca8c5ec2f23c4ad0c0413881f78546d4f8 | 2026-01-05T07:13:20.623530Z | false |
lartpang/ZoomNet | https://github.com/lartpang/ZoomNet/blob/9c65e6ca8c5ec2f23c4ad0c0413881f78546d4f8/configs/zoomnet/cod_zoomnet.py | configs/zoomnet/cod_zoomnet.py | _base_ = [
"../_base_/common.py",
"../_base_/train.py",
"../_base_/test.py",
]
has_test = True
deterministic = True
use_custom_worker_init = False
model_name = "ZoomNet"
train = dict(
batch_size=8,
num_workers=4,
use_amp=True,
num_epochs=40,
epoch_based=True,
lr=0.05,
optimizer... | python | MIT | 9c65e6ca8c5ec2f23c4ad0c0413881f78546d4f8 | 2026-01-05T07:13:20.623530Z | false |
MTG/freesound-python | https://github.com/MTG/freesound-python/blob/73cf6d14f7ce8174d943bdc78ff30f99878a5db8/setup.py | setup.py | from distutils.core import setup
setup(
name="freesound-python",
version="1.1",
py_modules=["freesound"],
install_requires=["requests<3.0,>2.27"],
python_requires=">=3.6",
)
| python | MIT | 73cf6d14f7ce8174d943bdc78ff30f99878a5db8 | 2026-01-05T07:13:25.198220Z | false |
MTG/freesound-python | https://github.com/MTG/freesound-python/blob/73cf6d14f7ce8174d943bdc78ff30f99878a5db8/freesound.py | freesound.py | """
A python client for the Freesound API.
Find the API documentation at https://www.freesound.org/docs/api/.
Apply for an API key at https://www.freesound.org/api/apply/.
The client automatically maps function arguments to http parameters of the API.
JSON results are converted to python objects. The main object typ... | python | MIT | 73cf6d14f7ce8174d943bdc78ff30f99878a5db8 | 2026-01-05T07:13:25.198220Z | false |
MTG/freesound-python | https://github.com/MTG/freesound-python/blob/73cf6d14f7ce8174d943bdc78ff30f99878a5db8/examples.py | examples.py | import os
import sys
import freesound
api_key = os.getenv('FREESOUND_API_KEY', None)
if api_key is None:
print("You need to set your API key as an environment variable")
print("named FREESOUND_API_KEY")
sys.exit(-1)
freesound_client = freesound.FreesoundClient()
freesound_client.set_token(api_key)
# Get... | python | MIT | 73cf6d14f7ce8174d943bdc78ff30f99878a5db8 | 2026-01-05T07:13:25.198220Z | false |
MTG/freesound-python | https://github.com/MTG/freesound-python/blob/73cf6d14f7ce8174d943bdc78ff30f99878a5db8/download_bookmarks_example.py | download_bookmarks_example.py | # Downloads all bookmarks in a user's categories on freesound,
# Requires OAUTH key, follow instructions at -
# https://freesound.org/docs/api/authentication.html#oauth2-authentication
# Make sure you use the actual oauth token and not the authorisation token in
# step 2
import os
import sys
import freesound
access_t... | python | MIT | 73cf6d14f7ce8174d943bdc78ff30f99878a5db8 | 2026-01-05T07:13:25.198220Z | false |
cwjokaka/bilibili_member_crawler | https://github.com/cwjokaka/bilibili_member_crawler/blob/a4b9cb64b073ec452f1b12b5225539e53996689b/bilibili_member_crawler.py | bilibili_member_crawler.py | import random
import requests
from distributor import Distributor
from variable import USER_AGENTS, THREADS_NUM, FETCH_MID_FROM, FETCH_MID_TO, USE_PROXY_POOL, PROXY_POOL_URL, PROXIES
from worker import Worker
class BilibiliMemberCrawler:
"""
B站爬虫入口,用于初始化配置与开启线程
"""
@classmethod
def start(cls):
... | python | MIT | a4b9cb64b073ec452f1b12b5225539e53996689b | 2026-01-05T07:13:29.310919Z | false |
cwjokaka/bilibili_member_crawler | https://github.com/cwjokaka/bilibili_member_crawler/blob/a4b9cb64b073ec452f1b12b5225539e53996689b/res_manager.py | res_manager.py | from queue import Queue
class ResManager:
def __init__(self, max_size=4096) -> None:
super().__init__()
self._queue = Queue(max_size)
def get_task(self):
return self._queue.get()
def put_task(self, url):
self._queue.put(url)
res_manager = ResManager(max_size=4096)
| python | MIT | a4b9cb64b073ec452f1b12b5225539e53996689b | 2026-01-05T07:13:29.310919Z | false |
cwjokaka/bilibili_member_crawler | https://github.com/cwjokaka/bilibili_member_crawler/blob/a4b9cb64b073ec452f1b12b5225539e53996689b/worker.py | worker.py | import time
from threading import Thread
import MySQLdb
import random
import requests
from requests import ConnectTimeout, ReadTimeout
from typing import Optional
from requests.exceptions import ProxyError, ChunkedEncodingError
from exception.request_exception import RequestException
from exception.sql_already_exis... | python | MIT | a4b9cb64b073ec452f1b12b5225539e53996689b | 2026-01-05T07:13:29.310919Z | false |
cwjokaka/bilibili_member_crawler | https://github.com/cwjokaka/bilibili_member_crawler/blob/a4b9cb64b073ec452f1b12b5225539e53996689b/variable.py | variable.py | # 用户信息页面URL
PAGE_URL = 'http://space.bilibili.com'
# 获取用户信息接口
API_MEMBER_INFO = 'http://api.bilibili.com/x/space/acc/info'
# MySQL配置
DB_HOST = 'localhost'
DB_PORT = 3306
DB_USER = 'root'
DB_PASSWORD = '123456'
DB_NAME = 'bilibili'
# 使用https://github.com/jhao104/proxy_pool的代理池,也可自行部署其服务,然后把PROXY_POOL_URL的地址改成localhost... | python | MIT | a4b9cb64b073ec452f1b12b5225539e53996689b | 2026-01-05T07:13:29.310919Z | false |
cwjokaka/bilibili_member_crawler | https://github.com/cwjokaka/bilibili_member_crawler/blob/a4b9cb64b073ec452f1b12b5225539e53996689b/distributor.py | distributor.py | from threading import Thread
from res_manager import res_manager
class Distributor(Thread):
"""
任务分发线程,负责下发任务(用户mid)到队列
"""
def __init__(self, start: int, end: int):
super().__init__()
self._start = start
self._end = end
def run(self) -> None:
print('Distributor开始执... | python | MIT | a4b9cb64b073ec452f1b12b5225539e53996689b | 2026-01-05T07:13:29.310919Z | false |
cwjokaka/bilibili_member_crawler | https://github.com/cwjokaka/bilibili_member_crawler/blob/a4b9cb64b073ec452f1b12b5225539e53996689b/exception/bilibili_exception.py | exception/bilibili_exception.py | class BilibiliException(Exception):
def __init__(self, msg) -> None:
self.msg = msg
def __str__(self):
return self.msg
| python | MIT | a4b9cb64b073ec452f1b12b5225539e53996689b | 2026-01-05T07:13:29.310919Z | false |
cwjokaka/bilibili_member_crawler | https://github.com/cwjokaka/bilibili_member_crawler/blob/a4b9cb64b073ec452f1b12b5225539e53996689b/exception/request_exception.py | exception/request_exception.py | from exception.bilibili_exception import BilibiliException
class RequestException(BilibiliException):
def __init__(self, msg) -> None:
super().__init__(msg)
| python | MIT | a4b9cb64b073ec452f1b12b5225539e53996689b | 2026-01-05T07:13:29.310919Z | false |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.