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 |
|---|---|---|---|---|---|---|---|---|
facebookresearch/detectron2 | https://github.com/facebookresearch/detectron2/blob/fd27788985af0f4ca800bca563acdb700bb890e2/projects/TridentNet/train_net.py | projects/TridentNet/train_net.py | #!/usr/bin/env python3
# Copyright (c) Facebook, Inc. and its affiliates.
"""
TridentNet Training Script.
This script is a simplified version of the training script in detectron2/tools.
"""
import os
from detectron2.checkpoint import DetectionCheckpointer
from detectron2.config import get_cfg
from detectron2.engine... | python | Apache-2.0 | fd27788985af0f4ca800bca563acdb700bb890e2 | 2026-01-04T14:42:35.134676Z | false |
facebookresearch/detectron2 | https://github.com/facebookresearch/detectron2/blob/fd27788985af0f4ca800bca563acdb700bb890e2/projects/TridentNet/tridentnet/trident_rcnn.py | projects/TridentNet/tridentnet/trident_rcnn.py | # Copyright (c) Facebook, Inc. and its affiliates.
from detectron2.layers import batched_nms
from detectron2.modeling import ROI_HEADS_REGISTRY, StandardROIHeads
from detectron2.modeling.roi_heads.roi_heads import Res5ROIHeads
from detectron2.structures import Instances
def merge_branch_instances(instances, num_branc... | python | Apache-2.0 | fd27788985af0f4ca800bca563acdb700bb890e2 | 2026-01-04T14:42:35.134676Z | false |
facebookresearch/detectron2 | https://github.com/facebookresearch/detectron2/blob/fd27788985af0f4ca800bca563acdb700bb890e2/projects/TridentNet/tridentnet/trident_conv.py | projects/TridentNet/tridentnet/trident_conv.py | # Copyright (c) Facebook, Inc. and its affiliates.
import torch
from torch import nn
from torch.nn import functional as F
from torch.nn.modules.utils import _pair
from detectron2.layers.wrappers import _NewEmptyTensorOp
class TridentConv(nn.Module):
def __init__(
self,
in_channels,
out_ch... | python | Apache-2.0 | fd27788985af0f4ca800bca563acdb700bb890e2 | 2026-01-04T14:42:35.134676Z | false |
facebookresearch/detectron2 | https://github.com/facebookresearch/detectron2/blob/fd27788985af0f4ca800bca563acdb700bb890e2/projects/TridentNet/tridentnet/trident_rpn.py | projects/TridentNet/tridentnet/trident_rpn.py | # Copyright (c) Facebook, Inc. and its affiliates.
import torch
from detectron2.modeling import PROPOSAL_GENERATOR_REGISTRY
from detectron2.modeling.proposal_generator.rpn import RPN
from detectron2.structures import ImageList
@PROPOSAL_GENERATOR_REGISTRY.register()
class TridentRPN(RPN):
"""
Trident RPN sub... | python | Apache-2.0 | fd27788985af0f4ca800bca563acdb700bb890e2 | 2026-01-04T14:42:35.134676Z | false |
facebookresearch/detectron2 | https://github.com/facebookresearch/detectron2/blob/fd27788985af0f4ca800bca563acdb700bb890e2/projects/TridentNet/tridentnet/config.py | projects/TridentNet/tridentnet/config.py | # -*- coding: utf-8 -*-
# Copyright (c) Facebook, Inc. and its affiliates.
from detectron2.config import CfgNode as CN
def add_tridentnet_config(cfg):
"""
Add config for tridentnet.
"""
_C = cfg
_C.MODEL.TRIDENT = CN()
# Number of branches for TridentNet.
_C.MODEL.TRIDENT.NUM_BRANCH = 3... | python | Apache-2.0 | fd27788985af0f4ca800bca563acdb700bb890e2 | 2026-01-04T14:42:35.134676Z | false |
facebookresearch/detectron2 | https://github.com/facebookresearch/detectron2/blob/fd27788985af0f4ca800bca563acdb700bb890e2/projects/TridentNet/tridentnet/__init__.py | projects/TridentNet/tridentnet/__init__.py | # Copyright (c) Facebook, Inc. and its affiliates.
from .config import add_tridentnet_config
from .trident_backbone import (
TridentBottleneckBlock,
build_trident_resnet_backbone,
make_trident_stage,
)
from .trident_rpn import TridentRPN
from .trident_rcnn import TridentRes5ROIHeads, TridentStandardROIHeads... | python | Apache-2.0 | fd27788985af0f4ca800bca563acdb700bb890e2 | 2026-01-04T14:42:35.134676Z | false |
facebookresearch/detectron2 | https://github.com/facebookresearch/detectron2/blob/fd27788985af0f4ca800bca563acdb700bb890e2/projects/TridentNet/tridentnet/trident_backbone.py | projects/TridentNet/tridentnet/trident_backbone.py | # Copyright (c) Facebook, Inc. and its affiliates.
import fvcore.nn.weight_init as weight_init
import torch
import torch.nn.functional as F
from detectron2.layers import Conv2d, FrozenBatchNorm2d, get_norm
from detectron2.modeling import BACKBONE_REGISTRY, ResNet, ResNetBlockBase
from detectron2.modeling.backbone.resn... | python | Apache-2.0 | fd27788985af0f4ca800bca563acdb700bb890e2 | 2026-01-04T14:42:35.134676Z | false |
facebookresearch/detectron2 | https://github.com/facebookresearch/detectron2/blob/fd27788985af0f4ca800bca563acdb700bb890e2/projects/PointSup/train_net.py | projects/PointSup/train_net.py | #!/usr/bin/env python
# Copyright (c) Facebook, Inc. and its affiliates.
"""
Point supervision Training Script.
This script is a simplified version of the training script in detectron2/tools.
"""
import os
import detectron2.utils.comm as comm
from detectron2.checkpoint import DetectionCheckpointer
from detectron2.co... | python | Apache-2.0 | fd27788985af0f4ca800bca563acdb700bb890e2 | 2026-01-04T14:42:35.134676Z | false |
facebookresearch/detectron2 | https://github.com/facebookresearch/detectron2/blob/fd27788985af0f4ca800bca563acdb700bb890e2/projects/PointSup/tools/prepare_coco_point_annotations_without_masks.py | projects/PointSup/tools/prepare_coco_point_annotations_without_masks.py | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved
import copy
import json
import numpy as np
import os
import sys
import pycocotools.mask as mask_utils
from detectron2.utils.env import seed_all_rng
from detectron2.utils.file_io import PathManager
d... | python | Apache-2.0 | fd27788985af0f4ca800bca563acdb700bb890e2 | 2026-01-04T14:42:35.134676Z | false |
facebookresearch/detectron2 | https://github.com/facebookresearch/detectron2/blob/fd27788985af0f4ca800bca563acdb700bb890e2/projects/PointSup/point_sup/point_utils.py | projects/PointSup/point_sup/point_utils.py | # Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved
import torch
from detectron2.layers import cat
def get_point_coords_from_point_annotation(instances):
"""
Load point coords and their corresponding labels from point annotation.
Args:
instances (list[Instances]): A list of N ... | python | Apache-2.0 | fd27788985af0f4ca800bca563acdb700bb890e2 | 2026-01-04T14:42:35.134676Z | false |
facebookresearch/detectron2 | https://github.com/facebookresearch/detectron2/blob/fd27788985af0f4ca800bca563acdb700bb890e2/projects/PointSup/point_sup/mask_head.py | projects/PointSup/point_sup/mask_head.py | # Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved
import numpy as np
from typing import Any, List
from detectron2.modeling import ROI_MASK_HEAD_REGISTRY
from detectron2.modeling.roi_heads.mask_head import MaskRCNNConvUpsampleHead, mask_rcnn_inference
from detectron2.projects.point_rend import Impl... | python | Apache-2.0 | fd27788985af0f4ca800bca563acdb700bb890e2 | 2026-01-04T14:42:35.134676Z | false |
facebookresearch/detectron2 | https://github.com/facebookresearch/detectron2/blob/fd27788985af0f4ca800bca563acdb700bb890e2/projects/PointSup/point_sup/dataset_mapper.py | projects/PointSup/point_sup/dataset_mapper.py | # Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved
import copy
import logging
import numpy as np
from typing import List, Union
import torch
import detectron2.data.detection_utils as utils
import detectron2.data.transforms as T
from detectron2.config import configurable
from .detection_utils impor... | python | Apache-2.0 | fd27788985af0f4ca800bca563acdb700bb890e2 | 2026-01-04T14:42:35.134676Z | false |
facebookresearch/detectron2 | https://github.com/facebookresearch/detectron2/blob/fd27788985af0f4ca800bca563acdb700bb890e2/projects/PointSup/point_sup/detection_utils.py | projects/PointSup/point_sup/detection_utils.py | # -*- coding: utf-8 -*-
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved
import numpy as np
import torch
# fmt: off
from detectron2.data.detection_utils import \
annotations_to_instances as base_annotations_to_instances
from detectron2.data.detection_utils import \
transform_instance_ann... | python | Apache-2.0 | fd27788985af0f4ca800bca563acdb700bb890e2 | 2026-01-04T14:42:35.134676Z | false |
facebookresearch/detectron2 | https://github.com/facebookresearch/detectron2/blob/fd27788985af0f4ca800bca563acdb700bb890e2/projects/PointSup/point_sup/config.py | projects/PointSup/point_sup/config.py | # -*- coding: utf-8 -*-
# Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved
def add_point_sup_config(cfg):
"""
Add config for point supervision.
"""
# Use point annotation
cfg.INPUT.POINT_SUP = False
# Sample only part of points in each iteration.
# Default: 0, use all a... | python | Apache-2.0 | fd27788985af0f4ca800bca563acdb700bb890e2 | 2026-01-04T14:42:35.134676Z | false |
facebookresearch/detectron2 | https://github.com/facebookresearch/detectron2/blob/fd27788985af0f4ca800bca563acdb700bb890e2/projects/PointSup/point_sup/register_point_annotations.py | projects/PointSup/point_sup/register_point_annotations.py | # Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved
import logging
import os
from detectron2.data import DatasetCatalog, MetadataCatalog
from detectron2.data.datasets.builtin import _get_builtin_metadata
from detectron2.data.datasets.coco import load_coco_json
logger = logging.getLogger(__name__)
... | python | Apache-2.0 | fd27788985af0f4ca800bca563acdb700bb890e2 | 2026-01-04T14:42:35.134676Z | false |
facebookresearch/detectron2 | https://github.com/facebookresearch/detectron2/blob/fd27788985af0f4ca800bca563acdb700bb890e2/projects/PointSup/point_sup/__init__.py | projects/PointSup/point_sup/__init__.py | # Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved
from . import register_point_annotations
from .config import add_point_sup_config
from .dataset_mapper import PointSupDatasetMapper
from .mask_head import MaskRCNNConvUpsamplePointSupHead
from .point_utils import get_point_coords_from_point_annotati... | python | Apache-2.0 | fd27788985af0f4ca800bca563acdb700bb890e2 | 2026-01-04T14:42:35.134676Z | false |
facebookresearch/detectron2 | https://github.com/facebookresearch/detectron2/blob/fd27788985af0f4ca800bca563acdb700bb890e2/projects/MViTv2/configs/cascade_mask_rcnn_mvitv2_b_3x.py | projects/MViTv2/configs/cascade_mask_rcnn_mvitv2_b_3x.py | from .cascade_mask_rcnn_mvitv2_t_3x import model, dataloader, optimizer, lr_multiplier, train
model.backbone.bottom_up.depth = 24
model.backbone.bottom_up.last_block_indexes = (1, 4, 20, 23)
model.backbone.bottom_up.drop_path_rate = 0.4
train.init_checkpoint = "detectron2://ImageNetPretrained/mvitv2/MViTv2_B_in1k.py... | python | Apache-2.0 | fd27788985af0f4ca800bca563acdb700bb890e2 | 2026-01-04T14:42:35.134676Z | false |
facebookresearch/detectron2 | https://github.com/facebookresearch/detectron2/blob/fd27788985af0f4ca800bca563acdb700bb890e2/projects/MViTv2/configs/cascade_mask_rcnn_mvitv2_l_in21k_lsj_50ep.py | projects/MViTv2/configs/cascade_mask_rcnn_mvitv2_l_in21k_lsj_50ep.py | from fvcore.common.param_scheduler import MultiStepParamScheduler
from detectron2.config import LazyCall as L
from detectron2.solver import WarmupParamScheduler
from .cascade_mask_rcnn_mvitv2_b_3x import model, optimizer, train
from .common.coco_loader_lsj import dataloader
model.backbone.bottom_up.embed_dim = 144
... | python | Apache-2.0 | fd27788985af0f4ca800bca563acdb700bb890e2 | 2026-01-04T14:42:35.134676Z | false |
facebookresearch/detectron2 | https://github.com/facebookresearch/detectron2/blob/fd27788985af0f4ca800bca563acdb700bb890e2/projects/MViTv2/configs/cascade_mask_rcnn_mvitv2_t_3x.py | projects/MViTv2/configs/cascade_mask_rcnn_mvitv2_t_3x.py | from detectron2.config import LazyCall as L
from detectron2.layers import ShapeSpec
from detectron2.modeling.box_regression import Box2BoxTransform
from detectron2.modeling.matcher import Matcher
from detectron2.modeling.roi_heads import FastRCNNOutputLayers, FastRCNNConvFCHead, CascadeROIHeads
from detectron2.layers.b... | python | Apache-2.0 | fd27788985af0f4ca800bca563acdb700bb890e2 | 2026-01-04T14:42:35.134676Z | false |
facebookresearch/detectron2 | https://github.com/facebookresearch/detectron2/blob/fd27788985af0f4ca800bca563acdb700bb890e2/projects/MViTv2/configs/cascade_mask_rcnn_mvitv2_h_in21k_lsj_3x.py | projects/MViTv2/configs/cascade_mask_rcnn_mvitv2_h_in21k_lsj_3x.py | from .cascade_mask_rcnn_mvitv2_b_3x import model, optimizer, train, lr_multiplier
from .common.coco_loader_lsj import dataloader
model.backbone.bottom_up.embed_dim = 192
model.backbone.bottom_up.depth = 80
model.backbone.bottom_up.num_heads = 3
model.backbone.bottom_up.last_block_indexes = (3, 11, 71, 79)
model.backb... | python | Apache-2.0 | fd27788985af0f4ca800bca563acdb700bb890e2 | 2026-01-04T14:42:35.134676Z | false |
facebookresearch/detectron2 | https://github.com/facebookresearch/detectron2/blob/fd27788985af0f4ca800bca563acdb700bb890e2/projects/MViTv2/configs/mask_rcnn_mvitv2_t_3x.py | projects/MViTv2/configs/mask_rcnn_mvitv2_t_3x.py | from functools import partial
import torch.nn as nn
from fvcore.common.param_scheduler import MultiStepParamScheduler
from detectron2 import model_zoo
from detectron2.config import LazyCall as L
from detectron2.solver import WarmupParamScheduler
from detectron2.modeling import MViT
from .common.coco_loader import dat... | python | Apache-2.0 | fd27788985af0f4ca800bca563acdb700bb890e2 | 2026-01-04T14:42:35.134676Z | false |
facebookresearch/detectron2 | https://github.com/facebookresearch/detectron2/blob/fd27788985af0f4ca800bca563acdb700bb890e2/projects/MViTv2/configs/cascade_mask_rcnn_mvitv2_s_3x.py | projects/MViTv2/configs/cascade_mask_rcnn_mvitv2_s_3x.py | from .cascade_mask_rcnn_mvitv2_t_3x import model, dataloader, optimizer, lr_multiplier, train
model.backbone.bottom_up.depth = 16
model.backbone.bottom_up.last_block_indexes = (0, 2, 13, 15)
train.init_checkpoint = "detectron2://ImageNetPretrained/mvitv2/MViTv2_S_in1k.pyth"
| python | Apache-2.0 | fd27788985af0f4ca800bca563acdb700bb890e2 | 2026-01-04T14:42:35.134676Z | false |
facebookresearch/detectron2 | https://github.com/facebookresearch/detectron2/blob/fd27788985af0f4ca800bca563acdb700bb890e2/projects/MViTv2/configs/cascade_mask_rcnn_mvitv2_b_in21k_3x.py | projects/MViTv2/configs/cascade_mask_rcnn_mvitv2_b_in21k_3x.py | from .cascade_mask_rcnn_mvitv2_b_3x import model, dataloader, optimizer, lr_multiplier, train
train.init_checkpoint = "detectron2://ImageNetPretrained/mvitv2/MViTv2_B_in21k.pyth"
| python | Apache-2.0 | fd27788985af0f4ca800bca563acdb700bb890e2 | 2026-01-04T14:42:35.134676Z | false |
facebookresearch/detectron2 | https://github.com/facebookresearch/detectron2/blob/fd27788985af0f4ca800bca563acdb700bb890e2/projects/MViTv2/configs/common/coco_loader_lsj.py | projects/MViTv2/configs/common/coco_loader_lsj.py | import detectron2.data.transforms as T
from detectron2 import model_zoo
from detectron2.config import LazyCall as L
from .coco_loader import dataloader
# Data using LSJ
image_size = 1024
dataloader.train.mapper.augmentations = [
L(T.RandomFlip)(horizontal=True), # flip first
L(T.ResizeScale)(
min_sca... | python | Apache-2.0 | fd27788985af0f4ca800bca563acdb700bb890e2 | 2026-01-04T14:42:35.134676Z | false |
facebookresearch/detectron2 | https://github.com/facebookresearch/detectron2/blob/fd27788985af0f4ca800bca563acdb700bb890e2/projects/MViTv2/configs/common/coco_loader.py | projects/MViTv2/configs/common/coco_loader.py | from omegaconf import OmegaConf
import detectron2.data.transforms as T
from detectron2.config import LazyCall as L
from detectron2.data import (
DatasetMapper,
build_detection_test_loader,
build_detection_train_loader,
get_detection_dataset_dicts,
)
from detectron2.evaluation import COCOEvaluator
data... | python | Apache-2.0 | fd27788985af0f4ca800bca563acdb700bb890e2 | 2026-01-04T14:42:35.134676Z | false |
facebookresearch/detectron2 | https://github.com/facebookresearch/detectron2/blob/fd27788985af0f4ca800bca563acdb700bb890e2/projects/DeepLab/train_net.py | projects/DeepLab/train_net.py | #!/usr/bin/env python3
# Copyright (c) Facebook, Inc. and its affiliates.
"""
DeepLab Training Script.
This script is a simplified version of the training script in detectron2/tools.
"""
import os
import detectron2.data.transforms as T
from detectron2.checkpoint import DetectionCheckpointer
from detectron2.config i... | python | Apache-2.0 | fd27788985af0f4ca800bca563acdb700bb890e2 | 2026-01-04T14:42:35.134676Z | false |
facebookresearch/detectron2 | https://github.com/facebookresearch/detectron2/blob/fd27788985af0f4ca800bca563acdb700bb890e2/projects/DeepLab/deeplab/semantic_seg.py | projects/DeepLab/deeplab/semantic_seg.py | # Copyright (c) Facebook, Inc. and its affiliates.
from typing import Callable, Dict, List, Optional, Tuple, Union
import fvcore.nn.weight_init as weight_init
import torch
from torch import nn
from torch.nn import functional as F
from detectron2.config import configurable
from detectron2.layers import ASPP, Conv2d, De... | python | Apache-2.0 | fd27788985af0f4ca800bca563acdb700bb890e2 | 2026-01-04T14:42:35.134676Z | false |
facebookresearch/detectron2 | https://github.com/facebookresearch/detectron2/blob/fd27788985af0f4ca800bca563acdb700bb890e2/projects/DeepLab/deeplab/build_solver.py | projects/DeepLab/deeplab/build_solver.py | # Copyright (c) Facebook, Inc. and its affiliates.
import torch
from detectron2.config import CfgNode
from detectron2.solver import LRScheduler
from detectron2.solver import build_lr_scheduler as build_d2_lr_scheduler
from .lr_scheduler import WarmupPolyLR
def build_lr_scheduler(cfg: CfgNode, optimizer: torch.optim... | python | Apache-2.0 | fd27788985af0f4ca800bca563acdb700bb890e2 | 2026-01-04T14:42:35.134676Z | false |
facebookresearch/detectron2 | https://github.com/facebookresearch/detectron2/blob/fd27788985af0f4ca800bca563acdb700bb890e2/projects/DeepLab/deeplab/resnet.py | projects/DeepLab/deeplab/resnet.py | # Copyright (c) Facebook, Inc. and its affiliates.
import fvcore.nn.weight_init as weight_init
import torch.nn.functional as F
from detectron2.layers import CNNBlockBase, Conv2d, get_norm
from detectron2.modeling import BACKBONE_REGISTRY
from detectron2.modeling.backbone.resnet import (
BasicStem,
BottleneckBl... | python | Apache-2.0 | fd27788985af0f4ca800bca563acdb700bb890e2 | 2026-01-04T14:42:35.134676Z | false |
facebookresearch/detectron2 | https://github.com/facebookresearch/detectron2/blob/fd27788985af0f4ca800bca563acdb700bb890e2/projects/DeepLab/deeplab/config.py | projects/DeepLab/deeplab/config.py | # -*- coding: utf-8 -*-
# Copyright (c) Facebook, Inc. and its affiliates.
def add_deeplab_config(cfg):
"""
Add config for DeepLab.
"""
# We retry random cropping until no single category in semantic segmentation GT occupies more
# than `SINGLE_CATEGORY_MAX_AREA` part of the crop.
cfg.INPUT.CR... | python | Apache-2.0 | fd27788985af0f4ca800bca563acdb700bb890e2 | 2026-01-04T14:42:35.134676Z | false |
facebookresearch/detectron2 | https://github.com/facebookresearch/detectron2/blob/fd27788985af0f4ca800bca563acdb700bb890e2/projects/DeepLab/deeplab/loss.py | projects/DeepLab/deeplab/loss.py | # Copyright (c) Facebook, Inc. and its affiliates.
import torch
import torch.nn as nn
class DeepLabCE(nn.Module):
"""
Hard pixel mining with cross entropy loss, for semantic segmentation.
This is used in TensorFlow DeepLab frameworks.
Paper: DeeperLab: Single-Shot Image Parser
Reference: https://g... | python | Apache-2.0 | fd27788985af0f4ca800bca563acdb700bb890e2 | 2026-01-04T14:42:35.134676Z | false |
facebookresearch/detectron2 | https://github.com/facebookresearch/detectron2/blob/fd27788985af0f4ca800bca563acdb700bb890e2/projects/DeepLab/deeplab/__init__.py | projects/DeepLab/deeplab/__init__.py | # Copyright (c) Facebook, Inc. and its affiliates.
from .build_solver import build_lr_scheduler
from .config import add_deeplab_config
from .resnet import build_resnet_deeplab_backbone
from .semantic_seg import DeepLabV3Head, DeepLabV3PlusHead
| python | Apache-2.0 | fd27788985af0f4ca800bca563acdb700bb890e2 | 2026-01-04T14:42:35.134676Z | false |
facebookresearch/detectron2 | https://github.com/facebookresearch/detectron2/blob/fd27788985af0f4ca800bca563acdb700bb890e2/projects/DeepLab/deeplab/lr_scheduler.py | projects/DeepLab/deeplab/lr_scheduler.py | # Copyright (c) Facebook, Inc. and its affiliates.
import math
from typing import List
import torch
from detectron2.solver.lr_scheduler import LRScheduler, _get_warmup_factor_at_iter
# NOTE: PyTorch's LR scheduler interface uses names that assume the LR changes
# only on epoch boundaries. We typically use iteration b... | python | Apache-2.0 | fd27788985af0f4ca800bca563acdb700bb890e2 | 2026-01-04T14:42:35.134676Z | false |
facebookresearch/detectron2 | https://github.com/facebookresearch/detectron2/blob/fd27788985af0f4ca800bca563acdb700bb890e2/projects/ViTDet/configs/LVIS/cascade_mask_rcnn_swin_b_in21k_50ep.py | projects/ViTDet/configs/LVIS/cascade_mask_rcnn_swin_b_in21k_50ep.py | from detectron2.config.lazy import LazyCall as L
from detectron2.data.detection_utils import get_fed_loss_cls_weights
from detectron2.data.samplers import RepeatFactorTrainingSampler
from detectron2.evaluation.lvis_evaluation import LVISEvaluator
from ..COCO.cascade_mask_rcnn_swin_b_in21k_50ep import (
dataloader,... | python | Apache-2.0 | fd27788985af0f4ca800bca563acdb700bb890e2 | 2026-01-04T14:42:35.134676Z | false |
facebookresearch/detectron2 | https://github.com/facebookresearch/detectron2/blob/fd27788985af0f4ca800bca563acdb700bb890e2/projects/ViTDet/configs/LVIS/cascade_mask_rcnn_mvitv2_b_in21k_100ep.py | projects/ViTDet/configs/LVIS/cascade_mask_rcnn_mvitv2_b_in21k_100ep.py | from functools import partial
import torch.nn as nn
from detectron2.config import LazyCall as L
from detectron2.data.detection_utils import get_fed_loss_cls_weights
from detectron2.data.samplers import RepeatFactorTrainingSampler
from detectron2.evaluation.lvis_evaluation import LVISEvaluator
from ..COCO.cascade_mask... | python | Apache-2.0 | fd27788985af0f4ca800bca563acdb700bb890e2 | 2026-01-04T14:42:35.134676Z | false |
facebookresearch/detectron2 | https://github.com/facebookresearch/detectron2/blob/fd27788985af0f4ca800bca563acdb700bb890e2/projects/ViTDet/configs/LVIS/cascade_mask_rcnn_vitdet_h_100ep.py | projects/ViTDet/configs/LVIS/cascade_mask_rcnn_vitdet_h_100ep.py | from detectron2.config import LazyCall as L
from detectron2.data.detection_utils import get_fed_loss_cls_weights
from detectron2.layers import ShapeSpec
from detectron2.modeling.box_regression import Box2BoxTransform
from detectron2.modeling.matcher import Matcher
from detectron2.modeling.roi_heads import FastRCNNOutpu... | python | Apache-2.0 | fd27788985af0f4ca800bca563acdb700bb890e2 | 2026-01-04T14:42:35.134676Z | false |
facebookresearch/detectron2 | https://github.com/facebookresearch/detectron2/blob/fd27788985af0f4ca800bca563acdb700bb890e2/projects/ViTDet/configs/LVIS/mask_rcnn_vitdet_b_100ep.py | projects/ViTDet/configs/LVIS/mask_rcnn_vitdet_b_100ep.py | from detectron2.config import LazyCall as L
from detectron2.data.samplers import RepeatFactorTrainingSampler
from detectron2.evaluation.lvis_evaluation import LVISEvaluator
from detectron2.data.detection_utils import get_fed_loss_cls_weights
from ..COCO.mask_rcnn_vitdet_b_100ep import (
dataloader,
model,
... | python | Apache-2.0 | fd27788985af0f4ca800bca563acdb700bb890e2 | 2026-01-04T14:42:35.134676Z | false |
facebookresearch/detectron2 | https://github.com/facebookresearch/detectron2/blob/fd27788985af0f4ca800bca563acdb700bb890e2/projects/ViTDet/configs/LVIS/cascade_mask_rcnn_vitdet_l_100ep.py | projects/ViTDet/configs/LVIS/cascade_mask_rcnn_vitdet_l_100ep.py | from detectron2.config import LazyCall as L
from detectron2.data.detection_utils import get_fed_loss_cls_weights
from detectron2.layers import ShapeSpec
from detectron2.modeling.box_regression import Box2BoxTransform
from detectron2.modeling.matcher import Matcher
from detectron2.modeling.roi_heads import FastRCNNOutpu... | python | Apache-2.0 | fd27788985af0f4ca800bca563acdb700bb890e2 | 2026-01-04T14:42:35.134676Z | false |
facebookresearch/detectron2 | https://github.com/facebookresearch/detectron2/blob/fd27788985af0f4ca800bca563acdb700bb890e2/projects/ViTDet/configs/LVIS/cascade_mask_rcnn_swin_l_in21k_50ep.py | projects/ViTDet/configs/LVIS/cascade_mask_rcnn_swin_l_in21k_50ep.py | from .cascade_mask_rcnn_swin_b_in21k_50ep import (
dataloader,
lr_multiplier,
model,
train,
optimizer,
)
model.backbone.bottom_up.embed_dim = 192
model.backbone.bottom_up.num_heads = [6, 12, 24, 48]
train.init_checkpoint = "detectron2://ImageNetPretrained/swin/swin_large_patch4_window7_224_22k.pth... | python | Apache-2.0 | fd27788985af0f4ca800bca563acdb700bb890e2 | 2026-01-04T14:42:35.134676Z | false |
facebookresearch/detectron2 | https://github.com/facebookresearch/detectron2/blob/fd27788985af0f4ca800bca563acdb700bb890e2/projects/ViTDet/configs/LVIS/mask_rcnn_vitdet_l_100ep.py | projects/ViTDet/configs/LVIS/mask_rcnn_vitdet_l_100ep.py | from functools import partial
from detectron2.modeling.backbone.vit import get_vit_lr_decay_rate
from .mask_rcnn_vitdet_b_100ep import (
dataloader,
lr_multiplier,
model,
train,
optimizer,
)
train.init_checkpoint = (
"detectron2://ImageNetPretrained/MAE/mae_pretrain_vit_large.pth?matching_heu... | python | Apache-2.0 | fd27788985af0f4ca800bca563acdb700bb890e2 | 2026-01-04T14:42:35.134676Z | false |
facebookresearch/detectron2 | https://github.com/facebookresearch/detectron2/blob/fd27788985af0f4ca800bca563acdb700bb890e2/projects/ViTDet/configs/LVIS/cascade_mask_rcnn_mvitv2_h_in21k_50ep.py | projects/ViTDet/configs/LVIS/cascade_mask_rcnn_mvitv2_h_in21k_50ep.py | from .cascade_mask_rcnn_mvitv2_b_in21k_100ep import (
dataloader,
lr_multiplier,
model,
train,
optimizer,
)
model.backbone.bottom_up.embed_dim = 192
model.backbone.bottom_up.depth = 80
model.backbone.bottom_up.num_heads = 3
model.backbone.bottom_up.last_block_indexes = (3, 11, 71, 79)
model.backbon... | python | Apache-2.0 | fd27788985af0f4ca800bca563acdb700bb890e2 | 2026-01-04T14:42:35.134676Z | false |
facebookresearch/detectron2 | https://github.com/facebookresearch/detectron2/blob/fd27788985af0f4ca800bca563acdb700bb890e2/projects/ViTDet/configs/LVIS/cascade_mask_rcnn_mvitv2_l_in21k_50ep.py | projects/ViTDet/configs/LVIS/cascade_mask_rcnn_mvitv2_l_in21k_50ep.py | from .cascade_mask_rcnn_mvitv2_b_in21k_100ep import (
dataloader,
lr_multiplier,
model,
train,
optimizer,
)
model.backbone.bottom_up.embed_dim = 144
model.backbone.bottom_up.depth = 48
model.backbone.bottom_up.num_heads = 2
model.backbone.bottom_up.last_block_indexes = (1, 7, 43, 47)
model.backbone... | python | Apache-2.0 | fd27788985af0f4ca800bca563acdb700bb890e2 | 2026-01-04T14:42:35.134676Z | false |
facebookresearch/detectron2 | https://github.com/facebookresearch/detectron2/blob/fd27788985af0f4ca800bca563acdb700bb890e2/projects/ViTDet/configs/LVIS/mask_rcnn_vitdet_h_100ep.py | projects/ViTDet/configs/LVIS/mask_rcnn_vitdet_h_100ep.py | from functools import partial
from detectron2.modeling.backbone.vit import get_vit_lr_decay_rate
from .mask_rcnn_vitdet_b_100ep import (
dataloader,
lr_multiplier,
model,
train,
optimizer,
)
train.init_checkpoint = (
"detectron2://ImageNetPretrained/MAE/mae_pretrain_vit_huge_p14to16.pth?match... | python | Apache-2.0 | fd27788985af0f4ca800bca563acdb700bb890e2 | 2026-01-04T14:42:35.134676Z | false |
facebookresearch/detectron2 | https://github.com/facebookresearch/detectron2/blob/fd27788985af0f4ca800bca563acdb700bb890e2/projects/ViTDet/configs/LVIS/cascade_mask_rcnn_vitdet_b_100ep.py | projects/ViTDet/configs/LVIS/cascade_mask_rcnn_vitdet_b_100ep.py | from detectron2.config import LazyCall as L
from detectron2.data.detection_utils import get_fed_loss_cls_weights
from detectron2.layers import ShapeSpec
from detectron2.modeling.box_regression import Box2BoxTransform
from detectron2.modeling.matcher import Matcher
from detectron2.modeling.roi_heads import FastRCNNOutpu... | python | Apache-2.0 | fd27788985af0f4ca800bca563acdb700bb890e2 | 2026-01-04T14:42:35.134676Z | false |
facebookresearch/detectron2 | https://github.com/facebookresearch/detectron2/blob/fd27788985af0f4ca800bca563acdb700bb890e2/projects/ViTDet/configs/common/coco_loader_lsj.py | projects/ViTDet/configs/common/coco_loader_lsj.py | import detectron2.data.transforms as T
from detectron2 import model_zoo
from detectron2.config import LazyCall as L
# Data using LSJ
image_size = 1024
dataloader = model_zoo.get_config("common/data/coco.py").dataloader
dataloader.train.mapper.augmentations = [
L(T.RandomFlip)(horizontal=True), # flip first
L(... | python | Apache-2.0 | fd27788985af0f4ca800bca563acdb700bb890e2 | 2026-01-04T14:42:35.134676Z | false |
facebookresearch/detectron2 | https://github.com/facebookresearch/detectron2/blob/fd27788985af0f4ca800bca563acdb700bb890e2/projects/ViTDet/configs/COCO/cascade_mask_rcnn_vitdet_h_75ep.py | projects/ViTDet/configs/COCO/cascade_mask_rcnn_vitdet_h_75ep.py | from functools import partial
from .cascade_mask_rcnn_vitdet_b_100ep import (
dataloader,
lr_multiplier,
model,
train,
optimizer,
get_vit_lr_decay_rate,
)
train.init_checkpoint = (
"detectron2://ImageNetPretrained/MAE/mae_pretrain_vit_huge_p14to16.pth?matching_heuristics=True"
)
model.bac... | python | Apache-2.0 | fd27788985af0f4ca800bca563acdb700bb890e2 | 2026-01-04T14:42:35.134676Z | false |
facebookresearch/detectron2 | https://github.com/facebookresearch/detectron2/blob/fd27788985af0f4ca800bca563acdb700bb890e2/projects/ViTDet/configs/COCO/cascade_mask_rcnn_swin_b_in21k_50ep.py | projects/ViTDet/configs/COCO/cascade_mask_rcnn_swin_b_in21k_50ep.py | from fvcore.common.param_scheduler import MultiStepParamScheduler
from detectron2 import model_zoo
from detectron2.config import LazyCall as L
from detectron2.solver import WarmupParamScheduler
from detectron2.modeling import SwinTransformer
from ..common.coco_loader_lsj import dataloader
from .cascade_mask_rcnn_mvit... | python | Apache-2.0 | fd27788985af0f4ca800bca563acdb700bb890e2 | 2026-01-04T14:42:35.134676Z | false |
facebookresearch/detectron2 | https://github.com/facebookresearch/detectron2/blob/fd27788985af0f4ca800bca563acdb700bb890e2/projects/ViTDet/configs/COCO/cascade_mask_rcnn_mvitv2_b_in21k_100ep.py | projects/ViTDet/configs/COCO/cascade_mask_rcnn_mvitv2_b_in21k_100ep.py | from functools import partial
import torch.nn as nn
from fvcore.common.param_scheduler import MultiStepParamScheduler
from detectron2 import model_zoo
from detectron2.config import LazyCall as L
from detectron2.solver import WarmupParamScheduler
from detectron2.modeling import MViT
from detectron2.layers import ShapeS... | python | Apache-2.0 | fd27788985af0f4ca800bca563acdb700bb890e2 | 2026-01-04T14:42:35.134676Z | false |
facebookresearch/detectron2 | https://github.com/facebookresearch/detectron2/blob/fd27788985af0f4ca800bca563acdb700bb890e2/projects/ViTDet/configs/COCO/cascade_mask_rcnn_mvitv2_h_in21k_36ep.py | projects/ViTDet/configs/COCO/cascade_mask_rcnn_mvitv2_h_in21k_36ep.py | from fvcore.common.param_scheduler import MultiStepParamScheduler
from detectron2.config import LazyCall as L
from detectron2.solver import WarmupParamScheduler
from .cascade_mask_rcnn_mvitv2_b_in21k_100ep import (
dataloader,
lr_multiplier,
model,
train,
optimizer,
)
model.backbone.bottom_up.emb... | python | Apache-2.0 | fd27788985af0f4ca800bca563acdb700bb890e2 | 2026-01-04T14:42:35.134676Z | false |
facebookresearch/detectron2 | https://github.com/facebookresearch/detectron2/blob/fd27788985af0f4ca800bca563acdb700bb890e2/projects/ViTDet/configs/COCO/mask_rcnn_vitdet_b_100ep.py | projects/ViTDet/configs/COCO/mask_rcnn_vitdet_b_100ep.py | from functools import partial
from fvcore.common.param_scheduler import MultiStepParamScheduler
from detectron2 import model_zoo
from detectron2.config import LazyCall as L
from detectron2.solver import WarmupParamScheduler
from detectron2.modeling.backbone.vit import get_vit_lr_decay_rate
from ..common.coco_loader_l... | python | Apache-2.0 | fd27788985af0f4ca800bca563acdb700bb890e2 | 2026-01-04T14:42:35.134676Z | false |
facebookresearch/detectron2 | https://github.com/facebookresearch/detectron2/blob/fd27788985af0f4ca800bca563acdb700bb890e2/projects/ViTDet/configs/COCO/cascade_mask_rcnn_vitdet_l_100ep.py | projects/ViTDet/configs/COCO/cascade_mask_rcnn_vitdet_l_100ep.py | from functools import partial
from .cascade_mask_rcnn_vitdet_b_100ep import (
dataloader,
lr_multiplier,
model,
train,
optimizer,
get_vit_lr_decay_rate,
)
train.init_checkpoint = (
"detectron2://ImageNetPretrained/MAE/mae_pretrain_vit_large.pth?matching_heuristics=True"
)
model.backbone.n... | python | Apache-2.0 | fd27788985af0f4ca800bca563acdb700bb890e2 | 2026-01-04T14:42:35.134676Z | false |
facebookresearch/detectron2 | https://github.com/facebookresearch/detectron2/blob/fd27788985af0f4ca800bca563acdb700bb890e2/projects/ViTDet/configs/COCO/mask_rcnn_vitdet_h_75ep.py | projects/ViTDet/configs/COCO/mask_rcnn_vitdet_h_75ep.py | from functools import partial
from .mask_rcnn_vitdet_b_100ep import (
dataloader,
lr_multiplier,
model,
train,
optimizer,
get_vit_lr_decay_rate,
)
train.init_checkpoint = (
"detectron2://ImageNetPretrained/MAE/mae_pretrain_vit_huge_p14to16.pth?matching_heuristics=True"
)
model.backbone.ne... | python | Apache-2.0 | fd27788985af0f4ca800bca563acdb700bb890e2 | 2026-01-04T14:42:35.134676Z | false |
facebookresearch/detectron2 | https://github.com/facebookresearch/detectron2/blob/fd27788985af0f4ca800bca563acdb700bb890e2/projects/ViTDet/configs/COCO/cascade_mask_rcnn_swin_l_in21k_50ep.py | projects/ViTDet/configs/COCO/cascade_mask_rcnn_swin_l_in21k_50ep.py | from .cascade_mask_rcnn_swin_b_in21k_50ep import (
dataloader,
lr_multiplier,
model,
train,
optimizer,
)
model.backbone.bottom_up.depths = [2, 2, 18, 2]
model.backbone.bottom_up.drop_path_rate = 0.4
model.backbone.bottom_up.embed_dim = 192
model.backbone.bottom_up.num_heads = [6, 12, 24, 48]
trai... | python | Apache-2.0 | fd27788985af0f4ca800bca563acdb700bb890e2 | 2026-01-04T14:42:35.134676Z | false |
facebookresearch/detectron2 | https://github.com/facebookresearch/detectron2/blob/fd27788985af0f4ca800bca563acdb700bb890e2/projects/ViTDet/configs/COCO/mask_rcnn_vitdet_l_100ep.py | projects/ViTDet/configs/COCO/mask_rcnn_vitdet_l_100ep.py | from functools import partial
from .mask_rcnn_vitdet_b_100ep import (
dataloader,
lr_multiplier,
model,
train,
optimizer,
get_vit_lr_decay_rate,
)
train.init_checkpoint = (
"detectron2://ImageNetPretrained/MAE/mae_pretrain_vit_large.pth?matching_heuristics=True"
)
model.backbone.net.embed... | python | Apache-2.0 | fd27788985af0f4ca800bca563acdb700bb890e2 | 2026-01-04T14:42:35.134676Z | false |
facebookresearch/detectron2 | https://github.com/facebookresearch/detectron2/blob/fd27788985af0f4ca800bca563acdb700bb890e2/projects/ViTDet/configs/COCO/cascade_mask_rcnn_mvitv2_l_in21k_50ep.py | projects/ViTDet/configs/COCO/cascade_mask_rcnn_mvitv2_l_in21k_50ep.py | from .cascade_mask_rcnn_mvitv2_b_in21k_100ep import (
dataloader,
lr_multiplier,
model,
train,
optimizer,
)
model.backbone.bottom_up.embed_dim = 144
model.backbone.bottom_up.depth = 48
model.backbone.bottom_up.num_heads = 2
model.backbone.bottom_up.last_block_indexes = (1, 7, 43, 47)
model.backbone... | python | Apache-2.0 | fd27788985af0f4ca800bca563acdb700bb890e2 | 2026-01-04T14:42:35.134676Z | false |
facebookresearch/detectron2 | https://github.com/facebookresearch/detectron2/blob/fd27788985af0f4ca800bca563acdb700bb890e2/projects/ViTDet/configs/COCO/cascade_mask_rcnn_vitdet_b_100ep.py | projects/ViTDet/configs/COCO/cascade_mask_rcnn_vitdet_b_100ep.py | from detectron2.config import LazyCall as L
from detectron2.layers import ShapeSpec
from detectron2.modeling.box_regression import Box2BoxTransform
from detectron2.modeling.matcher import Matcher
from detectron2.modeling.roi_heads import (
FastRCNNOutputLayers,
FastRCNNConvFCHead,
CascadeROIHeads,
)
from .... | python | Apache-2.0 | fd27788985af0f4ca800bca563acdb700bb890e2 | 2026-01-04T14:42:35.134676Z | false |
facebookresearch/detectron2 | https://github.com/facebookresearch/detectron2/blob/fd27788985af0f4ca800bca563acdb700bb890e2/projects/Rethinking-BatchNorm/retinanet-eval-domain-specific.py | projects/Rethinking-BatchNorm/retinanet-eval-domain-specific.py | #!/usr/bin/env python
# Copyright (c) Facebook, Inc. and its affiliates.
import sys
import torch
from fvcore.nn.precise_bn import update_bn_stats
from detectron2.checkpoint import DetectionCheckpointer
from detectron2.config import LazyConfig, instantiate
from detectron2.evaluation import inference_on_dataset
from det... | python | Apache-2.0 | fd27788985af0f4ca800bca563acdb700bb890e2 | 2026-01-04T14:42:35.134676Z | false |
facebookresearch/detectron2 | https://github.com/facebookresearch/detectron2/blob/fd27788985af0f4ca800bca563acdb700bb890e2/projects/Rethinking-BatchNorm/configs/mask_rcnn_BNhead_shuffle.py | projects/Rethinking-BatchNorm/configs/mask_rcnn_BNhead_shuffle.py | import math
import torch
import torch.distributed as dist
from detectron2.modeling.roi_heads import FastRCNNConvFCHead, MaskRCNNConvUpsampleHead
from detectron2.utils import comm
from fvcore.nn.distributed import differentiable_all_gather
def concat_all_gather(input):
bs_int = input.shape[0]
size_list = comm... | python | Apache-2.0 | fd27788985af0f4ca800bca563acdb700bb890e2 | 2026-01-04T14:42:35.134676Z | false |
facebookresearch/detectron2 | https://github.com/facebookresearch/detectron2/blob/fd27788985af0f4ca800bca563acdb700bb890e2/projects/Rethinking-BatchNorm/configs/mask_rcnn_BNhead.py | projects/Rethinking-BatchNorm/configs/mask_rcnn_BNhead.py | from detectron2.model_zoo import get_config
model = get_config("common/models/mask_rcnn_fpn.py").model
model.backbone.bottom_up.freeze_at = 2
model.roi_heads.box_head.conv_norm = model.roi_heads.mask_head.conv_norm = "BN"
# 4conv1fc head
model.roi_heads.box_head.conv_dims = [256, 256, 256, 256]
model.roi_heads.box_h... | python | Apache-2.0 | fd27788985af0f4ca800bca563acdb700bb890e2 | 2026-01-04T14:42:35.134676Z | false |
facebookresearch/detectron2 | https://github.com/facebookresearch/detectron2/blob/fd27788985af0f4ca800bca563acdb700bb890e2/projects/Rethinking-BatchNorm/configs/mask_rcnn_SyncBNhead.py | projects/Rethinking-BatchNorm/configs/mask_rcnn_SyncBNhead.py | from .mask_rcnn_BNhead import model, dataloader, lr_multiplier, optimizer, train
model.roi_heads.box_head.conv_norm = model.roi_heads.mask_head.conv_norm = "SyncBN"
| python | Apache-2.0 | fd27788985af0f4ca800bca563acdb700bb890e2 | 2026-01-04T14:42:35.134676Z | false |
facebookresearch/detectron2 | https://github.com/facebookresearch/detectron2/blob/fd27788985af0f4ca800bca563acdb700bb890e2/projects/Rethinking-BatchNorm/configs/mask_rcnn_BNhead_batch_stats.py | projects/Rethinking-BatchNorm/configs/mask_rcnn_BNhead_batch_stats.py | from torch.nn import BatchNorm2d
from torch.nn import functional as F
class BatchNormBatchStat(BatchNorm2d):
"""
BN that uses batch stat in inference
"""
def forward(self, input):
if self.training:
return super().forward(input)
return F.batch_norm(input, None, None, self.w... | python | Apache-2.0 | fd27788985af0f4ca800bca563acdb700bb890e2 | 2026-01-04T14:42:35.134676Z | false |
facebookresearch/detectron2 | https://github.com/facebookresearch/detectron2/blob/fd27788985af0f4ca800bca563acdb700bb890e2/projects/Rethinking-BatchNorm/configs/retinanet_SyncBNhead.py | projects/Rethinking-BatchNorm/configs/retinanet_SyncBNhead.py | from detectron2.model_zoo import get_config
from torch import nn
model = get_config("common/models/retinanet.py").model
model.backbone.bottom_up.freeze_at = 2
# The head will overwrite string "SyncBN" to use domain-specific BN, so we
# provide a class here to use shared BN in training.
model.head.norm = nn.SyncBatchN... | python | Apache-2.0 | fd27788985af0f4ca800bca563acdb700bb890e2 | 2026-01-04T14:42:35.134676Z | false |
facebookresearch/detectron2 | https://github.com/facebookresearch/detectron2/blob/fd27788985af0f4ca800bca563acdb700bb890e2/projects/Rethinking-BatchNorm/configs/retinanet_SyncBNhead_SharedTraining.py | projects/Rethinking-BatchNorm/configs/retinanet_SyncBNhead_SharedTraining.py | from typing import List
import torch
from torch import Tensor, nn
from detectron2.modeling.meta_arch.retinanet import RetinaNetHead
def apply_sequential(inputs, modules):
for mod in modules:
if isinstance(mod, (nn.BatchNorm2d, nn.SyncBatchNorm)):
# for BN layer, normalize all inputs together
... | python | Apache-2.0 | fd27788985af0f4ca800bca563acdb700bb890e2 | 2026-01-04T14:42:35.134676Z | false |
facebookresearch/detectron2 | https://github.com/facebookresearch/detectron2/blob/fd27788985af0f4ca800bca563acdb700bb890e2/demo/predictor.py | demo/predictor.py | # Copyright (c) Facebook, Inc. and its affiliates.
import atexit
import bisect
import multiprocessing as mp
from collections import deque
import cv2
import torch
from detectron2.data import MetadataCatalog
from detectron2.engine.defaults import DefaultPredictor
from detectron2.utils.video_visualizer import VideoVisual... | python | Apache-2.0 | fd27788985af0f4ca800bca563acdb700bb890e2 | 2026-01-04T14:42:35.134676Z | false |
facebookresearch/detectron2 | https://github.com/facebookresearch/detectron2/blob/fd27788985af0f4ca800bca563acdb700bb890e2/demo/demo.py | demo/demo.py | # Copyright (c) Facebook, Inc. and its affiliates.
import argparse
import glob
import multiprocessing as mp
import numpy as np
import os
import tempfile
import time
import warnings
import cv2
import tqdm
from detectron2.config import get_cfg
from detectron2.data.detection_utils import read_image
from detectron2.utils.... | python | Apache-2.0 | fd27788985af0f4ca800bca563acdb700bb890e2 | 2026-01-04T14:42:35.134676Z | false |
fxsjy/jieba | https://github.com/fxsjy/jieba/blob/67fa2e36e72f69d9134b8a1037b83fbb070b9775/setup.py | setup.py | # -*- coding: utf-8 -*-
from distutils.core import setup
LONGDOC = """
jieba
=====
“结巴”中文分词:做最好的 Python 中文分词组件
"Jieba" (Chinese for "to stutter") Chinese text segmentation: built to
be the best Python Chinese word segmentation module.
完整文档见 ``README.md``
GitHub: https://github.com/fxsjy/jieba
特点
====
- 支持三种分词模式:... | python | MIT | 67fa2e36e72f69d9134b8a1037b83fbb070b9775 | 2026-01-04T14:42:18.089587Z | false |
fxsjy/jieba | https://github.com/fxsjy/jieba/blob/67fa2e36e72f69d9134b8a1037b83fbb070b9775/jieba/_compat.py | jieba/_compat.py | # -*- coding: utf-8 -*-
import logging
import os
import sys
log_console = logging.StreamHandler(sys.stderr)
default_logger = logging.getLogger(__name__)
default_logger.setLevel(logging.DEBUG)
def setLogLevel(log_level):
default_logger.setLevel(log_level)
check_paddle_install = {'is_paddle_installed': False}
t... | python | MIT | 67fa2e36e72f69d9134b8a1037b83fbb070b9775 | 2026-01-04T14:42:18.089587Z | false |
fxsjy/jieba | https://github.com/fxsjy/jieba/blob/67fa2e36e72f69d9134b8a1037b83fbb070b9775/jieba/__main__.py | jieba/__main__.py | """Jieba command line interface."""
import sys
import jieba
from argparse import ArgumentParser
from ._compat import *
parser = ArgumentParser(usage="%s -m jieba [options] filename" % sys.executable, description="Jieba command line interface.", epilog="If no filename specified, use STDIN instead.")
parser.add_argument... | python | MIT | 67fa2e36e72f69d9134b8a1037b83fbb070b9775 | 2026-01-04T14:42:18.089587Z | false |
fxsjy/jieba | https://github.com/fxsjy/jieba/blob/67fa2e36e72f69d9134b8a1037b83fbb070b9775/jieba/__init__.py | jieba/__init__.py | from __future__ import absolute_import, unicode_literals
__version__ = '0.42.1'
__license__ = 'MIT'
import marshal
import re
import tempfile
import threading
import time
from hashlib import md5
from math import log
from . import finalseg
from ._compat import *
if os.name == 'nt':
from shutil import move as _rep... | python | MIT | 67fa2e36e72f69d9134b8a1037b83fbb070b9775 | 2026-01-04T14:42:18.089587Z | false |
fxsjy/jieba | https://github.com/fxsjy/jieba/blob/67fa2e36e72f69d9134b8a1037b83fbb070b9775/jieba/lac_small/creator.py | jieba/lac_small/creator.py | # -*- coding: UTF-8 -*-
# Copyright (c) 2019 PaddlePaddle Authors. All Rights Reserved.
#
# 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 | MIT | 67fa2e36e72f69d9134b8a1037b83fbb070b9775 | 2026-01-04T14:42:18.089587Z | false |
fxsjy/jieba | https://github.com/fxsjy/jieba/blob/67fa2e36e72f69d9134b8a1037b83fbb070b9775/jieba/lac_small/reader_small.py | jieba/lac_small/reader_small.py | # Copyright (c) 2019 PaddlePaddle Authors. All Rights Reserved.
#
# 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 app... | python | MIT | 67fa2e36e72f69d9134b8a1037b83fbb070b9775 | 2026-01-04T14:42:18.089587Z | false |
fxsjy/jieba | https://github.com/fxsjy/jieba/blob/67fa2e36e72f69d9134b8a1037b83fbb070b9775/jieba/lac_small/utils.py | jieba/lac_small/utils.py | # Copyright (c) 2019 PaddlePaddle Authors. All Rights Reserved.
#
# 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 app... | python | MIT | 67fa2e36e72f69d9134b8a1037b83fbb070b9775 | 2026-01-04T14:42:18.089587Z | false |
fxsjy/jieba | https://github.com/fxsjy/jieba/blob/67fa2e36e72f69d9134b8a1037b83fbb070b9775/jieba/lac_small/nets.py | jieba/lac_small/nets.py | # Copyright (c) 2019 PaddlePaddle Authors. All Rights Reserved.
#
# 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 app... | python | MIT | 67fa2e36e72f69d9134b8a1037b83fbb070b9775 | 2026-01-04T14:42:18.089587Z | false |
fxsjy/jieba | https://github.com/fxsjy/jieba/blob/67fa2e36e72f69d9134b8a1037b83fbb070b9775/jieba/lac_small/__init__.py | jieba/lac_small/__init__.py | python | MIT | 67fa2e36e72f69d9134b8a1037b83fbb070b9775 | 2026-01-04T14:42:18.089587Z | false | |
fxsjy/jieba | https://github.com/fxsjy/jieba/blob/67fa2e36e72f69d9134b8a1037b83fbb070b9775/jieba/lac_small/predict.py | jieba/lac_small/predict.py | # -*- coding: UTF-8 -*-
# Copyright (c) 2019 PaddlePaddle Authors. All Rights Reserved.
#
# 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 | MIT | 67fa2e36e72f69d9134b8a1037b83fbb070b9775 | 2026-01-04T14:42:18.089587Z | false |
fxsjy/jieba | https://github.com/fxsjy/jieba/blob/67fa2e36e72f69d9134b8a1037b83fbb070b9775/jieba/analyse/textrank.py | jieba/analyse/textrank.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import absolute_import, unicode_literals
import sys
from operator import itemgetter
from collections import defaultdict
import jieba.posseg
from .tfidf import KeywordExtractor
from .._compat import *
class UndirectWeightedGraph:
d = 0.85
def __in... | python | MIT | 67fa2e36e72f69d9134b8a1037b83fbb070b9775 | 2026-01-04T14:42:18.089587Z | false |
fxsjy/jieba | https://github.com/fxsjy/jieba/blob/67fa2e36e72f69d9134b8a1037b83fbb070b9775/jieba/analyse/tfidf.py | jieba/analyse/tfidf.py | # encoding=utf-8
from __future__ import absolute_import
import os
import jieba
import jieba.posseg
from operator import itemgetter
_get_module_path = lambda path: os.path.normpath(os.path.join(os.getcwd(),
os.path.dirname(__file__), path))
_get_abs_path = jieba._get_abs... | python | MIT | 67fa2e36e72f69d9134b8a1037b83fbb070b9775 | 2026-01-04T14:42:18.089587Z | false |
fxsjy/jieba | https://github.com/fxsjy/jieba/blob/67fa2e36e72f69d9134b8a1037b83fbb070b9775/jieba/analyse/analyzer.py | jieba/analyse/analyzer.py | # encoding=utf-8
from __future__ import unicode_literals
from whoosh.analysis import RegexAnalyzer, LowercaseFilter, StopFilter, StemFilter
from whoosh.analysis import Tokenizer, Token
from whoosh.lang.porter import stem
import jieba
import re
STOP_WORDS = frozenset(('a', 'an', 'and', 'are', 'as', 'at', 'be', 'by', '... | python | MIT | 67fa2e36e72f69d9134b8a1037b83fbb070b9775 | 2026-01-04T14:42:18.089587Z | false |
fxsjy/jieba | https://github.com/fxsjy/jieba/blob/67fa2e36e72f69d9134b8a1037b83fbb070b9775/jieba/analyse/__init__.py | jieba/analyse/__init__.py | from __future__ import absolute_import
from .tfidf import TFIDF
from .textrank import TextRank
try:
from .analyzer import ChineseAnalyzer
except ImportError:
pass
default_tfidf = TFIDF()
default_textrank = TextRank()
extract_tags = tfidf = default_tfidf.extract_tags
set_idf_path = default_tfidf.set_idf_path
t... | python | MIT | 67fa2e36e72f69d9134b8a1037b83fbb070b9775 | 2026-01-04T14:42:18.089587Z | false |
fxsjy/jieba | https://github.com/fxsjy/jieba/blob/67fa2e36e72f69d9134b8a1037b83fbb070b9775/jieba/finalseg/prob_start.py | jieba/finalseg/prob_start.py | P={'B': -0.26268660809250016,
'E': -3.14e+100,
'M': -3.14e+100,
'S': -1.4652633398537678}
| python | MIT | 67fa2e36e72f69d9134b8a1037b83fbb070b9775 | 2026-01-04T14:42:18.089587Z | false |
fxsjy/jieba | https://github.com/fxsjy/jieba/blob/67fa2e36e72f69d9134b8a1037b83fbb070b9775/jieba/finalseg/prob_trans.py | jieba/finalseg/prob_trans.py | P={'B': {'E': -0.510825623765990, 'M': -0.916290731874155},
'E': {'B': -0.5897149736854513, 'S': -0.8085250474669937},
'M': {'E': -0.33344856811948514, 'M': -1.2603623820268226},
'S': {'B': -0.7211965654669841, 'S': -0.6658631448798212}}
| python | MIT | 67fa2e36e72f69d9134b8a1037b83fbb070b9775 | 2026-01-04T14:42:18.089587Z | false |
fxsjy/jieba | https://github.com/fxsjy/jieba/blob/67fa2e36e72f69d9134b8a1037b83fbb070b9775/jieba/finalseg/__init__.py | jieba/finalseg/__init__.py | from __future__ import absolute_import, unicode_literals
import re
import os
import sys
import pickle
from .._compat import *
MIN_FLOAT = -3.14e100
PROB_START_P = "prob_start.p"
PROB_TRANS_P = "prob_trans.p"
PROB_EMIT_P = "prob_emit.p"
PrevStatus = {
'B': 'ES',
'M': 'MB',
'S': 'SE',
'E': 'BM'
}
For... | python | MIT | 67fa2e36e72f69d9134b8a1037b83fbb070b9775 | 2026-01-04T14:42:18.089587Z | false |
fxsjy/jieba | https://github.com/fxsjy/jieba/blob/67fa2e36e72f69d9134b8a1037b83fbb070b9775/jieba/finalseg/prob_emit.py | jieba/finalseg/prob_emit.py | from __future__ import unicode_literals
P={'B': {'\u4e00': -3.6544978750449433,
'\u4e01': -8.125041941842026,
'\u4e03': -7.817392401429855,
'\u4e07': -6.3096425804013165,
'\u4e08': -8.866689067453933,
'\u4e09': -5.932085850549891,
'\u4e0a': -5.739552583325728,
'\u4e0b':... | python | MIT | 67fa2e36e72f69d9134b8a1037b83fbb070b9775 | 2026-01-04T14:42:18.089587Z | true |
fxsjy/jieba | https://github.com/fxsjy/jieba/blob/67fa2e36e72f69d9134b8a1037b83fbb070b9775/jieba/posseg/prob_start.py | jieba/posseg/prob_start.py | P={('B', 'a'): -4.762305214596967,
('B', 'ad'): -6.680066036784177,
('B', 'ag'): -3.14e+100,
('B', 'an'): -8.697083223018778,
('B', 'b'): -5.018374362109218,
('B', 'bg'): -3.14e+100,
('B', 'c'): -3.423880184954888,
('B', 'd'): -3.9750475297585357,
('B', 'df'): -8.888974230828882,
('B', 'dg'): -3.14e+100,
('B'... | python | MIT | 67fa2e36e72f69d9134b8a1037b83fbb070b9775 | 2026-01-04T14:42:18.089587Z | false |
fxsjy/jieba | https://github.com/fxsjy/jieba/blob/67fa2e36e72f69d9134b8a1037b83fbb070b9775/jieba/posseg/viterbi.py | jieba/posseg/viterbi.py | import sys
import operator
MIN_FLOAT = -3.14e100
MIN_INF = float("-inf")
if sys.version_info[0] > 2:
xrange = range
def get_top_states(t_state_v, K=4):
return sorted(t_state_v, key=t_state_v.__getitem__, reverse=True)[:K]
def viterbi(obs, states, start_p, trans_p, emit_p):
V = [{}] # tabular
mem_p... | python | MIT | 67fa2e36e72f69d9134b8a1037b83fbb070b9775 | 2026-01-04T14:42:18.089587Z | false |
fxsjy/jieba | https://github.com/fxsjy/jieba/blob/67fa2e36e72f69d9134b8a1037b83fbb070b9775/jieba/posseg/prob_trans.py | jieba/posseg/prob_trans.py | P={('B', 'a'): {('E', 'a'): -0.0050648453069648755,
('M', 'a'): -5.287963037107507},
('B', 'ad'): {('E', 'ad'): -0.0007479013978476627,
('M', 'ad'): -7.198613337130562},
('B', 'ag'): {},
('B', 'an'): {('E', 'an'): 0.0},
('B', 'b'): {('E', 'b'): -0.06753917715798491,
('M', ... | python | MIT | 67fa2e36e72f69d9134b8a1037b83fbb070b9775 | 2026-01-04T14:42:18.089587Z | true |
fxsjy/jieba | https://github.com/fxsjy/jieba/blob/67fa2e36e72f69d9134b8a1037b83fbb070b9775/jieba/posseg/__init__.py | jieba/posseg/__init__.py | from __future__ import absolute_import, unicode_literals
import pickle
import re
import jieba
from .viterbi import viterbi
from .._compat import *
PROB_START_P = "prob_start.p"
PROB_TRANS_P = "prob_trans.p"
PROB_EMIT_P = "prob_emit.p"
CHAR_STATE_TAB_P = "char_state_tab.p"
re_han_detail = re.compile("([\u4E00-\u9FD5... | python | MIT | 67fa2e36e72f69d9134b8a1037b83fbb070b9775 | 2026-01-04T14:42:18.089587Z | false |
fxsjy/jieba | https://github.com/fxsjy/jieba/blob/67fa2e36e72f69d9134b8a1037b83fbb070b9775/jieba/posseg/prob_emit.py | jieba/posseg/prob_emit.py | from __future__ import unicode_literals
P={('B', 'a'): {'\u4e00': -3.618715666782108,
'\u4e07': -10.500566885381515,
'\u4e0a': -8.541143017159477,
'\u4e0b': -8.445222895280738,
'\u4e0d': -2.7990867583580403,
'\u4e11': -7.837979058356061,
... | python | MIT | 67fa2e36e72f69d9134b8a1037b83fbb070b9775 | 2026-01-04T14:42:18.089587Z | true |
fxsjy/jieba | https://github.com/fxsjy/jieba/blob/67fa2e36e72f69d9134b8a1037b83fbb070b9775/jieba/posseg/char_state_tab.py | jieba/posseg/char_state_tab.py | from __future__ import unicode_literals
P={'\u4e00': (('B', 'm'),
('S', 'm'),
('B', 'd'),
('B', 'a'),
('M', 'm'),
('B', 'n'),
('B', 'u'),
('E', 'r'),
('E', 'm'),
('M', 'd'),
('B', 's'),
... | python | MIT | 67fa2e36e72f69d9134b8a1037b83fbb070b9775 | 2026-01-04T14:42:18.089587Z | true |
fxsjy/jieba | https://github.com/fxsjy/jieba/blob/67fa2e36e72f69d9134b8a1037b83fbb070b9775/test/test_userdict.py | test/test_userdict.py | #encoding=utf-8
from __future__ import print_function, unicode_literals
import sys
sys.path.append("../")
import jieba
jieba.load_userdict("userdict.txt")
import jieba.posseg as pseg
jieba.add_word('石墨烯')
jieba.add_word('凱特琳')
jieba.del_word('自定义词')
test_sent = (
"李小福是创新办主任也是云计算方面的专家; 什么是八一双鹿\n"
"例如我输入一个带“韩玉赏鉴”的标题,在自... | python | MIT | 67fa2e36e72f69d9134b8a1037b83fbb070b9775 | 2026-01-04T14:42:18.089587Z | false |
fxsjy/jieba | https://github.com/fxsjy/jieba/blob/67fa2e36e72f69d9134b8a1037b83fbb070b9775/test/extract_tags_with_weight.py | test/extract_tags_with_weight.py | import sys
sys.path.append('../')
import jieba
import jieba.analyse
from optparse import OptionParser
USAGE = "usage: python extract_tags_with_weight.py [file name] -k [top k] -w [with weight=1 or 0]"
parser = OptionParser(USAGE)
parser.add_option("-k", dest="topK")
parser.add_option("-w", dest="withWeight")
opt,... | python | MIT | 67fa2e36e72f69d9134b8a1037b83fbb070b9775 | 2026-01-04T14:42:18.089587Z | false |
fxsjy/jieba | https://github.com/fxsjy/jieba/blob/67fa2e36e72f69d9134b8a1037b83fbb070b9775/test/test_paddle.py | test/test_paddle.py | #encoding=utf-8
import sys
sys.path.append("../")
import jieba
jieba.enable_paddle()
def cuttest(test_sent):
result = jieba.cut(test_sent, use_paddle=True)
print(" / ".join(result))
if __name__ == "__main__":
cuttest("这是一个伸手不见五指的黑夜。我叫孙悟空,我爱北京,我爱Python和C++。")
cuttest("我不喜欢日本和服。")
cuttest("雷猴回归人间。"... | python | MIT | 67fa2e36e72f69d9134b8a1037b83fbb070b9775 | 2026-01-04T14:42:18.089587Z | false |
fxsjy/jieba | https://github.com/fxsjy/jieba/blob/67fa2e36e72f69d9134b8a1037b83fbb070b9775/test/test_file.py | test/test_file.py | import time
import sys
sys.path.append("../")
import jieba
jieba.initialize()
url = sys.argv[1]
content = open(url,"rb").read()
t1 = time.time()
words = "/ ".join(jieba.cut(content))
t2 = time.time()
tm_cost = t2-t1
log_f = open("1.log","wb")
log_f.write(words.encode('utf-8'))
log_f.close()
print('cost ' + str(tm_c... | python | MIT | 67fa2e36e72f69d9134b8a1037b83fbb070b9775 | 2026-01-04T14:42:18.089587Z | false |
fxsjy/jieba | https://github.com/fxsjy/jieba/blob/67fa2e36e72f69d9134b8a1037b83fbb070b9775/test/test_pos.py | test/test_pos.py | #encoding=utf-8
from __future__ import print_function
import sys
sys.path.append("../")
import jieba.posseg as pseg
def cuttest(test_sent):
result = pseg.cut(test_sent)
for word, flag in result:
print(word, "/", flag, ", ", end=' ')
print("")
if __name__ == "__main__":
cuttest("这是一个伸手不见五指的黑夜。... | python | MIT | 67fa2e36e72f69d9134b8a1037b83fbb070b9775 | 2026-01-04T14:42:18.089587Z | false |
fxsjy/jieba | https://github.com/fxsjy/jieba/blob/67fa2e36e72f69d9134b8a1037b83fbb070b9775/test/test_bug.py | test/test_bug.py | #encoding=utf-8
from __future__ import print_function
import sys
sys.path.append("../")
import jieba
import jieba.posseg as pseg
words=pseg.cut("又跛又啞")
for w in words:
print(w.word,w.flag)
| python | MIT | 67fa2e36e72f69d9134b8a1037b83fbb070b9775 | 2026-01-04T14:42:18.089587Z | false |
fxsjy/jieba | https://github.com/fxsjy/jieba/blob/67fa2e36e72f69d9134b8a1037b83fbb070b9775/test/extract_tags_idfpath.py | test/extract_tags_idfpath.py | import sys
sys.path.append('../')
import jieba
import jieba.analyse
from optparse import OptionParser
USAGE = "usage: python extract_tags_idfpath.py [file name] -k [top k]"
parser = OptionParser(USAGE)
parser.add_option("-k", dest="topK")
opt, args = parser.parse_args()
if len(args) < 1:
print(USAGE)
sy... | python | MIT | 67fa2e36e72f69d9134b8a1037b83fbb070b9775 | 2026-01-04T14:42:18.089587Z | false |
fxsjy/jieba | https://github.com/fxsjy/jieba/blob/67fa2e36e72f69d9134b8a1037b83fbb070b9775/test/test_pos_file.py | test/test_pos_file.py | from __future__ import print_function
import sys
import time
sys.path.append("../")
import jieba
jieba.initialize()
import jieba.posseg as pseg
url = sys.argv[1]
content = open(url,"rb").read()
t1 = time.time()
words = list(pseg.cut(content))
t2 = time.time()
tm_cost = t2-t1
log_f = open("1.log","w")
log_f.write(' /... | python | MIT | 67fa2e36e72f69d9134b8a1037b83fbb070b9775 | 2026-01-04T14:42:18.089587Z | false |
fxsjy/jieba | https://github.com/fxsjy/jieba/blob/67fa2e36e72f69d9134b8a1037b83fbb070b9775/test/test_tokenize.py | test/test_tokenize.py | #encoding=utf-8
from __future__ import print_function,unicode_literals
import sys
sys.path.append("../")
import jieba
g_mode="default"
def cuttest(test_sent):
global g_mode
result = jieba.tokenize(test_sent,mode=g_mode)
for tk in result:
print("word %s\t\t start: %d \t\t end:%d" % (tk[0],tk[1],tk[... | python | MIT | 67fa2e36e72f69d9134b8a1037b83fbb070b9775 | 2026-01-04T14:42:18.089587Z | false |
fxsjy/jieba | https://github.com/fxsjy/jieba/blob/67fa2e36e72f69d9134b8a1037b83fbb070b9775/test/test_pos_no_hmm.py | test/test_pos_no_hmm.py | #encoding=utf-8
from __future__ import print_function
import sys
sys.path.append("../")
import jieba.posseg as pseg
def cuttest(test_sent):
result = pseg.cut(test_sent, HMM=False)
for word, flag in result:
print(word, "/", flag, ", ", end=' ')
print("")
if __name__ == "__main__":
cuttest("这是一... | python | MIT | 67fa2e36e72f69d9134b8a1037b83fbb070b9775 | 2026-01-04T14:42:18.089587Z | false |
fxsjy/jieba | https://github.com/fxsjy/jieba/blob/67fa2e36e72f69d9134b8a1037b83fbb070b9775/test/test_lock.py | test/test_lock.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import jieba
import threading
def inittokenizer(tokenizer, group):
print('===> Thread %s:%s started' % (group, threading.current_thread().ident))
tokenizer.initialize()
print('<=== Thread %s:%s finished' % (group, threading.current_thread().ident))
tokrs1 = [jieba.Tok... | python | MIT | 67fa2e36e72f69d9134b8a1037b83fbb070b9775 | 2026-01-04T14:42:18.089587Z | false |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.