repo
stringclasses
454 values
file_path
stringlengths
5
201
extension
stringclasses
1 value
content
stringlengths
8
509k
num_lines
int64
3
16.9k
size_bytes
int64
8
511k
ControlNet
annotator/uniformer/mmcv/ops/voxelize.py
.py
# Copyright (c) OpenMMLab. All rights reserved. import torch from torch import nn from torch.autograd import Function from torch.nn.modules.utils import _pair from ..utils import ext_loader ext_module = ext_loader.load_ext( '_ext', ['dynamic_voxelize_forward', 'hard_voxelize_forward']) class _Voxelization(Funct...
133
5,286
ControlNet
annotator/uniformer/mmcv/ops/gather_points.py
.py
import torch from torch.autograd import Function from ..utils import ext_loader ext_module = ext_loader.load_ext( '_ext', ['gather_points_forward', 'gather_points_backward']) class GatherPoints(Function): """Gather points with given index.""" @staticmethod def forward(ctx, features: torch.Tensor, ...
58
1,607
ControlNet
annotator/uniformer/mmcv/ops/upfirdn2d.py
.py
# modified from https://github.com/rosinality/stylegan2-pytorch/blob/master/op/upfirdn2d.py # noqa:E501 # Copyright (c) 2021, NVIDIA Corporation. All rights reserved. # NVIDIA Source Code License for StyleGAN2 with Adaptive Discriminator # Augmentation (ADA) # =========================================================...
331
11,804
ControlNet
annotator/uniformer/mmcv/ops/ball_query.py
.py
# Copyright (c) OpenMMLab. All rights reserved. import torch from torch.autograd import Function from ..utils import ext_loader ext_module = ext_loader.load_ext('_ext', ['ball_query_forward']) class BallQuery(Function): """Find nearby points in spherical space.""" @staticmethod def forward(ctx, min_rad...
56
1,695
ControlNet
annotator/uniformer/mmcv/ops/masked_conv.py
.py
# Copyright (c) OpenMMLab. All rights reserved. import math import torch import torch.nn as nn from torch.autograd import Function from torch.autograd.function import once_differentiable from torch.nn.modules.utils import _pair from ..utils import ext_loader ext_module = ext_loader.load_ext( '_ext', ['masked_im2...
112
3,761
ControlNet
annotator/uniformer/mmcv/ops/psa_mask.py
.py
# Modified from https://github.com/hszhao/semseg/blob/master/lib/psa from torch import nn from torch.autograd import Function from torch.nn.modules.utils import _pair from ..utils import ext_loader ext_module = ext_loader.load_ext('_ext', ['psamask_forward', 'psamask_backward']) cla...
93
2,773
ControlNet
annotator/uniformer/mmcv/ops/fused_bias_leakyrelu.py
.py
# modified from https://github.com/rosinality/stylegan2-pytorch/blob/master/op/fused_act.py # noqa:E501 # Copyright (c) 2021, NVIDIA Corporation. All rights reserved. # NVIDIA Source Code License for StyleGAN2 with Adaptive Discriminator # Augmentation (ADA) # ==========================================================...
269
10,031
ControlNet
annotator/uniformer/mmcv/ops/roi_align.py
.py
# Copyright (c) OpenMMLab. All rights reserved. import torch import torch.nn as nn from torch.autograd import Function from torch.autograd.function import once_differentiable from torch.nn.modules.utils import _pair from ..utils import deprecated_api_warning, ext_loader ext_module = ext_loader.load_ext('_ext', ...
224
8,519
ControlNet
annotator/uniformer/mmcv/ops/three_nn.py
.py
from typing import Tuple import torch from torch.autograd import Function from ..utils import ext_loader ext_module = ext_loader.load_ext('_ext', ['three_nn_forward']) class ThreeNN(Function): """Find the top-3 nearest neighbors of the target set from the source set. Please refer to `Paper of PointNet++ <...
52
1,515
ControlNet
annotator/uniformer/mmcv/ops/tin_shift.py
.py
# Copyright (c) OpenMMLab. All rights reserved. # Code reference from "Temporal Interlacing Network" # https://github.com/deepcs233/TIN/blob/master/cuda_shift/rtc_wrap.py # Hao Shao, Shengju Qian, Yu Liu # shaoh19@mails.tsinghua.edu.cn, sjqian@cse.cuhk.edu.hk, yuliu@ee.cuhk.edu.hk import torch import torch.nn as nn fr...
69
2,141
ControlNet
annotator/uniformer/mmcv/ops/roipoint_pool3d.py
.py
from torch import nn as nn from torch.autograd import Function from ..utils import ext_loader ext_module = ext_loader.load_ext('_ext', ['roipoint_pool3d_forward']) class RoIPointPool3d(nn.Module): """Encode the geometry-specific features of each 3D proposal. Please refer to `Paper of PartA2 <https://arxiv....
78
2,990
ControlNet
annotator/uniformer/mmcv/ops/points_sampler.py
.py
from typing import List import torch from torch import nn as nn from annotator.uniformer.mmcv.runner import force_fp32 from .furthest_point_sample import (furthest_point_sample, furthest_point_sample_with_dist) def calc_square_dist(point_feat_a, point_feat_b, norm=True): """C...
178
6,063
ControlNet
annotator/uniformer/mmcv/ops/carafe.py
.py
# Copyright (c) OpenMMLab. All rights reserved. import torch import torch.nn as nn import torch.nn.functional as F from torch.autograd import Function from torch.nn.modules.module import Module from ..cnn import UPSAMPLE_LAYERS, normal_init, xavier_init from ..utils import ext_loader ext_module = ext_loader.load_ext(...
288
9,873
ControlNet
annotator/uniformer/mmcv/ops/point_sample.py
.py
# Modified from https://github.com/facebookresearch/detectron2/tree/master/projects/PointRend # noqa from os import path as osp import torch import torch.nn as nn import torch.nn.functional as F from torch.nn.modules.utils import _pair from torch.onnx.operators import shape_as_tensor def bilinear_grid_sample(im, g...
337
12,291
ControlNet
annotator/uniformer/mmcv/ops/knn.py
.py
import torch from torch.autograd import Function from ..utils import ext_loader ext_module = ext_loader.load_ext('_ext', ['knn_forward']) class KNN(Function): r"""KNN (CUDA) based on heap data structure. Modified from `PAConv <https://github.com/CVMI-Lab/PAConv/tree/main/ scene_seg/lib/pointops/src/knnq...
78
2,599
ControlNet
annotator/uniformer/mmcv/ops/focal_loss.py
.py
# Copyright (c) OpenMMLab. All rights reserved. import torch import torch.nn as nn from torch.autograd import Function from torch.autograd.function import once_differentiable from ..utils import ext_loader ext_module = ext_loader.load_ext('_ext', [ 'sigmoid_focal_loss_forward', 'sigmoid_focal_loss_backward', ...
213
6,582
ControlNet
annotator/uniformer/mmcv/ops/saconv.py
.py
# Copyright (c) OpenMMLab. All rights reserved. import torch import torch.nn as nn import torch.nn.functional as F from annotator.uniformer.mmcv.cnn import CONV_LAYERS, ConvAWS2d, constant_init from annotator.uniformer.mmcv.ops.deform_conv import deform_conv2d from annotator.uniformer.mmcv.utils import TORCH_VERSION, ...
146
5,804
ControlNet
annotator/uniformer/mmcv/ops/correlation.py
.py
# Copyright (c) OpenMMLab. All rights reserved. import torch from torch import Tensor, nn from torch.autograd import Function from torch.autograd.function import once_differentiable from torch.nn.modules.utils import _pair from ..utils import ext_loader ext_module = ext_loader.load_ext( '_ext', ['correlation_forw...
197
6,697
ControlNet
annotator/uniformer/mmcv/ops/scatter_points.py
.py
# Copyright (c) OpenMMLab. All rights reserved. import torch from torch import nn from torch.autograd import Function from ..utils import ext_loader ext_module = ext_loader.load_ext( '_ext', ['dynamic_point_to_voxel_forward', 'dynamic_point_to_voxel_backward']) class _DynamicScatter(Function): @staticm...
136
5,201
ControlNet
annotator/uniformer/mmcv/video/io.py
.py
# Copyright (c) OpenMMLab. All rights reserved. import os.path as osp from collections import OrderedDict import cv2 from cv2 import (CAP_PROP_FOURCC, CAP_PROP_FPS, CAP_PROP_FRAME_COUNT, CAP_PROP_FRAME_HEIGHT, CAP_PROP_FRAME_WIDTH, CAP_PROP_POS_FRAMES, VideoWriter_fourcc) from annota...
319
10,209
ControlNet
annotator/uniformer/mmcv/video/optflow.py
.py
# Copyright (c) OpenMMLab. All rights reserved. import warnings import cv2 import numpy as np from annotator.uniformer.mmcv.arraymisc import dequantize, quantize from annotator.uniformer.mmcv.image import imread, imwrite from annotator.uniformer.mmcv.utils import is_str def flowread(flow_or_path, quantize=False, co...
255
9,728
ControlNet
annotator/uniformer/mmcv/video/__init__.py
.py
# Copyright (c) OpenMMLab. All rights reserved. from .io import Cache, VideoReader, frames2video from .optflow import (dequantize_flow, flow_from_bytes, flow_warp, flowread, flowwrite, quantize_flow, sparse_flow_from_bytes) from .processing import concat_video, convert_video, cut_video, resize_vid...
12
570
ControlNet
annotator/uniformer/mmcv/video/processing.py
.py
# Copyright (c) OpenMMLab. All rights reserved. import os import os.path as osp import subprocess import tempfile from annotator.uniformer.mmcv.utils import requires_executable @requires_executable('ffmpeg') def convert_video(in_file, out_file, print_cmd=False, p...
161
5,291
ControlNet
annotator/uniformer/configs/_base_/default_runtime.py
.py
# yapf:disable log_config = dict( interval=50, hooks=[ dict(type='TextLoggerHook', by_epoch=False), # dict(type='TensorboardLoggerHook') ]) # yapf:enable dist_params = dict(backend='nccl') log_level = 'INFO' load_from = None resume_from = None workflow = [('train', 1)] cudnn_benchmark = True...
15
321
ControlNet
annotator/uniformer/configs/_base_/schedules/schedule_20k.py
.py
# optimizer optimizer = dict(type='SGD', lr=0.01, momentum=0.9, weight_decay=0.0005) optimizer_config = dict() # learning policy lr_config = dict(policy='poly', power=0.9, min_lr=1e-4, by_epoch=False) # runtime settings runner = dict(type='IterBasedRunner', max_iters=20000) checkpoint_config = dict(by_epoch=False, inte...
10
379
ControlNet
annotator/uniformer/configs/_base_/schedules/schedule_80k.py
.py
# optimizer optimizer = dict(type='SGD', lr=0.01, momentum=0.9, weight_decay=0.0005) optimizer_config = dict() # learning policy lr_config = dict(policy='poly', power=0.9, min_lr=1e-4, by_epoch=False) # runtime settings runner = dict(type='IterBasedRunner', max_iters=80000) checkpoint_config = dict(by_epoch=False, inte...
10
379
ControlNet
annotator/uniformer/configs/_base_/schedules/schedule_160k.py
.py
# optimizer optimizer = dict(type='SGD', lr=0.01, momentum=0.9, weight_decay=0.0005) optimizer_config = dict() # learning policy lr_config = dict(policy='poly', power=0.9, min_lr=1e-4, by_epoch=False) # runtime settings runner = dict(type='IterBasedRunner', max_iters=160000) checkpoint_config = dict(by_epoch=False, int...
10
382
ControlNet
annotator/uniformer/configs/_base_/schedules/schedule_40k.py
.py
# optimizer optimizer = dict(type='SGD', lr=0.01, momentum=0.9, weight_decay=0.0005) optimizer_config = dict() # learning policy lr_config = dict(policy='poly', power=0.9, min_lr=1e-4, by_epoch=False) # runtime settings runner = dict(type='IterBasedRunner', max_iters=40000) checkpoint_config = dict(by_epoch=False, inte...
10
379
ControlNet
annotator/uniformer/configs/_base_/datasets/pascal_context_59.py
.py
# dataset settings dataset_type = 'PascalContextDataset59' data_root = 'data/VOCdevkit/VOC2010/' img_norm_cfg = dict( mean=[123.675, 116.28, 103.53], std=[58.395, 57.12, 57.375], to_rgb=True) img_scale = (520, 520) crop_size = (480, 480) train_pipeline = [ dict(type='LoadImageFromFile'), dict(type='LoadAn...
61
2,024
ControlNet
annotator/uniformer/configs/_base_/datasets/pascal_voc12_aug.py
.py
_base_ = './pascal_voc12.py' # dataset settings data = dict( train=dict( ann_dir=['SegmentationClass', 'SegmentationClassAug'], split=[ 'ImageSets/Segmentation/train.txt', 'ImageSets/Segmentation/aug.txt' ]))
10
261
ControlNet
annotator/uniformer/configs/_base_/datasets/stare.py
.py
# dataset settings dataset_type = 'STAREDataset' data_root = 'data/STARE' img_norm_cfg = dict( mean=[123.675, 116.28, 103.53], std=[58.395, 57.12, 57.375], to_rgb=True) img_scale = (605, 700) crop_size = (128, 128) train_pipeline = [ dict(type='LoadImageFromFile'), dict(type='LoadAnnotations'), dict(typ...
60
1,917
ControlNet
annotator/uniformer/configs/_base_/datasets/pascal_context.py
.py
# dataset settings dataset_type = 'PascalContextDataset' data_root = 'data/VOCdevkit/VOC2010/' img_norm_cfg = dict( mean=[123.675, 116.28, 103.53], std=[58.395, 57.12, 57.375], to_rgb=True) img_scale = (520, 520) crop_size = (480, 480) train_pipeline = [ dict(type='LoadImageFromFile'), dict(type='LoadAnno...
61
1,998
ControlNet
annotator/uniformer/configs/_base_/datasets/cityscapes_769x769.py
.py
_base_ = './cityscapes.py' img_norm_cfg = dict( mean=[123.675, 116.28, 103.53], std=[58.395, 57.12, 57.375], to_rgb=True) crop_size = (769, 769) train_pipeline = [ dict(type='LoadImageFromFile'), dict(type='LoadAnnotations'), dict(type='Resize', img_scale=(2049, 1025), ratio_range=(0.5, 2.0)), dict(...
36
1,281
ControlNet
annotator/uniformer/configs/_base_/datasets/cityscapes.py
.py
# dataset settings dataset_type = 'CityscapesDataset' data_root = 'data/cityscapes/' img_norm_cfg = dict( mean=[123.675, 116.28, 103.53], std=[58.395, 57.12, 57.375], to_rgb=True) crop_size = (512, 1024) train_pipeline = [ dict(type='LoadImageFromFile'), dict(type='LoadAnnotations'), dict(type='Resize',...
55
1,780
ControlNet
annotator/uniformer/configs/_base_/datasets/chase_db1.py
.py
# dataset settings dataset_type = 'ChaseDB1Dataset' data_root = 'data/CHASE_DB1' img_norm_cfg = dict( mean=[123.675, 116.28, 103.53], std=[58.395, 57.12, 57.375], to_rgb=True) img_scale = (960, 999) crop_size = (128, 128) train_pipeline = [ dict(type='LoadImageFromFile'), dict(type='LoadAnnotations'), d...
60
1,924
ControlNet
annotator/uniformer/configs/_base_/datasets/ade20k.py
.py
# dataset settings dataset_type = 'ADE20KDataset' data_root = 'data/ade/ADEChallengeData2016' img_norm_cfg = dict( mean=[123.675, 116.28, 103.53], std=[58.395, 57.12, 57.375], to_rgb=True) crop_size = (512, 512) train_pipeline = [ dict(type='LoadImageFromFile'), dict(type='LoadAnnotations', reduce_zero_labe...
55
1,844
ControlNet
annotator/uniformer/configs/_base_/datasets/pascal_voc12.py
.py
# dataset settings dataset_type = 'PascalVOCDataset' data_root = 'data/VOCdevkit/VOC2012' img_norm_cfg = dict( mean=[123.675, 116.28, 103.53], std=[58.395, 57.12, 57.375], to_rgb=True) crop_size = (512, 512) train_pipeline = [ dict(type='LoadImageFromFile'), dict(type='LoadAnnotations'), dict(type='Resi...
58
1,930
ControlNet
annotator/uniformer/configs/_base_/datasets/drive.py
.py
# dataset settings dataset_type = 'DRIVEDataset' data_root = 'data/DRIVE' img_norm_cfg = dict( mean=[123.675, 116.28, 103.53], std=[58.395, 57.12, 57.375], to_rgb=True) img_scale = (584, 565) crop_size = (64, 64) train_pipeline = [ dict(type='LoadImageFromFile'), dict(type='LoadAnnotations'), dict(type=...
60
1,915
ControlNet
annotator/uniformer/configs/_base_/datasets/hrf.py
.py
# dataset settings dataset_type = 'HRFDataset' data_root = 'data/HRF' img_norm_cfg = dict( mean=[123.675, 116.28, 103.53], std=[58.395, 57.12, 57.375], to_rgb=True) img_scale = (2336, 3504) crop_size = (256, 256) train_pipeline = [ dict(type='LoadImageFromFile'), dict(type='LoadAnnotations'), dict(type=...
60
1,915
ControlNet
annotator/uniformer/configs/_base_/models/upernet_uniformer.py
.py
# model settings norm_cfg = dict(type='BN', requires_grad=True) model = dict( type='EncoderDecoder', pretrained=None, backbone=dict( type='UniFormer', embed_dim=[64, 128, 320, 512], layers=[3, 4, 8, 3], head_dim=64, mlp_ratio=4., qkv_bias=True, drop_ra...
43
1,235
ControlNet
annotator/uniformer/configs/_base_/models/ann_r50-d8.py
.py
# model settings norm_cfg = dict(type='SyncBN', requires_grad=True) model = dict( type='EncoderDecoder', pretrained='open-mmlab://resnet50_v1c', backbone=dict( type='ResNetV1c', depth=50, num_stages=4, out_indices=(0, 1, 2, 3), dilations=(1, 1, 2, 4), strides=...
47
1,346
ControlNet
annotator/uniformer/configs/_base_/models/dmnet_r50-d8.py
.py
# model settings norm_cfg = dict(type='SyncBN', requires_grad=True) model = dict( type='EncoderDecoder', pretrained='open-mmlab://resnet50_v1c', backbone=dict( type='ResNetV1c', depth=50, num_stages=4, out_indices=(0, 1, 2, 3), dilations=(1, 1, 2, 4), strides=...
45
1,302
ControlNet
annotator/uniformer/configs/_base_/models/apcnet_r50-d8.py
.py
# model settings norm_cfg = dict(type='SyncBN', requires_grad=True) model = dict( type='EncoderDecoder', pretrained='open-mmlab://resnet50_v1c', backbone=dict( type='ResNetV1c', depth=50, num_stages=4, out_indices=(0, 1, 2, 3), dilations=(1, 1, 2, 4), strides=...
45
1,302
ControlNet
annotator/uniformer/configs/_base_/models/pspnet_r50-d8.py
.py
# model settings norm_cfg = dict(type='SyncBN', requires_grad=True) model = dict( type='EncoderDecoder', pretrained='open-mmlab://resnet50_v1c', backbone=dict( type='ResNetV1c', depth=50, num_stages=4, out_indices=(0, 1, 2, 3), dilations=(1, 1, 2, 4), strides=...
45
1,271
ControlNet
annotator/uniformer/configs/_base_/models/fast_scnn.py
.py
# model settings norm_cfg = dict(type='SyncBN', requires_grad=True, momentum=0.01) model = dict( type='EncoderDecoder', backbone=dict( type='FastSCNN', downsample_dw_channels=(32, 48), global_in_channels=64, global_block_channels=(64, 96, 128), global_block_strides=(2, 2,...
58
1,761
ControlNet
annotator/uniformer/configs/_base_/models/fcn_r50-d8.py
.py
# model settings norm_cfg = dict(type='SyncBN', requires_grad=True) model = dict( type='EncoderDecoder', pretrained='open-mmlab://resnet50_v1c', backbone=dict( type='ResNetV1c', depth=50, num_stages=4, out_indices=(0, 1, 2, 3), dilations=(1, 1, 2, 4), strides=...
46
1,285
ControlNet
annotator/uniformer/configs/_base_/models/fcn_unet_s5-d16.py
.py
# model settings norm_cfg = dict(type='SyncBN', requires_grad=True) model = dict( type='EncoderDecoder', pretrained=None, backbone=dict( type='UNet', in_channels=3, base_channels=64, num_stages=5, strides=(1, 1, 1, 1, 1), enc_num_convs=(2, 2, 2, 2, 2), ...
52
1,512
ControlNet
annotator/uniformer/configs/_base_/models/deeplabv3plus_r50-d8.py
.py
# model settings norm_cfg = dict(type='SyncBN', requires_grad=True) model = dict( type='EncoderDecoder', pretrained='open-mmlab://resnet50_v1c', backbone=dict( type='ResNetV1c', depth=50, num_stages=4, out_indices=(0, 1, 2, 3), dilations=(1, 1, 2, 4), strides=...
47
1,343
ControlNet
annotator/uniformer/configs/_base_/models/fpn_uniformer.py
.py
# model settings norm_cfg = dict(type='SyncBN', requires_grad=True) model = dict( type='EncoderDecoder', backbone=dict( type='UniFormer', embed_dim=[64, 128, 320, 512], layers=[3, 4, 8, 3], head_dim=64, mlp_ratio=4., qkv_bias=True, drop_rate=0., at...
36
977
ControlNet
annotator/uniformer/configs/_base_/models/encnet_r50-d8.py
.py
# model settings norm_cfg = dict(type='SyncBN', requires_grad=True) model = dict( type='EncoderDecoder', pretrained='open-mmlab://resnet50_v1c', backbone=dict( type='ResNetV1c', depth=50, num_stages=4, out_indices=(0, 1, 2, 3), dilations=(1, 1, 2, 4), strides=...
49
1,435
ControlNet
annotator/uniformer/configs/_base_/models/upernet_r50.py
.py
# model settings norm_cfg = dict(type='SyncBN', requires_grad=True) model = dict( type='EncoderDecoder', pretrained='open-mmlab://resnet50_v1c', backbone=dict( type='ResNetV1c', depth=50, num_stages=4, out_indices=(0, 1, 2, 3), dilations=(1, 1, 1, 1), strides=...
45
1,301
ControlNet
annotator/uniformer/configs/_base_/models/ocrnet_hr18.py
.py
# model settings norm_cfg = dict(type='SyncBN', requires_grad=True) model = dict( type='CascadeEncoderDecoder', num_stages=2, pretrained='open-mmlab://msra/hrnetv2_w18', backbone=dict( type='HRNet', norm_cfg=norm_cfg, norm_eval=False, extra=dict( stage1=dict( ...
69
2,196
ControlNet
annotator/uniformer/configs/_base_/models/pspnet_unet_s5-d16.py
.py
# model settings norm_cfg = dict(type='SyncBN', requires_grad=True) model = dict( type='EncoderDecoder', pretrained=None, backbone=dict( type='UNet', in_channels=3, base_channels=64, num_stages=5, strides=(1, 1, 1, 1, 1), enc_num_convs=(2, 2, 2, 2, 2), ...
51
1,497
ControlNet
annotator/uniformer/configs/_base_/models/gcnet_r50-d8.py
.py
# model settings norm_cfg = dict(type='SyncBN', requires_grad=True) model = dict( type='EncoderDecoder', pretrained='open-mmlab://resnet50_v1c', backbone=dict( type='ResNetV1c', depth=50, num_stages=4, out_indices=(0, 1, 2, 3), dilations=(1, 1, 2, 4), strides=...
47
1,326
ControlNet
annotator/uniformer/configs/_base_/models/emanet_r50-d8.py
.py
# model settings norm_cfg = dict(type='SyncBN', requires_grad=True) model = dict( type='EncoderDecoder', pretrained='open-mmlab://resnet50_v1c', backbone=dict( type='ResNetV1c', depth=50, num_stages=4, out_indices=(0, 1, 2, 3), dilations=(1, 1, 2, 4), strides=...
48
1,329
ControlNet
annotator/uniformer/configs/_base_/models/fpn_r50.py
.py
# model settings norm_cfg = dict(type='SyncBN', requires_grad=True) model = dict( type='EncoderDecoder', pretrained='open-mmlab://resnet50_v1c', backbone=dict( type='ResNetV1c', depth=50, num_stages=4, out_indices=(0, 1, 2, 3), dilations=(1, 1, 1, 1), strides=...
37
1,056
ControlNet
annotator/uniformer/configs/_base_/models/ccnet_r50-d8.py
.py
# model settings norm_cfg = dict(type='SyncBN', requires_grad=True) model = dict( type='EncoderDecoder', pretrained='open-mmlab://resnet50_v1c', backbone=dict( type='ResNetV1c', depth=50, num_stages=4, out_indices=(0, 1, 2, 3), dilations=(1, 1, 2, 4), strides=...
45
1,258
ControlNet
annotator/uniformer/configs/_base_/models/deeplabv3_r50-d8.py
.py
# model settings norm_cfg = dict(type='SyncBN', requires_grad=True) model = dict( type='EncoderDecoder', pretrained='open-mmlab://resnet50_v1c', backbone=dict( type='ResNetV1c', depth=50, num_stages=4, out_indices=(0, 1, 2, 3), dilations=(1, 1, 2, 4), strides=...
45
1,273
ControlNet
annotator/uniformer/configs/_base_/models/lraspp_m-v3-d8.py
.py
# model settings norm_cfg = dict(type='SyncBN', eps=0.001, requires_grad=True) model = dict( type='EncoderDecoder', backbone=dict( type='MobileNetV3', arch='large', out_indices=(1, 3, 16), norm_cfg=norm_cfg), decode_head=dict( type='LRASPPHead', in_channels=(1...
26
766
ControlNet
annotator/uniformer/configs/_base_/models/cgnet.py
.py
# model settings norm_cfg = dict(type='SyncBN', eps=1e-03, requires_grad=True) model = dict( type='EncoderDecoder', backbone=dict( type='CGNet', norm_cfg=norm_cfg, in_channels=3, num_channels=(32, 64, 128), num_blocks=(3, 21), dilations=(2, 4), reductions=...
36
1,110
ControlNet
annotator/uniformer/configs/_base_/models/danet_r50-d8.py
.py
# model settings norm_cfg = dict(type='SyncBN', requires_grad=True) model = dict( type='EncoderDecoder', pretrained='open-mmlab://resnet50_v1c', backbone=dict( type='ResNetV1c', depth=50, num_stages=4, out_indices=(0, 1, 2, 3), dilations=(1, 1, 2, 4), strides=...
45
1,261
ControlNet
annotator/uniformer/configs/_base_/models/ocrnet_r50-d8.py
.py
# model settings norm_cfg = dict(type='SyncBN', requires_grad=True) model = dict( type='CascadeEncoderDecoder', num_stages=2, pretrained='open-mmlab://resnet50_v1c', backbone=dict( type='ResNetV1c', depth=50, num_stages=4, out_indices=(0, 1, 2, 3), dilations=(1, 1...
48
1,385
ControlNet
annotator/uniformer/configs/_base_/models/psanet_r50-d8.py
.py
# model settings norm_cfg = dict(type='SyncBN', requires_grad=True) model = dict( type='EncoderDecoder', pretrained='open-mmlab://resnet50_v1c', backbone=dict( type='ResNetV1c', depth=50, num_stages=4, out_indices=(0, 1, 2, 3), dilations=(1, 1, 2, 4), strides=...
50
1,406
ControlNet
annotator/uniformer/configs/_base_/models/fcn_hr18.py
.py
# model settings norm_cfg = dict(type='SyncBN', requires_grad=True) model = dict( type='EncoderDecoder', pretrained='open-mmlab://msra/hrnetv2_w18', backbone=dict( type='HRNet', norm_cfg=norm_cfg, norm_eval=False, extra=dict( stage1=dict( num_modul...
53
1,646
ControlNet
annotator/uniformer/configs/_base_/models/nonlocal_r50-d8.py
.py
# model settings norm_cfg = dict(type='SyncBN', requires_grad=True) model = dict( type='EncoderDecoder', pretrained='open-mmlab://resnet50_v1c', backbone=dict( type='ResNetV1c', depth=50, num_stages=4, out_indices=(0, 1, 2, 3), dilations=(1, 1, 2, 4), strides=...
47
1,315
ControlNet
annotator/uniformer/configs/_base_/models/dnl_r50-d8.py
.py
# model settings norm_cfg = dict(type='SyncBN', requires_grad=True) model = dict( type='EncoderDecoder', pretrained='open-mmlab://resnet50_v1c', backbone=dict( type='ResNetV1c', depth=50, num_stages=4, out_indices=(0, 1, 2, 3), dilations=(1, 1, 2, 4), strides=...
47
1,316
ControlNet
annotator/uniformer/configs/_base_/models/pointrend_r50.py
.py
# model settings norm_cfg = dict(type='SyncBN', requires_grad=True) model = dict( type='CascadeEncoderDecoder', num_stages=2, pretrained='open-mmlab://resnet50_v1c', backbone=dict( type='ResNetV1c', depth=50, num_stages=4, out_indices=(0, 1, 2, 3), dilations=(1, 1...
57
1,704
ControlNet
annotator/uniformer/configs/_base_/models/deeplabv3_unet_s5-d16.py
.py
# model settings norm_cfg = dict(type='SyncBN', requires_grad=True) model = dict( type='EncoderDecoder', pretrained=None, backbone=dict( type='UNet', in_channels=3, base_channels=64, num_stages=5, strides=(1, 1, 1, 1, 1), enc_num_convs=(2, 2, 2, 2, 2), ...
51
1,499
ControlNet
annotator/uniformer/exp/upernet_global_small/test_config_w32.py
.py
_base_ = [ '../../configs/_base_/models/upernet_uniformer.py', '../../configs/_base_/datasets/ade20k.py', '../../configs/_base_/default_runtime.py', '../../configs/_base_/schedules/schedule_160k.py' ] model = dict( backbone=dict( type='UniFormer', embed_dim=[64, 128, 320, 512], ...
39
1,339
ControlNet
annotator/uniformer/exp/upernet_global_small/test_config_g.py
.py
_base_ = [ '../../configs/_base_/models/upernet_uniformer.py', '../../configs/_base_/datasets/ade20k.py', '../../configs/_base_/default_runtime.py', '../../configs/_base_/schedules/schedule_160k.py' ] model = dict( backbone=dict( type='UniFormer', embed_dim=[64, 128, 320, 512], ...
38
1,317
ControlNet
annotator/uniformer/exp/upernet_global_small/test_config_h32.py
.py
_base_ = [ '../../configs/_base_/models/upernet_uniformer.py', '../../configs/_base_/datasets/ade20k.py', '../../configs/_base_/default_runtime.py', '../../configs/_base_/schedules/schedule_160k.py' ] model = dict( backbone=dict( type='UniFormer', embed_dim=[64, 128, 320, 512], ...
39
1,339
ControlNet
annotator/uniformer/exp/upernet_global_small/config.py
.py
_base_ = [ '../../configs/_base_/models/upernet_uniformer.py', '../../configs/_base_/datasets/ade20k.py', '../../configs/_base_/default_runtime.py', '../../configs/_base_/schedules/schedule_160k.py' ] model = dict( backbone=dict( type='UniFormer', embed_dim=[64, 128, 320, 512], ...
38
1,316
ControlNet
annotator/midas/__init__.py
.py
# Midas Depth Estimation # From https://github.com/isl-org/MiDaS # MIT LICENSE import cv2 import numpy as np import torch from einops import rearrange from .api import MiDaSInference class MidasDetector: def __init__(self): self.model = MiDaSInference(model_type="dpt_hybrid").cuda() def __call__(se...
43
1,480
ControlNet
annotator/midas/api.py
.py
# based on https://github.com/isl-org/MiDaS import cv2 import os import torch import torch.nn as nn from torchvision.transforms import Compose from .midas.dpt_depth import DPTDepthModel from .midas.midas_net import MidasNet from .midas.midas_net_custom import MidasNet_small from .midas.transforms import Resize, Norma...
170
5,229
ControlNet
annotator/openpose/util.py
.py
import math import numpy as np import matplotlib import cv2 def padRightDownCorner(img, stride, padValue): h = img.shape[0] w = img.shape[1] pad = 4 * [None] pad[0] = 0 # up pad[1] = 0 # left pad[2] = 0 if (h % stride == 0) else stride - (h % stride) # down pad[3] = 0 if (w % stride == 0)...
165
7,507
ControlNet
annotator/openpose/__init__.py
.py
# Openpose # Original from CMU https://github.com/CMU-Perceptual-Computing-Lab/openpose # 2nd Edited by https://github.com/Hzzone/pytorch-openpose # 3rd Edited by ControlNet import os os.environ["KMP_DUPLICATE_LIB_OK"]="TRUE" import torch import numpy as np from . import util from .body import Body from .hand import ...
50
2,132
ControlNet
annotator/openpose/hand.py
.py
import cv2 import json import numpy as np import math import time from scipy.ndimage.filters import gaussian_filter import matplotlib.pyplot as plt import matplotlib import torch from skimage.measure import label from .model import handpose_model from . import util class Hand(object): def __init__(self, model_pat...
86
3,438
ControlNet
annotator/openpose/body.py
.py
import cv2 import numpy as np import math import time from scipy.ndimage.filters import gaussian_filter import matplotlib.pyplot as plt import matplotlib import torch from torchvision import transforms from . import util from .model import bodypose_model class Body(object): def __init__(self, model_path): ...
220
10,994
TaskMatrix
visual_chatgpt.py
.py
# Copyright (c) Microsoft Corporation. # Licensed under the MIT License. # coding: utf-8 import os import gradio as gr import random import torch import cv2 import re import uuid from PIL import Image, ImageDraw, ImageOps, ImageFont import math import numpy as np import argparse import inspect import tempfile from tra...
1,584
81,041
TaskMatrix
LowCodeLLM/src/app.py
.py
# Copyright (c) Microsoft Corporation. # Licensed under the MIT License. import os from flask import Flask, request, send_from_directory from flask_cors import CORS, cross_origin from lowCodeLLM import lowCodeLLM from flask.logging import default_handler import logging app = Flask('lowcode-llm', static_folder='', tem...
67
2,493
TaskMatrix
LowCodeLLM/src/lowCodeLLM.py
.py
# Copyright (c) Microsoft Corporation. # Licensed under the MIT License. from planningLLM import planningLLM from executingLLM import executingLLM import json class lowCodeLLM: def __init__(self, PLLM_temperature=0.4, ELLM_temperature=0): self.PLLM = planningLLM(PLLM_temperature) self.ELLM = execu...
47
2,021
TaskMatrix
LowCodeLLM/src/planningLLM.py
.py
# Copyright (c) Microsoft Corporation. # Licensed under the MIT License. import re import json from openAIWrapper import OpenAIWrapper PLANNING_LLM_PREFIX = """Planning LLM is designed to provide a standard operating procedure so that an difficult task will be broken down into several steps, and the task will be easi...
105
5,657
TaskMatrix
LowCodeLLM/src/openAIWrapper.py
.py
# Copyright (c) Microsoft Corporation. # Licensed under the MIT License. import os import openai class OpenAIWrapper: def __init__(self, temperature): self.key = os.environ.get("OPENAIKEY") openai.api_key = self.key # Access the USE_AZURE environment variable self.use_azure = os.e...
64
2,180
TaskMatrix
LowCodeLLM/src/executingLLM.py
.py
# Copyright (c) Microsoft Corporation. # Licensed under the MIT License. from openAIWrapper import OpenAIWrapper EXECUTING_LLM_PREFIX = """Executing LLM is designed to provide outstanding responses. Executing LLM will be given a overall task as the background of the conversation between the Executing LLM and human. W...
42
1,988
TaskMatrix
LowCodeLLM/src/test/test_extend_workflow.py
.py
# Copyright (c) Microsoft Corporation. # Licensed under the MIT License. import json import sys import os import time sys.path.append(os.getcwd()) def test_extend_workflow(): from lowCodeLLM import lowCodeLLM cases = json.load(open("./test/testcases/extend_workflow_test_cases.json", "r")) llm = lowCodeLLM...
20
620
TaskMatrix
LowCodeLLM/src/test/test_get_workflow.py
.py
# Copyright (c) Microsoft Corporation. # Licensed under the MIT License. import json import sys import os sys.path.append(os.getcwd()) def test_get_workflow(): from lowCodeLLM import lowCodeLLM cases = json.load(open("./test/testcases/get_workflow_test_cases.json", "r")) llm = lowCodeLLM(0.5, 0) for c...
16
475
TaskMatrix
LowCodeLLM/src/test/test_execute.py
.py
# Copyright (c) Microsoft Corporation. # Licensed under the MIT License. import json import sys import os import time sys.path.append(os.getcwd()) def test_extend_workflow(): from lowCodeLLM import lowCodeLLM cases = json.load(open("./test/testcases/execute_test_cases.json", "r")) llm = lowCodeLLM(0.5, 0)...
22
692
ChatDev
run.py
.py
"""CLI entry point for executing ChatDev_new workflows.""" import argparse import json from pathlib import Path from typing import List, Union from runtime.bootstrap.schema import ensure_schema_registry_populated from check.check import load_config from entity.graph_config import GraphConfig from entity.messages impor...
124
3,803
ChatDev
server_main.py
.py
import argparse import logging from pathlib import Path from runtime.bootstrap.schema import ensure_schema_registry_populated from server.app import app ensure_schema_registry_populated() # Directories containing the server's Python sources. When --reload is # enabled, only these are watched so that agent-generate...
169
5,046
ChatDev
functions/function_calling/web.py
.py
import os def web_search(query: str, page: int = 1, language: str = "en", country: str = "us") -> str: """ Performs a web search based on the user-provided query with pagination. Args: query (str): The keyword(s) to search for. page (int): The page number of the results to return. Default...
173
6,565
ChatDev
functions/function_calling/user.py
.py
def call_user(instruction: str, _context: dict | None = None) -> str: """ If you think it's necessary to get input from the user, use this function to send the instruction to the user and get their response. Args: instruction: The instruction to send to the user. """ prompt = _context.get("...
18
741
ChatDev
functions/function_calling/utils.py
.py
import time from typing import Union def wait(seconds: float): """ Wait for a specified number of seconds. Args: seconds: The number of seconds to wait. """ if isinstance(seconds, str): # Convert string to float if necessary try: if "." in seconds: sec...
32
822
ChatDev
functions/function_calling/uv_related.py
.py
"""Utility tool to manage Python environments via uv.""" import os import re import subprocess from pathlib import Path from typing import Any, Dict, List, Mapping, Sequence _SAFE_PACKAGE_RE = re.compile(r"^[A-Za-z0-9_.\-+=<>!\[\],@:/]+$") _DEFAULT_TIMEOUT = float(os.getenv("LIB_INSTALL_TIMEOUT", "120")) _OUTPUT_SNIP...
314
10,561
ChatDev
functions/function_calling/file.py
.py
"""File-related function tools for model-invoked file access.""" import fnmatch import locale import mimetypes import os import re import shutil from dataclasses import dataclass from pathlib import Path from typing import ( Annotated, Any, Dict, Iterable, List, Literal, Mapping, Mutabl...
1,101
37,221
ChatDev
functions/function_calling/video.py
.py
import shutil import sys from pathlib import Path import ast import subprocess import tempfile def _get_class_names(py_file: str) -> list[str]: file_path = Path(py_file) source = file_path.read_text(encoding="utf-8") tree = ast.parse(source, filename=str(file_path)) return [node.name for node in ast.wa...
85
2,618
ChatDev
functions/function_calling/deep_research.py
.py
"""Deep research tools for search results and report management.""" import json import re from pathlib import Path from typing import Annotated, Any, Dict, List, Optional, Tuple from filelock import FileLock from entity.messages import MessageBlock, MessageBlockType from functions.function_calling.file import FileTo...
646
22,180
ChatDev
functions/function_calling/code_executor.py
.py
def execute_code(code: str, time_out: int = 60) -> str: """ Execute code and return std outputs and std error. Args: code (str): Code to execute. time_out (int): time out, in second. Returns: str: std output and std error """ import os import sys import subproce...
67
2,078
ChatDev
functions/function_calling/weather.py
.py
def get_city_num(city: str) -> dict: """ Fetch the city code for a given city name. Example response: { "city": "Beijing", "city_num": "1010", } """ return { "city_num": 3701 } def get_weather(city_num: int, unit: str = "celsius") -> dict: """ Fetch weath...
35
788
ChatDev
functions/edge_processor/transformers.py
.py
from typing import Dict, Any, Tuple import os import re import shutil import signal import subprocess import time from pathlib import Path from functions.function_calling.file import FileToolContext def uppercase_payload(data: str, _context: Dict[str, Any]) -> str: """Return an uppercase copy of the payload text."...
131
4,573
ChatDev
functions/edge/conditions.py
.py
"""Edge condition helpers used by workflow YAML definitions.""" import re def contains_keyword(data: str) -> bool: """Check if data contains the keyword 'trigger'.""" return "trigger" in data.lower() def length_greater_than_5(data: str) -> bool: """Check if data length is greater than 5.""" return le...
49
1,535