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 |
|---|---|---|---|---|---|---|---|---|
hdjang/Feature-Selective-Anchor-Free-Module-for-Single-Shot-Object-Detection | https://github.com/hdjang/Feature-Selective-Anchor-Free-Module-for-Single-Shot-Object-Detection/blob/321a207c499a3f6b260fa2e0644ef90a5d996ddc/mmdet/utils/__init__.py | mmdet/utils/__init__.py | from .flops_counter import get_model_complexity_info
from .registry import Registry, build_from_cfg
__all__ = ['Registry', 'build_from_cfg', 'get_model_complexity_info']
| python | Apache-2.0 | 321a207c499a3f6b260fa2e0644ef90a5d996ddc | 2026-01-05T07:09:22.326240Z | false |
hdjang/Feature-Selective-Anchor-Free-Module-for-Single-Shot-Object-Detection | https://github.com/hdjang/Feature-Selective-Anchor-Free-Module-for-Single-Shot-Object-Detection/blob/321a207c499a3f6b260fa2e0644ef90a5d996ddc/mmdet/core/__init__.py | mmdet/core/__init__.py | from .anchor import * # noqa: F401, F403
from .bbox import * # noqa: F401, F403
from .evaluation import * # noqa: F401, F403
from .fp16 import * # noqa: F401, F403
from .mask import * # noqa: F401, F403
from .post_processing import * # noqa: F401, F403
from .utils import * # noqa: F401, F403
| python | Apache-2.0 | 321a207c499a3f6b260fa2e0644ef90a5d996ddc | 2026-01-05T07:09:22.326240Z | false |
hdjang/Feature-Selective-Anchor-Free-Module-for-Single-Shot-Object-Detection | https://github.com/hdjang/Feature-Selective-Anchor-Free-Module-for-Single-Shot-Object-Detection/blob/321a207c499a3f6b260fa2e0644ef90a5d996ddc/mmdet/core/bbox/assign_sampling.py | mmdet/core/bbox/assign_sampling.py | import mmcv
from . import assigners, samplers
def build_assigner(cfg, **kwargs):
if isinstance(cfg, assigners.BaseAssigner):
return cfg
elif isinstance(cfg, dict):
return mmcv.runner.obj_from_dict(cfg, assigners, default_args=kwargs)
else:
raise TypeError('Invalid type {} for buil... | python | Apache-2.0 | 321a207c499a3f6b260fa2e0644ef90a5d996ddc | 2026-01-05T07:09:22.326240Z | false |
hdjang/Feature-Selective-Anchor-Free-Module-for-Single-Shot-Object-Detection | https://github.com/hdjang/Feature-Selective-Anchor-Free-Module-for-Single-Shot-Object-Detection/blob/321a207c499a3f6b260fa2e0644ef90a5d996ddc/mmdet/core/bbox/bbox_target.py | mmdet/core/bbox/bbox_target.py | import torch
from ..utils import multi_apply
from .transforms import bbox2delta
def bbox_target(pos_bboxes_list,
neg_bboxes_list,
pos_gt_bboxes_list,
pos_gt_labels_list,
cfg,
reg_classes=1,
target_means=[.0, .0, .0, .0],
... | python | Apache-2.0 | 321a207c499a3f6b260fa2e0644ef90a5d996ddc | 2026-01-05T07:09:22.326240Z | false |
hdjang/Feature-Selective-Anchor-Free-Module-for-Single-Shot-Object-Detection | https://github.com/hdjang/Feature-Selective-Anchor-Free-Module-for-Single-Shot-Object-Detection/blob/321a207c499a3f6b260fa2e0644ef90a5d996ddc/mmdet/core/bbox/__init__.py | mmdet/core/bbox/__init__.py | from .assigners import AssignResult, BaseAssigner, MaxIoUAssigner
from .bbox_target import bbox_target
from .geometry import bbox_overlaps
from .samplers import (BaseSampler, CombinedSampler,
InstanceBalancedPosSampler, IoUBalancedNegSampler,
PseudoSampler, RandomSampler, S... | python | Apache-2.0 | 321a207c499a3f6b260fa2e0644ef90a5d996ddc | 2026-01-05T07:09:22.326240Z | false |
hdjang/Feature-Selective-Anchor-Free-Module-for-Single-Shot-Object-Detection | https://github.com/hdjang/Feature-Selective-Anchor-Free-Module-for-Single-Shot-Object-Detection/blob/321a207c499a3f6b260fa2e0644ef90a5d996ddc/mmdet/core/bbox/geometry.py | mmdet/core/bbox/geometry.py | import torch
def bbox_overlaps(bboxes1, bboxes2, mode='iou', is_aligned=False):
"""Calculate overlap between two set of bboxes.
If ``is_aligned`` is ``False``, then calculate the ious between each bbox
of bboxes1 and bboxes2, otherwise the ious between each aligned pair of
bboxes1 and bboxes2.
A... | python | Apache-2.0 | 321a207c499a3f6b260fa2e0644ef90a5d996ddc | 2026-01-05T07:09:22.326240Z | false |
hdjang/Feature-Selective-Anchor-Free-Module-for-Single-Shot-Object-Detection | https://github.com/hdjang/Feature-Selective-Anchor-Free-Module-for-Single-Shot-Object-Detection/blob/321a207c499a3f6b260fa2e0644ef90a5d996ddc/mmdet/core/bbox/transforms.py | mmdet/core/bbox/transforms.py | import mmcv
import numpy as np
import torch
def bbox2delta(proposals, gt, means=[0, 0, 0, 0], stds=[1, 1, 1, 1]):
assert proposals.size() == gt.size()
proposals = proposals.float()
gt = gt.float()
px = (proposals[..., 0] + proposals[..., 2]) * 0.5
py = (proposals[..., 1] + proposals[..., 3]) * 0.... | python | Apache-2.0 | 321a207c499a3f6b260fa2e0644ef90a5d996ddc | 2026-01-05T07:09:22.326240Z | false |
hdjang/Feature-Selective-Anchor-Free-Module-for-Single-Shot-Object-Detection | https://github.com/hdjang/Feature-Selective-Anchor-Free-Module-for-Single-Shot-Object-Detection/blob/321a207c499a3f6b260fa2e0644ef90a5d996ddc/mmdet/core/bbox/assigners/point_assigner.py | mmdet/core/bbox/assigners/point_assigner.py | import torch
from .assign_result import AssignResult
from .base_assigner import BaseAssigner
class PointAssigner(BaseAssigner):
"""Assign a corresponding gt bbox or background to each point.
Each proposals will be assigned with `0`, or a positive integer
indicating the ground truth index.
- 0: nega... | python | Apache-2.0 | 321a207c499a3f6b260fa2e0644ef90a5d996ddc | 2026-01-05T07:09:22.326240Z | false |
hdjang/Feature-Selective-Anchor-Free-Module-for-Single-Shot-Object-Detection | https://github.com/hdjang/Feature-Selective-Anchor-Free-Module-for-Single-Shot-Object-Detection/blob/321a207c499a3f6b260fa2e0644ef90a5d996ddc/mmdet/core/bbox/assigners/base_assigner.py | mmdet/core/bbox/assigners/base_assigner.py | from abc import ABCMeta, abstractmethod
class BaseAssigner(metaclass=ABCMeta):
@abstractmethod
def assign(self, bboxes, gt_bboxes, gt_bboxes_ignore=None, gt_labels=None):
pass
| python | Apache-2.0 | 321a207c499a3f6b260fa2e0644ef90a5d996ddc | 2026-01-05T07:09:22.326240Z | false |
hdjang/Feature-Selective-Anchor-Free-Module-for-Single-Shot-Object-Detection | https://github.com/hdjang/Feature-Selective-Anchor-Free-Module-for-Single-Shot-Object-Detection/blob/321a207c499a3f6b260fa2e0644ef90a5d996ddc/mmdet/core/bbox/assigners/assign_result.py | mmdet/core/bbox/assigners/assign_result.py | import torch
class AssignResult(object):
def __init__(self, num_gts, gt_inds, max_overlaps, labels=None):
self.num_gts = num_gts
self.gt_inds = gt_inds
self.max_overlaps = max_overlaps
self.labels = labels
def add_gt_(self, gt_labels):
self_inds = torch.arange(
... | python | Apache-2.0 | 321a207c499a3f6b260fa2e0644ef90a5d996ddc | 2026-01-05T07:09:22.326240Z | false |
hdjang/Feature-Selective-Anchor-Free-Module-for-Single-Shot-Object-Detection | https://github.com/hdjang/Feature-Selective-Anchor-Free-Module-for-Single-Shot-Object-Detection/blob/321a207c499a3f6b260fa2e0644ef90a5d996ddc/mmdet/core/bbox/assigners/approx_max_iou_assigner.py | mmdet/core/bbox/assigners/approx_max_iou_assigner.py | import torch
from ..geometry import bbox_overlaps
from .max_iou_assigner import MaxIoUAssigner
class ApproxMaxIoUAssigner(MaxIoUAssigner):
"""Assign a corresponding gt bbox or background to each bbox.
Each proposals will be assigned with `-1`, `0`, or a positive integer
indicating the ground truth index... | python | Apache-2.0 | 321a207c499a3f6b260fa2e0644ef90a5d996ddc | 2026-01-05T07:09:22.326240Z | false |
hdjang/Feature-Selective-Anchor-Free-Module-for-Single-Shot-Object-Detection | https://github.com/hdjang/Feature-Selective-Anchor-Free-Module-for-Single-Shot-Object-Detection/blob/321a207c499a3f6b260fa2e0644ef90a5d996ddc/mmdet/core/bbox/assigners/__init__.py | mmdet/core/bbox/assigners/__init__.py | from .approx_max_iou_assigner import ApproxMaxIoUAssigner
from .assign_result import AssignResult
from .base_assigner import BaseAssigner
from .max_iou_assigner import MaxIoUAssigner
from .point_assigner import PointAssigner
__all__ = [
'BaseAssigner', 'MaxIoUAssigner', 'ApproxMaxIoUAssigner', 'AssignResult',
... | python | Apache-2.0 | 321a207c499a3f6b260fa2e0644ef90a5d996ddc | 2026-01-05T07:09:22.326240Z | false |
hdjang/Feature-Selective-Anchor-Free-Module-for-Single-Shot-Object-Detection | https://github.com/hdjang/Feature-Selective-Anchor-Free-Module-for-Single-Shot-Object-Detection/blob/321a207c499a3f6b260fa2e0644ef90a5d996ddc/mmdet/core/bbox/assigners/max_iou_assigner.py | mmdet/core/bbox/assigners/max_iou_assigner.py | import torch
from ..geometry import bbox_overlaps
from .assign_result import AssignResult
from .base_assigner import BaseAssigner
class MaxIoUAssigner(BaseAssigner):
"""Assign a corresponding gt bbox or background to each bbox.
Each proposals will be assigned with `-1`, `0`, or a positive integer
indica... | python | Apache-2.0 | 321a207c499a3f6b260fa2e0644ef90a5d996ddc | 2026-01-05T07:09:22.326240Z | false |
hdjang/Feature-Selective-Anchor-Free-Module-for-Single-Shot-Object-Detection | https://github.com/hdjang/Feature-Selective-Anchor-Free-Module-for-Single-Shot-Object-Detection/blob/321a207c499a3f6b260fa2e0644ef90a5d996ddc/mmdet/core/bbox/samplers/random_sampler.py | mmdet/core/bbox/samplers/random_sampler.py | import numpy as np
import torch
from .base_sampler import BaseSampler
class RandomSampler(BaseSampler):
def __init__(self,
num,
pos_fraction,
neg_pos_ub=-1,
add_gt_as_proposals=True,
**kwargs):
super(RandomSampler, self... | python | Apache-2.0 | 321a207c499a3f6b260fa2e0644ef90a5d996ddc | 2026-01-05T07:09:22.326240Z | false |
hdjang/Feature-Selective-Anchor-Free-Module-for-Single-Shot-Object-Detection | https://github.com/hdjang/Feature-Selective-Anchor-Free-Module-for-Single-Shot-Object-Detection/blob/321a207c499a3f6b260fa2e0644ef90a5d996ddc/mmdet/core/bbox/samplers/base_sampler.py | mmdet/core/bbox/samplers/base_sampler.py | from abc import ABCMeta, abstractmethod
import torch
from .sampling_result import SamplingResult
class BaseSampler(metaclass=ABCMeta):
def __init__(self,
num,
pos_fraction,
neg_pos_ub=-1,
add_gt_as_proposals=True,
**kwargs):
... | python | Apache-2.0 | 321a207c499a3f6b260fa2e0644ef90a5d996ddc | 2026-01-05T07:09:22.326240Z | false |
hdjang/Feature-Selective-Anchor-Free-Module-for-Single-Shot-Object-Detection | https://github.com/hdjang/Feature-Selective-Anchor-Free-Module-for-Single-Shot-Object-Detection/blob/321a207c499a3f6b260fa2e0644ef90a5d996ddc/mmdet/core/bbox/samplers/instance_balanced_pos_sampler.py | mmdet/core/bbox/samplers/instance_balanced_pos_sampler.py | import numpy as np
import torch
from .random_sampler import RandomSampler
class InstanceBalancedPosSampler(RandomSampler):
def _sample_pos(self, assign_result, num_expected, **kwargs):
pos_inds = torch.nonzero(assign_result.gt_inds > 0)
if pos_inds.numel() != 0:
pos_inds = pos_inds.s... | python | Apache-2.0 | 321a207c499a3f6b260fa2e0644ef90a5d996ddc | 2026-01-05T07:09:22.326240Z | false |
hdjang/Feature-Selective-Anchor-Free-Module-for-Single-Shot-Object-Detection | https://github.com/hdjang/Feature-Selective-Anchor-Free-Module-for-Single-Shot-Object-Detection/blob/321a207c499a3f6b260fa2e0644ef90a5d996ddc/mmdet/core/bbox/samplers/ohem_sampler.py | mmdet/core/bbox/samplers/ohem_sampler.py | import torch
from ..transforms import bbox2roi
from .base_sampler import BaseSampler
class OHEMSampler(BaseSampler):
def __init__(self,
num,
pos_fraction,
context,
neg_pos_ub=-1,
add_gt_as_proposals=True,
**kwa... | python | Apache-2.0 | 321a207c499a3f6b260fa2e0644ef90a5d996ddc | 2026-01-05T07:09:22.326240Z | false |
hdjang/Feature-Selective-Anchor-Free-Module-for-Single-Shot-Object-Detection | https://github.com/hdjang/Feature-Selective-Anchor-Free-Module-for-Single-Shot-Object-Detection/blob/321a207c499a3f6b260fa2e0644ef90a5d996ddc/mmdet/core/bbox/samplers/sampling_result.py | mmdet/core/bbox/samplers/sampling_result.py | import torch
class SamplingResult(object):
def __init__(self, pos_inds, neg_inds, bboxes, gt_bboxes, assign_result,
gt_flags):
self.pos_inds = pos_inds
self.neg_inds = neg_inds
self.pos_bboxes = bboxes[pos_inds]
self.neg_bboxes = bboxes[neg_inds]
self.pos_... | python | Apache-2.0 | 321a207c499a3f6b260fa2e0644ef90a5d996ddc | 2026-01-05T07:09:22.326240Z | false |
hdjang/Feature-Selective-Anchor-Free-Module-for-Single-Shot-Object-Detection | https://github.com/hdjang/Feature-Selective-Anchor-Free-Module-for-Single-Shot-Object-Detection/blob/321a207c499a3f6b260fa2e0644ef90a5d996ddc/mmdet/core/bbox/samplers/combined_sampler.py | mmdet/core/bbox/samplers/combined_sampler.py | from ..assign_sampling import build_sampler
from .base_sampler import BaseSampler
class CombinedSampler(BaseSampler):
def __init__(self, pos_sampler, neg_sampler, **kwargs):
super(CombinedSampler, self).__init__(**kwargs)
self.pos_sampler = build_sampler(pos_sampler, **kwargs)
self.neg_sa... | python | Apache-2.0 | 321a207c499a3f6b260fa2e0644ef90a5d996ddc | 2026-01-05T07:09:22.326240Z | false |
hdjang/Feature-Selective-Anchor-Free-Module-for-Single-Shot-Object-Detection | https://github.com/hdjang/Feature-Selective-Anchor-Free-Module-for-Single-Shot-Object-Detection/blob/321a207c499a3f6b260fa2e0644ef90a5d996ddc/mmdet/core/bbox/samplers/__init__.py | mmdet/core/bbox/samplers/__init__.py | from .base_sampler import BaseSampler
from .combined_sampler import CombinedSampler
from .instance_balanced_pos_sampler import InstanceBalancedPosSampler
from .iou_balanced_neg_sampler import IoUBalancedNegSampler
from .ohem_sampler import OHEMSampler
from .pseudo_sampler import PseudoSampler
from .random_sampler impor... | python | Apache-2.0 | 321a207c499a3f6b260fa2e0644ef90a5d996ddc | 2026-01-05T07:09:22.326240Z | false |
hdjang/Feature-Selective-Anchor-Free-Module-for-Single-Shot-Object-Detection | https://github.com/hdjang/Feature-Selective-Anchor-Free-Module-for-Single-Shot-Object-Detection/blob/321a207c499a3f6b260fa2e0644ef90a5d996ddc/mmdet/core/bbox/samplers/pseudo_sampler.py | mmdet/core/bbox/samplers/pseudo_sampler.py | import torch
from .base_sampler import BaseSampler
from .sampling_result import SamplingResult
class PseudoSampler(BaseSampler):
def __init__(self, **kwargs):
pass
def _sample_pos(self, **kwargs):
raise NotImplementedError
def _sample_neg(self, **kwargs):
raise NotImplementedEr... | python | Apache-2.0 | 321a207c499a3f6b260fa2e0644ef90a5d996ddc | 2026-01-05T07:09:22.326240Z | false |
hdjang/Feature-Selective-Anchor-Free-Module-for-Single-Shot-Object-Detection | https://github.com/hdjang/Feature-Selective-Anchor-Free-Module-for-Single-Shot-Object-Detection/blob/321a207c499a3f6b260fa2e0644ef90a5d996ddc/mmdet/core/bbox/samplers/iou_balanced_neg_sampler.py | mmdet/core/bbox/samplers/iou_balanced_neg_sampler.py | import numpy as np
import torch
from .random_sampler import RandomSampler
class IoUBalancedNegSampler(RandomSampler):
"""IoU Balanced Sampling
arXiv: https://arxiv.org/pdf/1904.02701.pdf (CVPR 2019)
Sampling proposals according to their IoU. `floor_fraction` of needed RoIs
are sampled from proposal... | python | Apache-2.0 | 321a207c499a3f6b260fa2e0644ef90a5d996ddc | 2026-01-05T07:09:22.326240Z | false |
hdjang/Feature-Selective-Anchor-Free-Module-for-Single-Shot-Object-Detection | https://github.com/hdjang/Feature-Selective-Anchor-Free-Module-for-Single-Shot-Object-Detection/blob/321a207c499a3f6b260fa2e0644ef90a5d996ddc/mmdet/core/anchor/point_generator.py | mmdet/core/anchor/point_generator.py | import torch
class PointGenerator(object):
def _meshgrid(self, x, y, row_major=True):
xx = x.repeat(len(y))
yy = y.view(-1, 1).repeat(1, len(x)).view(-1)
if row_major:
return xx, yy
else:
return yy, xx
def grid_points(self, featmap_size, stride=16, dev... | python | Apache-2.0 | 321a207c499a3f6b260fa2e0644ef90a5d996ddc | 2026-01-05T07:09:22.326240Z | false |
hdjang/Feature-Selective-Anchor-Free-Module-for-Single-Shot-Object-Detection | https://github.com/hdjang/Feature-Selective-Anchor-Free-Module-for-Single-Shot-Object-Detection/blob/321a207c499a3f6b260fa2e0644ef90a5d996ddc/mmdet/core/anchor/anchor_target.py | mmdet/core/anchor/anchor_target.py | import torch
from ..bbox import PseudoSampler, assign_and_sample, bbox2delta, build_assigner
from ..utils import multi_apply
import pdb
def anchor_target(anchor_list,
valid_flag_list,
gt_bboxes_list,
img_metas,
target_means,
t... | python | Apache-2.0 | 321a207c499a3f6b260fa2e0644ef90a5d996ddc | 2026-01-05T07:09:22.326240Z | false |
hdjang/Feature-Selective-Anchor-Free-Module-for-Single-Shot-Object-Detection | https://github.com/hdjang/Feature-Selective-Anchor-Free-Module-for-Single-Shot-Object-Detection/blob/321a207c499a3f6b260fa2e0644ef90a5d996ddc/mmdet/core/anchor/point_target.py | mmdet/core/anchor/point_target.py | import torch
from ..bbox import PseudoSampler, assign_and_sample, build_assigner
from ..utils import multi_apply
def point_target(proposals_list,
valid_flag_list,
gt_bboxes_list,
img_metas,
cfg,
gt_bboxes_ignore_list=None,
... | python | Apache-2.0 | 321a207c499a3f6b260fa2e0644ef90a5d996ddc | 2026-01-05T07:09:22.326240Z | false |
hdjang/Feature-Selective-Anchor-Free-Module-for-Single-Shot-Object-Detection | https://github.com/hdjang/Feature-Selective-Anchor-Free-Module-for-Single-Shot-Object-Detection/blob/321a207c499a3f6b260fa2e0644ef90a5d996ddc/mmdet/core/anchor/guided_anchor_target.py | mmdet/core/anchor/guided_anchor_target.py | import torch
from ..bbox import PseudoSampler, build_assigner, build_sampler
from ..utils import multi_apply, unmap
def calc_region(bbox, ratio, featmap_size=None):
"""Calculate a proportional bbox region.
The bbox center are fixed and the new h' and w' is h * ratio and w * ratio.
Args:
bbox (T... | python | Apache-2.0 | 321a207c499a3f6b260fa2e0644ef90a5d996ddc | 2026-01-05T07:09:22.326240Z | false |
hdjang/Feature-Selective-Anchor-Free-Module-for-Single-Shot-Object-Detection | https://github.com/hdjang/Feature-Selective-Anchor-Free-Module-for-Single-Shot-Object-Detection/blob/321a207c499a3f6b260fa2e0644ef90a5d996ddc/mmdet/core/anchor/__init__.py | mmdet/core/anchor/__init__.py | from .anchor_generator import AnchorGenerator
from .anchor_target import anchor_inside_flags, anchor_target
from .guided_anchor_target import ga_loc_target, ga_shape_target
from .point_generator import PointGenerator
from .point_target import point_target
__all__ = [
'AnchorGenerator', 'anchor_target', 'anchor_ins... | python | Apache-2.0 | 321a207c499a3f6b260fa2e0644ef90a5d996ddc | 2026-01-05T07:09:22.326240Z | false |
hdjang/Feature-Selective-Anchor-Free-Module-for-Single-Shot-Object-Detection | https://github.com/hdjang/Feature-Selective-Anchor-Free-Module-for-Single-Shot-Object-Detection/blob/321a207c499a3f6b260fa2e0644ef90a5d996ddc/mmdet/core/anchor/anchor_generator.py | mmdet/core/anchor/anchor_generator.py | import torch
class AnchorGenerator(object):
def __init__(self, base_size, scales, ratios, scale_major=True, ctr=None):
self.base_size = base_size
self.scales = torch.Tensor(scales)
self.ratios = torch.Tensor(ratios)
self.scale_major = scale_major
self.ctr = ctr
sel... | python | Apache-2.0 | 321a207c499a3f6b260fa2e0644ef90a5d996ddc | 2026-01-05T07:09:22.326240Z | false |
hdjang/Feature-Selective-Anchor-Free-Module-for-Single-Shot-Object-Detection | https://github.com/hdjang/Feature-Selective-Anchor-Free-Module-for-Single-Shot-Object-Detection/blob/321a207c499a3f6b260fa2e0644ef90a5d996ddc/mmdet/core/mask/mask_target.py | mmdet/core/mask/mask_target.py | import mmcv
import numpy as np
import torch
from torch.nn.modules.utils import _pair
def mask_target(pos_proposals_list, pos_assigned_gt_inds_list, gt_masks_list,
cfg):
cfg_list = [cfg for _ in range(len(pos_proposals_list))]
mask_targets = map(mask_target_single, pos_proposals_list,
... | python | Apache-2.0 | 321a207c499a3f6b260fa2e0644ef90a5d996ddc | 2026-01-05T07:09:22.326240Z | false |
hdjang/Feature-Selective-Anchor-Free-Module-for-Single-Shot-Object-Detection | https://github.com/hdjang/Feature-Selective-Anchor-Free-Module-for-Single-Shot-Object-Detection/blob/321a207c499a3f6b260fa2e0644ef90a5d996ddc/mmdet/core/mask/utils.py | mmdet/core/mask/utils.py | import mmcv
def split_combined_polys(polys, poly_lens, polys_per_mask):
"""Split the combined 1-D polys into masks.
A mask is represented as a list of polys, and a poly is represented as
a 1-D array. In dataset, all masks are concatenated into a single 1-D
tensor. Here we need to split the tensor int... | python | Apache-2.0 | 321a207c499a3f6b260fa2e0644ef90a5d996ddc | 2026-01-05T07:09:22.326240Z | false |
hdjang/Feature-Selective-Anchor-Free-Module-for-Single-Shot-Object-Detection | https://github.com/hdjang/Feature-Selective-Anchor-Free-Module-for-Single-Shot-Object-Detection/blob/321a207c499a3f6b260fa2e0644ef90a5d996ddc/mmdet/core/mask/__init__.py | mmdet/core/mask/__init__.py | from .mask_target import mask_target
from .utils import split_combined_polys
__all__ = ['split_combined_polys', 'mask_target']
| python | Apache-2.0 | 321a207c499a3f6b260fa2e0644ef90a5d996ddc | 2026-01-05T07:09:22.326240Z | false |
hdjang/Feature-Selective-Anchor-Free-Module-for-Single-Shot-Object-Detection | https://github.com/hdjang/Feature-Selective-Anchor-Free-Module-for-Single-Shot-Object-Detection/blob/321a207c499a3f6b260fa2e0644ef90a5d996ddc/mmdet/core/utils/dist_utils.py | mmdet/core/utils/dist_utils.py | from collections import OrderedDict
import torch.distributed as dist
from mmcv.runner import OptimizerHook
from torch._utils import (_flatten_dense_tensors, _take_tensors,
_unflatten_dense_tensors)
def _allreduce_coalesced(tensors, world_size, bucket_size_mb=-1):
if bucket_size_mb > 0:
... | python | Apache-2.0 | 321a207c499a3f6b260fa2e0644ef90a5d996ddc | 2026-01-05T07:09:22.326240Z | false |
hdjang/Feature-Selective-Anchor-Free-Module-for-Single-Shot-Object-Detection | https://github.com/hdjang/Feature-Selective-Anchor-Free-Module-for-Single-Shot-Object-Detection/blob/321a207c499a3f6b260fa2e0644ef90a5d996ddc/mmdet/core/utils/misc.py | mmdet/core/utils/misc.py | from functools import partial
import mmcv
import numpy as np
from six.moves import map, zip
def tensor2imgs(tensor, mean=(0, 0, 0), std=(1, 1, 1), to_rgb=True):
num_imgs = tensor.size(0)
mean = np.array(mean, dtype=np.float32)
std = np.array(std, dtype=np.float32)
imgs = []
for img_id in range(nu... | python | Apache-2.0 | 321a207c499a3f6b260fa2e0644ef90a5d996ddc | 2026-01-05T07:09:22.326240Z | false |
hdjang/Feature-Selective-Anchor-Free-Module-for-Single-Shot-Object-Detection | https://github.com/hdjang/Feature-Selective-Anchor-Free-Module-for-Single-Shot-Object-Detection/blob/321a207c499a3f6b260fa2e0644ef90a5d996ddc/mmdet/core/utils/__init__.py | mmdet/core/utils/__init__.py | from .dist_utils import DistOptimizerHook, allreduce_grads
from .misc import multi_apply, tensor2imgs, unmap
__all__ = [
'allreduce_grads', 'DistOptimizerHook', 'tensor2imgs', 'unmap',
'multi_apply'
]
| python | Apache-2.0 | 321a207c499a3f6b260fa2e0644ef90a5d996ddc | 2026-01-05T07:09:22.326240Z | false |
hdjang/Feature-Selective-Anchor-Free-Module-for-Single-Shot-Object-Detection | https://github.com/hdjang/Feature-Selective-Anchor-Free-Module-for-Single-Shot-Object-Detection/blob/321a207c499a3f6b260fa2e0644ef90a5d996ddc/mmdet/core/post_processing/merge_augs.py | mmdet/core/post_processing/merge_augs.py | import numpy as np
import torch
from mmdet.ops import nms
from ..bbox import bbox_mapping_back
def merge_aug_proposals(aug_proposals, img_metas, rpn_test_cfg):
"""Merge augmented proposals (multiscale, flip, etc.)
Args:
aug_proposals (list[Tensor]): proposals from different testing
schem... | python | Apache-2.0 | 321a207c499a3f6b260fa2e0644ef90a5d996ddc | 2026-01-05T07:09:22.326240Z | false |
hdjang/Feature-Selective-Anchor-Free-Module-for-Single-Shot-Object-Detection | https://github.com/hdjang/Feature-Selective-Anchor-Free-Module-for-Single-Shot-Object-Detection/blob/321a207c499a3f6b260fa2e0644ef90a5d996ddc/mmdet/core/post_processing/bbox_nms.py | mmdet/core/post_processing/bbox_nms.py | import torch
from mmdet.ops.nms import nms_wrapper
def multiclass_nms(multi_bboxes,
multi_scores,
score_thr,
nms_cfg,
max_num=-1,
score_factors=None):
"""NMS for multi-class bboxes.
Args:
multi_bboxes (Ten... | python | Apache-2.0 | 321a207c499a3f6b260fa2e0644ef90a5d996ddc | 2026-01-05T07:09:22.326240Z | false |
hdjang/Feature-Selective-Anchor-Free-Module-for-Single-Shot-Object-Detection | https://github.com/hdjang/Feature-Selective-Anchor-Free-Module-for-Single-Shot-Object-Detection/blob/321a207c499a3f6b260fa2e0644ef90a5d996ddc/mmdet/core/post_processing/__init__.py | mmdet/core/post_processing/__init__.py | from .bbox_nms import multiclass_nms
from .merge_augs import (merge_aug_bboxes, merge_aug_masks,
merge_aug_proposals, merge_aug_scores)
__all__ = [
'multiclass_nms', 'merge_aug_proposals', 'merge_aug_bboxes',
'merge_aug_scores', 'merge_aug_masks'
]
| python | Apache-2.0 | 321a207c499a3f6b260fa2e0644ef90a5d996ddc | 2026-01-05T07:09:22.326240Z | false |
hdjang/Feature-Selective-Anchor-Free-Module-for-Single-Shot-Object-Detection | https://github.com/hdjang/Feature-Selective-Anchor-Free-Module-for-Single-Shot-Object-Detection/blob/321a207c499a3f6b260fa2e0644ef90a5d996ddc/mmdet/core/evaluation/coco_utils.py | mmdet/core/evaluation/coco_utils.py | import mmcv
import numpy as np
from pycocotools.coco import COCO
from pycocotools.cocoeval import COCOeval
from .recall import eval_recalls
def coco_eval(result_files, result_types, coco, max_dets=(100, 300, 1000)):
for res_type in result_types:
assert res_type in [
'proposal', 'proposal_fast... | python | Apache-2.0 | 321a207c499a3f6b260fa2e0644ef90a5d996ddc | 2026-01-05T07:09:22.326240Z | false |
hdjang/Feature-Selective-Anchor-Free-Module-for-Single-Shot-Object-Detection | https://github.com/hdjang/Feature-Selective-Anchor-Free-Module-for-Single-Shot-Object-Detection/blob/321a207c499a3f6b260fa2e0644ef90a5d996ddc/mmdet/core/evaluation/class_names.py | mmdet/core/evaluation/class_names.py | import mmcv
def wider_face_classes():
return ['face']
def voc_classes():
return [
'aeroplane', 'bicycle', 'bird', 'boat', 'bottle', 'bus', 'car', 'cat',
'chair', 'cow', 'diningtable', 'dog', 'horse', 'motorbike', 'person',
'pottedplant', 'sheep', 'sofa', 'train', 'tvmonitor'
]
... | python | Apache-2.0 | 321a207c499a3f6b260fa2e0644ef90a5d996ddc | 2026-01-05T07:09:22.326240Z | false |
hdjang/Feature-Selective-Anchor-Free-Module-for-Single-Shot-Object-Detection | https://github.com/hdjang/Feature-Selective-Anchor-Free-Module-for-Single-Shot-Object-Detection/blob/321a207c499a3f6b260fa2e0644ef90a5d996ddc/mmdet/core/evaluation/recall.py | mmdet/core/evaluation/recall.py | import numpy as np
from terminaltables import AsciiTable
from .bbox_overlaps import bbox_overlaps
def _recalls(all_ious, proposal_nums, thrs):
img_num = all_ious.shape[0]
total_gt_num = sum([ious.shape[0] for ious in all_ious])
_ious = np.zeros((proposal_nums.size, total_gt_num), dtype=np.float32)
... | python | Apache-2.0 | 321a207c499a3f6b260fa2e0644ef90a5d996ddc | 2026-01-05T07:09:22.326240Z | false |
hdjang/Feature-Selective-Anchor-Free-Module-for-Single-Shot-Object-Detection | https://github.com/hdjang/Feature-Selective-Anchor-Free-Module-for-Single-Shot-Object-Detection/blob/321a207c499a3f6b260fa2e0644ef90a5d996ddc/mmdet/core/evaluation/mean_ap.py | mmdet/core/evaluation/mean_ap.py | import mmcv
import numpy as np
from terminaltables import AsciiTable
from .bbox_overlaps import bbox_overlaps
from .class_names import get_classes
def average_precision(recalls, precisions, mode='area'):
"""Calculate average precision (for single or multiple scales).
Args:
recalls (ndarray): shape (... | python | Apache-2.0 | 321a207c499a3f6b260fa2e0644ef90a5d996ddc | 2026-01-05T07:09:22.326240Z | false |
hdjang/Feature-Selective-Anchor-Free-Module-for-Single-Shot-Object-Detection | https://github.com/hdjang/Feature-Selective-Anchor-Free-Module-for-Single-Shot-Object-Detection/blob/321a207c499a3f6b260fa2e0644ef90a5d996ddc/mmdet/core/evaluation/bbox_overlaps.py | mmdet/core/evaluation/bbox_overlaps.py | import numpy as np
def bbox_overlaps(bboxes1, bboxes2, mode='iou'):
"""Calculate the ious between each bbox of bboxes1 and bboxes2.
Args:
bboxes1(ndarray): shape (n, 4)
bboxes2(ndarray): shape (k, 4)
mode(str): iou (intersection over union) or iof (intersection
over foregr... | python | Apache-2.0 | 321a207c499a3f6b260fa2e0644ef90a5d996ddc | 2026-01-05T07:09:22.326240Z | false |
hdjang/Feature-Selective-Anchor-Free-Module-for-Single-Shot-Object-Detection | https://github.com/hdjang/Feature-Selective-Anchor-Free-Module-for-Single-Shot-Object-Detection/blob/321a207c499a3f6b260fa2e0644ef90a5d996ddc/mmdet/core/evaluation/__init__.py | mmdet/core/evaluation/__init__.py | from .class_names import (coco_classes, dataset_aliases, get_classes,
imagenet_det_classes, imagenet_vid_classes,
voc_classes)
from .coco_utils import coco_eval, fast_eval_recall, results2json
from .eval_hooks import (CocoDistEvalmAPHook, CocoDistEvalRecallHook,
... | python | Apache-2.0 | 321a207c499a3f6b260fa2e0644ef90a5d996ddc | 2026-01-05T07:09:22.326240Z | false |
hdjang/Feature-Selective-Anchor-Free-Module-for-Single-Shot-Object-Detection | https://github.com/hdjang/Feature-Selective-Anchor-Free-Module-for-Single-Shot-Object-Detection/blob/321a207c499a3f6b260fa2e0644ef90a5d996ddc/mmdet/core/evaluation/eval_hooks.py | mmdet/core/evaluation/eval_hooks.py | import os
import os.path as osp
import mmcv
import numpy as np
import torch
import torch.distributed as dist
from mmcv.parallel import collate, scatter
from mmcv.runner import Hook
from pycocotools.cocoeval import COCOeval
from torch.utils.data import Dataset
from mmdet import datasets
from .coco_utils import fast_ev... | python | Apache-2.0 | 321a207c499a3f6b260fa2e0644ef90a5d996ddc | 2026-01-05T07:09:22.326240Z | false |
hdjang/Feature-Selective-Anchor-Free-Module-for-Single-Shot-Object-Detection | https://github.com/hdjang/Feature-Selective-Anchor-Free-Module-for-Single-Shot-Object-Detection/blob/321a207c499a3f6b260fa2e0644ef90a5d996ddc/mmdet/core/fp16/decorators.py | mmdet/core/fp16/decorators.py | import functools
from inspect import getfullargspec
import torch
from .utils import cast_tensor_type
def auto_fp16(apply_to=None, out_fp32=False):
"""Decorator to enable fp16 training automatically.
This decorator is useful when you write custom modules and want to support
mixed precision training. If ... | python | Apache-2.0 | 321a207c499a3f6b260fa2e0644ef90a5d996ddc | 2026-01-05T07:09:22.326240Z | false |
hdjang/Feature-Selective-Anchor-Free-Module-for-Single-Shot-Object-Detection | https://github.com/hdjang/Feature-Selective-Anchor-Free-Module-for-Single-Shot-Object-Detection/blob/321a207c499a3f6b260fa2e0644ef90a5d996ddc/mmdet/core/fp16/utils.py | mmdet/core/fp16/utils.py | from collections import abc
import numpy as np
import torch
def cast_tensor_type(inputs, src_type, dst_type):
if isinstance(inputs, torch.Tensor):
return inputs.to(dst_type)
elif isinstance(inputs, str):
return inputs
elif isinstance(inputs, np.ndarray):
return inputs
elif isi... | python | Apache-2.0 | 321a207c499a3f6b260fa2e0644ef90a5d996ddc | 2026-01-05T07:09:22.326240Z | false |
hdjang/Feature-Selective-Anchor-Free-Module-for-Single-Shot-Object-Detection | https://github.com/hdjang/Feature-Selective-Anchor-Free-Module-for-Single-Shot-Object-Detection/blob/321a207c499a3f6b260fa2e0644ef90a5d996ddc/mmdet/core/fp16/__init__.py | mmdet/core/fp16/__init__.py | from .decorators import auto_fp16, force_fp32
from .hooks import Fp16OptimizerHook, wrap_fp16_model
__all__ = ['auto_fp16', 'force_fp32', 'Fp16OptimizerHook', 'wrap_fp16_model']
| python | Apache-2.0 | 321a207c499a3f6b260fa2e0644ef90a5d996ddc | 2026-01-05T07:09:22.326240Z | false |
hdjang/Feature-Selective-Anchor-Free-Module-for-Single-Shot-Object-Detection | https://github.com/hdjang/Feature-Selective-Anchor-Free-Module-for-Single-Shot-Object-Detection/blob/321a207c499a3f6b260fa2e0644ef90a5d996ddc/mmdet/core/fp16/hooks.py | mmdet/core/fp16/hooks.py | import copy
import torch
import torch.nn as nn
from mmcv.runner import OptimizerHook
from ..utils.dist_utils import allreduce_grads
from .utils import cast_tensor_type
class Fp16OptimizerHook(OptimizerHook):
"""FP16 optimizer hook.
The steps of fp16 optimizer is as follows.
1. Scale the loss value.
... | python | Apache-2.0 | 321a207c499a3f6b260fa2e0644ef90a5d996ddc | 2026-01-05T07:09:22.326240Z | false |
hdjang/Feature-Selective-Anchor-Free-Module-for-Single-Shot-Object-Detection | https://github.com/hdjang/Feature-Selective-Anchor-Free-Module-for-Single-Shot-Object-Detection/blob/321a207c499a3f6b260fa2e0644ef90a5d996ddc/mmdet/apis/train.py | mmdet/apis/train.py | from __future__ import division
import re
from collections import OrderedDict
import torch
from mmcv.parallel import MMDataParallel, MMDistributedDataParallel
from mmcv.runner import DistSamplerSeedHook, Runner, obj_from_dict
from mmdet import datasets
from mmdet.core import (CocoDistEvalmAPHook, CocoDistEvalRecallHo... | python | Apache-2.0 | 321a207c499a3f6b260fa2e0644ef90a5d996ddc | 2026-01-05T07:09:22.326240Z | false |
hdjang/Feature-Selective-Anchor-Free-Module-for-Single-Shot-Object-Detection | https://github.com/hdjang/Feature-Selective-Anchor-Free-Module-for-Single-Shot-Object-Detection/blob/321a207c499a3f6b260fa2e0644ef90a5d996ddc/mmdet/apis/inference.py | mmdet/apis/inference.py | import warnings
import matplotlib.pyplot as plt
import mmcv
import numpy as np
import pycocotools.mask as maskUtils
import torch
from mmcv.parallel import collate, scatter
from mmcv.runner import load_checkpoint
from mmdet.core import get_classes
from mmdet.datasets.pipelines import Compose
from mmdet.models import b... | python | Apache-2.0 | 321a207c499a3f6b260fa2e0644ef90a5d996ddc | 2026-01-05T07:09:22.326240Z | false |
hdjang/Feature-Selective-Anchor-Free-Module-for-Single-Shot-Object-Detection | https://github.com/hdjang/Feature-Selective-Anchor-Free-Module-for-Single-Shot-Object-Detection/blob/321a207c499a3f6b260fa2e0644ef90a5d996ddc/mmdet/apis/__init__.py | mmdet/apis/__init__.py | from .env import get_root_logger, init_dist, set_random_seed
from .inference import (inference_detector, init_detector, show_result,
show_result_pyplot)
from .train import train_detector
__all__ = [
'init_dist', 'get_root_logger', 'set_random_seed', 'train_detector',
'init_detector', 'i... | python | Apache-2.0 | 321a207c499a3f6b260fa2e0644ef90a5d996ddc | 2026-01-05T07:09:22.326240Z | false |
hdjang/Feature-Selective-Anchor-Free-Module-for-Single-Shot-Object-Detection | https://github.com/hdjang/Feature-Selective-Anchor-Free-Module-for-Single-Shot-Object-Detection/blob/321a207c499a3f6b260fa2e0644ef90a5d996ddc/mmdet/apis/env.py | mmdet/apis/env.py | import logging
import os
import random
import subprocess
import numpy as np
import torch
import torch.distributed as dist
import torch.multiprocessing as mp
from mmcv.runner import get_dist_info
def init_dist(launcher, backend='nccl', **kwargs):
if mp.get_start_method(allow_none=True) is None:
mp.set_sta... | python | Apache-2.0 | 321a207c499a3f6b260fa2e0644ef90a5d996ddc | 2026-01-05T07:09:22.326240Z | false |
hdjang/Feature-Selective-Anchor-Free-Module-for-Single-Shot-Object-Detection | https://github.com/hdjang/Feature-Selective-Anchor-Free-Module-for-Single-Shot-Object-Detection/blob/321a207c499a3f6b260fa2e0644ef90a5d996ddc/mmdet/ops/__init__.py | mmdet/ops/__init__.py | from .context_block import ContextBlock
from .dcn import (DeformConv, DeformConvPack, DeformRoIPooling,
DeformRoIPoolingPack, ModulatedDeformConv,
ModulatedDeformConvPack, ModulatedDeformRoIPoolingPack,
deform_conv, deform_roi_pooling, modulated_deform_conv)
from .m... | python | Apache-2.0 | 321a207c499a3f6b260fa2e0644ef90a5d996ddc | 2026-01-05T07:09:22.326240Z | false |
hdjang/Feature-Selective-Anchor-Free-Module-for-Single-Shot-Object-Detection | https://github.com/hdjang/Feature-Selective-Anchor-Free-Module-for-Single-Shot-Object-Detection/blob/321a207c499a3f6b260fa2e0644ef90a5d996ddc/mmdet/ops/context_block.py | mmdet/ops/context_block.py | import torch
from mmcv.cnn import constant_init, kaiming_init
from torch import nn
def last_zero_init(m):
if isinstance(m, nn.Sequential):
constant_init(m[-1], val=0)
else:
constant_init(m, val=0)
class ContextBlock(nn.Module):
def __init__(self,
inplanes,
... | python | Apache-2.0 | 321a207c499a3f6b260fa2e0644ef90a5d996ddc | 2026-01-05T07:09:22.326240Z | false |
hdjang/Feature-Selective-Anchor-Free-Module-for-Single-Shot-Object-Detection | https://github.com/hdjang/Feature-Selective-Anchor-Free-Module-for-Single-Shot-Object-Detection/blob/321a207c499a3f6b260fa2e0644ef90a5d996ddc/mmdet/ops/roi_align/roi_align.py | mmdet/ops/roi_align/roi_align.py | 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 . import roi_align_cuda
class RoIAlignFunction(Function):
@staticmethod
def forward(ctx, features, rois, out_size, spatial_scale, sample_num=0):
... | python | Apache-2.0 | 321a207c499a3f6b260fa2e0644ef90a5d996ddc | 2026-01-05T07:09:22.326240Z | false |
hdjang/Feature-Selective-Anchor-Free-Module-for-Single-Shot-Object-Detection | https://github.com/hdjang/Feature-Selective-Anchor-Free-Module-for-Single-Shot-Object-Detection/blob/321a207c499a3f6b260fa2e0644ef90a5d996ddc/mmdet/ops/roi_align/__init__.py | mmdet/ops/roi_align/__init__.py | from .roi_align import RoIAlign, roi_align
__all__ = ['roi_align', 'RoIAlign']
| python | Apache-2.0 | 321a207c499a3f6b260fa2e0644ef90a5d996ddc | 2026-01-05T07:09:22.326240Z | false |
hdjang/Feature-Selective-Anchor-Free-Module-for-Single-Shot-Object-Detection | https://github.com/hdjang/Feature-Selective-Anchor-Free-Module-for-Single-Shot-Object-Detection/blob/321a207c499a3f6b260fa2e0644ef90a5d996ddc/mmdet/ops/roi_align/gradcheck.py | mmdet/ops/roi_align/gradcheck.py | import os.path as osp
import sys
import numpy as np
import torch
from torch.autograd import gradcheck
sys.path.append(osp.abspath(osp.join(__file__, '../../')))
from roi_align import RoIAlign # noqa: E402, isort:skip
feat_size = 15
spatial_scale = 1.0 / 8
img_size = feat_size / spatial_scale
num_imgs = 2
num_rois =... | python | Apache-2.0 | 321a207c499a3f6b260fa2e0644ef90a5d996ddc | 2026-01-05T07:09:22.326240Z | false |
hdjang/Feature-Selective-Anchor-Free-Module-for-Single-Shot-Object-Detection | https://github.com/hdjang/Feature-Selective-Anchor-Free-Module-for-Single-Shot-Object-Detection/blob/321a207c499a3f6b260fa2e0644ef90a5d996ddc/mmdet/ops/nms/__init__.py | mmdet/ops/nms/__init__.py | from .nms_wrapper import nms, soft_nms
__all__ = ['nms', 'soft_nms']
| python | Apache-2.0 | 321a207c499a3f6b260fa2e0644ef90a5d996ddc | 2026-01-05T07:09:22.326240Z | false |
hdjang/Feature-Selective-Anchor-Free-Module-for-Single-Shot-Object-Detection | https://github.com/hdjang/Feature-Selective-Anchor-Free-Module-for-Single-Shot-Object-Detection/blob/321a207c499a3f6b260fa2e0644ef90a5d996ddc/mmdet/ops/nms/nms_wrapper.py | mmdet/ops/nms/nms_wrapper.py | import numpy as np
import torch
from . import nms_cpu, nms_cuda
from .soft_nms_cpu import soft_nms_cpu
def nms(dets, iou_thr, device_id=None):
"""Dispatch to either CPU or GPU NMS implementations.
The input can be either a torch tensor or numpy array. GPU NMS will be used
if the input is a gpu tensor or... | python | Apache-2.0 | 321a207c499a3f6b260fa2e0644ef90a5d996ddc | 2026-01-05T07:09:22.326240Z | false |
hdjang/Feature-Selective-Anchor-Free-Module-for-Single-Shot-Object-Detection | https://github.com/hdjang/Feature-Selective-Anchor-Free-Module-for-Single-Shot-Object-Detection/blob/321a207c499a3f6b260fa2e0644ef90a5d996ddc/mmdet/ops/sigmoid_focal_loss/__init__.py | mmdet/ops/sigmoid_focal_loss/__init__.py | from .sigmoid_focal_loss import SigmoidFocalLoss, sigmoid_focal_loss
__all__ = ['SigmoidFocalLoss', 'sigmoid_focal_loss']
| python | Apache-2.0 | 321a207c499a3f6b260fa2e0644ef90a5d996ddc | 2026-01-05T07:09:22.326240Z | false |
hdjang/Feature-Selective-Anchor-Free-Module-for-Single-Shot-Object-Detection | https://github.com/hdjang/Feature-Selective-Anchor-Free-Module-for-Single-Shot-Object-Detection/blob/321a207c499a3f6b260fa2e0644ef90a5d996ddc/mmdet/ops/sigmoid_focal_loss/sigmoid_focal_loss.py | mmdet/ops/sigmoid_focal_loss/sigmoid_focal_loss.py | import torch.nn as nn
from torch.autograd import Function
from torch.autograd.function import once_differentiable
from . import sigmoid_focal_loss_cuda
class SigmoidFocalLossFunction(Function):
@staticmethod
def forward(ctx, input, target, gamma=2.0, alpha=0.25):
ctx.save_for_backward(input, target)... | python | Apache-2.0 | 321a207c499a3f6b260fa2e0644ef90a5d996ddc | 2026-01-05T07:09:22.326240Z | false |
hdjang/Feature-Selective-Anchor-Free-Module-for-Single-Shot-Object-Detection | https://github.com/hdjang/Feature-Selective-Anchor-Free-Module-for-Single-Shot-Object-Detection/blob/321a207c499a3f6b260fa2e0644ef90a5d996ddc/mmdet/ops/roi_pool/__init__.py | mmdet/ops/roi_pool/__init__.py | from .roi_pool import RoIPool, roi_pool
__all__ = ['roi_pool', 'RoIPool']
| python | Apache-2.0 | 321a207c499a3f6b260fa2e0644ef90a5d996ddc | 2026-01-05T07:09:22.326240Z | false |
hdjang/Feature-Selective-Anchor-Free-Module-for-Single-Shot-Object-Detection | https://github.com/hdjang/Feature-Selective-Anchor-Free-Module-for-Single-Shot-Object-Detection/blob/321a207c499a3f6b260fa2e0644ef90a5d996ddc/mmdet/ops/roi_pool/gradcheck.py | mmdet/ops/roi_pool/gradcheck.py | import os.path as osp
import sys
import torch
from torch.autograd import gradcheck
sys.path.append(osp.abspath(osp.join(__file__, '../../')))
from roi_pool import RoIPool # noqa: E402, isort:skip
feat = torch.randn(4, 16, 15, 15, requires_grad=True).cuda()
rois = torch.Tensor([[0, 0, 0, 50, 50], [0, 10, 30, 43, 55]... | python | Apache-2.0 | 321a207c499a3f6b260fa2e0644ef90a5d996ddc | 2026-01-05T07:09:22.326240Z | false |
hdjang/Feature-Selective-Anchor-Free-Module-for-Single-Shot-Object-Detection | https://github.com/hdjang/Feature-Selective-Anchor-Free-Module-for-Single-Shot-Object-Detection/blob/321a207c499a3f6b260fa2e0644ef90a5d996ddc/mmdet/ops/roi_pool/roi_pool.py | mmdet/ops/roi_pool/roi_pool.py | 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 . import roi_pool_cuda
class RoIPoolFunction(Function):
@staticmethod
def forward(ctx, features, rois, out_size, spatial_scale):
... | python | Apache-2.0 | 321a207c499a3f6b260fa2e0644ef90a5d996ddc | 2026-01-05T07:09:22.326240Z | false |
hdjang/Feature-Selective-Anchor-Free-Module-for-Single-Shot-Object-Detection | https://github.com/hdjang/Feature-Selective-Anchor-Free-Module-for-Single-Shot-Object-Detection/blob/321a207c499a3f6b260fa2e0644ef90a5d996ddc/mmdet/ops/dcn/deform_conv.py | mmdet/ops/dcn/deform_conv.py | 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 . import deform_conv_cuda
class DeformConvFunction(Function):
@staticmethod
def forward(ctx,
input,
... | python | Apache-2.0 | 321a207c499a3f6b260fa2e0644ef90a5d996ddc | 2026-01-05T07:09:22.326240Z | false |
hdjang/Feature-Selective-Anchor-Free-Module-for-Single-Shot-Object-Detection | https://github.com/hdjang/Feature-Selective-Anchor-Free-Module-for-Single-Shot-Object-Detection/blob/321a207c499a3f6b260fa2e0644ef90a5d996ddc/mmdet/ops/dcn/deform_pool.py | mmdet/ops/dcn/deform_pool.py | 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 . import deform_pool_cuda
class DeformRoIPoolingFunction(Function):
@staticmethod
def forward(ctx,
data,
... | python | Apache-2.0 | 321a207c499a3f6b260fa2e0644ef90a5d996ddc | 2026-01-05T07:09:22.326240Z | false |
hdjang/Feature-Selective-Anchor-Free-Module-for-Single-Shot-Object-Detection | https://github.com/hdjang/Feature-Selective-Anchor-Free-Module-for-Single-Shot-Object-Detection/blob/321a207c499a3f6b260fa2e0644ef90a5d996ddc/mmdet/ops/dcn/__init__.py | mmdet/ops/dcn/__init__.py | from .deform_conv import (DeformConv, DeformConvPack, ModulatedDeformConv,
ModulatedDeformConvPack, deform_conv,
modulated_deform_conv)
from .deform_pool import (DeformRoIPooling, DeformRoIPoolingPack,
ModulatedDeformRoIPoolingPack, deform_ro... | python | Apache-2.0 | 321a207c499a3f6b260fa2e0644ef90a5d996ddc | 2026-01-05T07:09:22.326240Z | false |
hdjang/Feature-Selective-Anchor-Free-Module-for-Single-Shot-Object-Detection | https://github.com/hdjang/Feature-Selective-Anchor-Free-Module-for-Single-Shot-Object-Detection/blob/321a207c499a3f6b260fa2e0644ef90a5d996ddc/mmdet/ops/masked_conv/masked_conv.py | mmdet/ops/masked_conv/masked_conv.py | 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 . import masked_conv2d_cuda
class MaskedConv2dFunction(Function):
@staticmethod
def forward(ctx, features, mask, weight, b... | python | Apache-2.0 | 321a207c499a3f6b260fa2e0644ef90a5d996ddc | 2026-01-05T07:09:22.326240Z | false |
hdjang/Feature-Selective-Anchor-Free-Module-for-Single-Shot-Object-Detection | https://github.com/hdjang/Feature-Selective-Anchor-Free-Module-for-Single-Shot-Object-Detection/blob/321a207c499a3f6b260fa2e0644ef90a5d996ddc/mmdet/ops/masked_conv/__init__.py | mmdet/ops/masked_conv/__init__.py | from .masked_conv import MaskedConv2d, masked_conv2d
__all__ = ['masked_conv2d', 'MaskedConv2d']
| python | Apache-2.0 | 321a207c499a3f6b260fa2e0644ef90a5d996ddc | 2026-01-05T07:09:22.326240Z | false |
hdjang/Feature-Selective-Anchor-Free-Module-for-Single-Shot-Object-Detection | https://github.com/hdjang/Feature-Selective-Anchor-Free-Module-for-Single-Shot-Object-Detection/blob/321a207c499a3f6b260fa2e0644ef90a5d996ddc/demo/webcam_demo.py | demo/webcam_demo.py | import argparse
import cv2
import torch
from mmdet.apis import inference_detector, init_detector, show_result
def parse_args():
parser = argparse.ArgumentParser(description='MMDetection webcam demo')
parser.add_argument('config', help='test config file path')
parser.add_argument('checkpoint', help='chec... | python | Apache-2.0 | 321a207c499a3f6b260fa2e0644ef90a5d996ddc | 2026-01-05T07:09:22.326240Z | false |
ildoonet/unsupervised-data-augmentation | https://github.com/ildoonet/unsupervised-data-augmentation/blob/a2356e4af6b84f56740796d461719229cedc61fd/metrics.py | metrics.py | import copy
import torch
from collections import defaultdict
from torch import nn
def accuracy(output, target, topk=(1,)):
"""Computes the precision@k for the specified values of k"""
maxk = max(topk)
batch_size = target.size(0)
_, pred = output.topk(maxk, 1, True, True)
pred = pred.t()
cor... | python | Apache-2.0 | a2356e4af6b84f56740796d461719229cedc61fd | 2026-01-05T07:09:24.034474Z | false |
ildoonet/unsupervised-data-augmentation | https://github.com/ildoonet/unsupervised-data-augmentation/blob/a2356e4af6b84f56740796d461719229cedc61fd/train.py | train.py | import itertools
import logging
import math
import os
from collections import OrderedDict
import torch
from torch import nn, optim
from torch.nn.functional import kl_div, softmax, log_softmax
from tqdm import tqdm
from theconf import Config as C, ConfigArgumentParser
from common import get_logger
from data import ge... | python | Apache-2.0 | a2356e4af6b84f56740796d461719229cedc61fd | 2026-01-05T07:09:24.034474Z | false |
ildoonet/unsupervised-data-augmentation | https://github.com/ildoonet/unsupervised-data-augmentation/blob/a2356e4af6b84f56740796d461719229cedc61fd/common.py | common.py | import logging
formatter = logging.Formatter('[%(asctime)s] [%(name)s] [%(levelname)s] %(message)s')
def get_logger(name, level=logging.DEBUG):
logger = logging.getLogger(name)
logger.handlers.clear()
logger.setLevel(level)
ch = logging.StreamHandler()
ch.setLevel(level)
ch.setFormatter(forma... | python | Apache-2.0 | a2356e4af6b84f56740796d461719229cedc61fd | 2026-01-05T07:09:24.034474Z | false |
ildoonet/unsupervised-data-augmentation | https://github.com/ildoonet/unsupervised-data-augmentation/blob/a2356e4af6b84f56740796d461719229cedc61fd/archive.py | archive.py | from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from collections import defaultdict
from augmentations import get_augment
def autoaug2arsaug(f):
def autoaug():
mapper = defaultdict(lambda: lambda x: x)
mapper.update({
'Shea... | python | Apache-2.0 | a2356e4af6b84f56740796d461719229cedc61fd | 2026-01-05T07:09:24.034474Z | true |
ildoonet/unsupervised-data-augmentation | https://github.com/ildoonet/unsupervised-data-augmentation/blob/a2356e4af6b84f56740796d461719229cedc61fd/augmentations.py | augmentations.py | # code in this file is adpated from rpmcruz/autoaugment
# https://github.com/rpmcruz/autoaugment/blob/master/transformations.py
import random
import PIL, PIL.ImageOps, PIL.ImageEnhance, PIL.ImageDraw
import numpy as np
random_mirror = True
def ShearX(img, v): # [-0.3, 0.3]
assert -0.3 <= v <= 0.3
if random... | python | Apache-2.0 | a2356e4af6b84f56740796d461719229cedc61fd | 2026-01-05T07:09:24.034474Z | false |
ildoonet/unsupervised-data-augmentation | https://github.com/ildoonet/unsupervised-data-augmentation/blob/a2356e4af6b84f56740796d461719229cedc61fd/data.py | data.py | import logging
import os
import numpy as np
import torch
import torchvision
from PIL import Image
from torch.utils.data import SubsetRandomSampler, Subset, Dataset
from torchvision.transforms import transforms
from sklearn.model_selection import StratifiedShuffleSplit
from theconf import Config as C
from archive impo... | python | Apache-2.0 | a2356e4af6b84f56740796d461719229cedc61fd | 2026-01-05T07:09:24.034474Z | false |
ildoonet/unsupervised-data-augmentation | https://github.com/ildoonet/unsupervised-data-augmentation/blob/a2356e4af6b84f56740796d461719229cedc61fd/samplers/stratified_sampler.py | samplers/stratified_sampler.py | import random
from collections import defaultdict
from torch.utils.data import Sampler
class StratifiedSampler(Sampler):
def __init__(self, labels):
self.idx_by_lb = defaultdict(list)
for idx, lb in enumerate(labels):
self.idx_by_lb[lb].append(idx)
self.size = len(labels)
... | python | Apache-2.0 | a2356e4af6b84f56740796d461719229cedc61fd | 2026-01-05T07:09:24.034474Z | false |
ildoonet/unsupervised-data-augmentation | https://github.com/ildoonet/unsupervised-data-augmentation/blob/a2356e4af6b84f56740796d461719229cedc61fd/samplers/__init__.py | samplers/__init__.py | python | Apache-2.0 | a2356e4af6b84f56740796d461719229cedc61fd | 2026-01-05T07:09:24.034474Z | false | |
ildoonet/unsupervised-data-augmentation | https://github.com/ildoonet/unsupervised-data-augmentation/blob/a2356e4af6b84f56740796d461719229cedc61fd/networks/wideresnet.py | networks/wideresnet.py | import torch.nn as nn
import torch.nn.init as init
import torch.nn.functional as F
import numpy as np
bn_momentum = 0.9
def conv3x3(in_planes, out_planes, stride=1):
return nn.Conv2d(in_planes, out_planes, kernel_size=3, stride=stride, padding=1, bias=True)
def conv_init(m):
classname = m.__class__.__name... | python | Apache-2.0 | a2356e4af6b84f56740796d461719229cedc61fd | 2026-01-05T07:09:24.034474Z | false |
ildoonet/unsupervised-data-augmentation | https://github.com/ildoonet/unsupervised-data-augmentation/blob/a2356e4af6b84f56740796d461719229cedc61fd/networks/__init__.py | networks/__init__.py | import torch
from pretrainedmodels import models
from torch import nn
from torch.nn import DataParallel
import torch.backends.cudnn as cudnn
from networks.wideresnet import WideResNet
def get_model(conf, num_class=10, data_parallel=True):
name = conf['type']
if name == 'wresnet40_2':
model = WideRe... | python | Apache-2.0 | a2356e4af6b84f56740796d461719229cedc61fd | 2026-01-05T07:09:24.034474Z | false |
evanspearman/ComfyMath | https://github.com/evanspearman/ComfyMath/blob/c01177221c31b8e5fbc062778fc8254aeb541638/__init__.py | __init__.py | from .src.comfymath.convert import NODE_CLASS_MAPPINGS as convert_NCM
from .src.comfymath.bool import NODE_CLASS_MAPPINGS as bool_NCM
from .src.comfymath.int import NODE_CLASS_MAPPINGS as int_NCM
from .src.comfymath.float import NODE_CLASS_MAPPINGS as float_NCM
from .src.comfymath.number import NODE_CLASS_MAPPINGS as n... | python | Apache-2.0 | c01177221c31b8e5fbc062778fc8254aeb541638 | 2026-01-05T07:09:23.629655Z | false |
evanspearman/ComfyMath | https://github.com/evanspearman/ComfyMath/blob/c01177221c31b8e5fbc062778fc8254aeb541638/src/comfymath/float.py | src/comfymath/float.py | import math
from typing import Any, Callable, Mapping
DEFAULT_FLOAT = ("FLOAT", {"default": 0.0, "step": 0.001, "round": False})
FLOAT_UNARY_OPERATIONS: Mapping[str, Callable[[float], float]] = {
"Neg": lambda a: -a,
"Inc": lambda a: a + 1,
"Dec": lambda a: a - 1,
"Abs": lambda a: abs(a),
"Sqr": ... | python | Apache-2.0 | c01177221c31b8e5fbc062778fc8254aeb541638 | 2026-01-05T07:09:23.629655Z | false |
evanspearman/ComfyMath | https://github.com/evanspearman/ComfyMath/blob/c01177221c31b8e5fbc062778fc8254aeb541638/src/comfymath/control.py | src/comfymath/control.py | from typing import Any, Mapping
NODE_CLASS_MAPPINGS: Mapping[str, Any] = {}
| python | Apache-2.0 | c01177221c31b8e5fbc062778fc8254aeb541638 | 2026-01-05T07:09:23.629655Z | false |
evanspearman/ComfyMath | https://github.com/evanspearman/ComfyMath/blob/c01177221c31b8e5fbc062778fc8254aeb541638/src/comfymath/convert.py | src/comfymath/convert.py | from typing import Any, Mapping
from .vec import VEC2_ZERO, VEC3_ZERO, VEC4_ZERO
from .types import Number, Vec2, Vec3, Vec4
class BoolToInt:
@classmethod
def INPUT_TYPES(cls) -> Mapping[str, Any]:
return {"required": {"a": ("BOOLEAN", {"default": False})}}
RETURN_TYPES = ("INT",)
FUNCTION =... | python | Apache-2.0 | c01177221c31b8e5fbc062778fc8254aeb541638 | 2026-01-05T07:09:23.629655Z | false |
evanspearman/ComfyMath | https://github.com/evanspearman/ComfyMath/blob/c01177221c31b8e5fbc062778fc8254aeb541638/src/comfymath/number.py | src/comfymath/number.py | from dataclasses import dataclass
from typing import Any, Callable, Mapping
from .float import (
FLOAT_UNARY_OPERATIONS,
FLOAT_UNARY_CONDITIONS,
FLOAT_BINARY_OPERATIONS,
FLOAT_BINARY_CONDITIONS,
)
from .types import Number
DEFAULT_NUMBER = ("NUMBER", {"default": 0.0})
class NumberUnaryOperation:
... | python | Apache-2.0 | c01177221c31b8e5fbc062778fc8254aeb541638 | 2026-01-05T07:09:23.629655Z | false |
evanspearman/ComfyMath | https://github.com/evanspearman/ComfyMath/blob/c01177221c31b8e5fbc062778fc8254aeb541638/src/comfymath/bool.py | src/comfymath/bool.py | from typing import Any, Callable, Mapping
DEFAULT_BOOL = ("BOOLEAN", {"default": False})
BOOL_UNARY_OPERATIONS: Mapping[str, Callable[[bool], bool]] = {
"Not": lambda a: not a,
}
BOOL_BINARY_OPERATIONS: Mapping[str, Callable[[bool, bool], bool]] = {
"Nor": lambda a, b: not (a or b),
"Xor": lambda a, b: ... | python | Apache-2.0 | c01177221c31b8e5fbc062778fc8254aeb541638 | 2026-01-05T07:09:23.629655Z | false |
evanspearman/ComfyMath | https://github.com/evanspearman/ComfyMath/blob/c01177221c31b8e5fbc062778fc8254aeb541638/src/comfymath/graphics.py | src/comfymath/graphics.py | from abc import ABC, abstractmethod
from typing import Any, Mapping, Sequence, Tuple
SDXL_SUPPORTED_RESOLUTIONS = [
(1024, 1024, 1.0),
(1152, 896, 1.2857142857142858),
(896, 1152, 0.7777777777777778),
(1216, 832, 1.4615384615384615),
(832, 1216, 0.6842105263157895),
(1344, 768, 1.75),
(768... | python | Apache-2.0 | c01177221c31b8e5fbc062778fc8254aeb541638 | 2026-01-05T07:09:23.629655Z | false |
evanspearman/ComfyMath | https://github.com/evanspearman/ComfyMath/blob/c01177221c31b8e5fbc062778fc8254aeb541638/src/comfymath/__init__.py | src/comfymath/__init__.py | python | Apache-2.0 | c01177221c31b8e5fbc062778fc8254aeb541638 | 2026-01-05T07:09:23.629655Z | false | |
evanspearman/ComfyMath | https://github.com/evanspearman/ComfyMath/blob/c01177221c31b8e5fbc062778fc8254aeb541638/src/comfymath/types.py | src/comfymath/types.py | import sys
if sys.version_info[1] < 10:
from typing import Tuple, Union
Number = Union[int, float]
Vec2 = Tuple[float, float]
Vec3 = Tuple[float, float, float]
Vec4 = Tuple[float, float, float, float]
else:
from typing import TypeAlias
Number: TypeAlias = int | float
Vec2: TypeAlias =... | python | Apache-2.0 | c01177221c31b8e5fbc062778fc8254aeb541638 | 2026-01-05T07:09:23.629655Z | false |
evanspearman/ComfyMath | https://github.com/evanspearman/ComfyMath/blob/c01177221c31b8e5fbc062778fc8254aeb541638/src/comfymath/vec.py | src/comfymath/vec.py | import numpy
from typing import Any, Callable, Mapping
from .types import Vec2, Vec3, Vec4
VEC2_ZERO = (0.0, 0.0)
DEFAULT_VEC2 = ("VEC2", {"default": VEC2_ZERO})
VEC3_ZERO = (0.0, 0.0, 0.0)
DEFAULT_VEC3 = ("VEC3", {"default": VEC3_ZERO})
VEC4_ZERO = (0.0, 0.0, 0.0, 0.0)
DEFAULT_VEC4 = ("VEC4", {"default": VEC4_ZER... | python | Apache-2.0 | c01177221c31b8e5fbc062778fc8254aeb541638 | 2026-01-05T07:09:23.629655Z | false |
evanspearman/ComfyMath | https://github.com/evanspearman/ComfyMath/blob/c01177221c31b8e5fbc062778fc8254aeb541638/src/comfymath/int.py | src/comfymath/int.py | import math
from typing import Any, Callable, Mapping
DEFAULT_INT = ("INT", {"default": 0})
INT_UNARY_OPERATIONS: Mapping[str, Callable[[int], int]] = {
"Abs": lambda a: abs(a),
"Neg": lambda a: -a,
"Inc": lambda a: a + 1,
"Dec": lambda a: a - 1,
"Sqr": lambda a: a * a,
"Cube": lambda a: a * ... | python | Apache-2.0 | c01177221c31b8e5fbc062778fc8254aeb541638 | 2026-01-05T07:09:23.629655Z | false |
realminchoi/babyagi-ui | https://github.com/realminchoi/babyagi-ui/blob/5ab0f7832f7e764c40a498bc9107912b3b585947/babyagi.py | babyagi.py | from collections import deque
from typing import Dict, List, Optional
from langchain import LLMChain, OpenAI, PromptTemplate
from langchain.embeddings import HuggingFaceEmbeddings
from langchain.llms import BaseLLM
from langchain.vectorstores import FAISS
from langchain.vectorstores.base import VectorStore
from pydanti... | python | MIT | 5ab0f7832f7e764c40a498bc9107912b3b585947 | 2026-01-05T07:09:24.708449Z | false |
lucidrains/improving-transformers-world-model-for-rl | https://github.com/lucidrains/improving-transformers-world-model-for-rl/blob/c1b2007a94dbe52bd1ffcabaf893f0a23581f9e6/tests/test_agent.py | tests/test_agent.py | import pytest
import torch
from improving_transformers_world_model import (
WorldModel,
Agent,
Impala
)
from improving_transformers_world_model.mock_env import Env
device = torch.device('cuda' if torch.cuda.is_available() else 'cpu')
@pytest.mark.parametrize('critic_use_regression', (False, True))
@pyte... | python | MIT | c1b2007a94dbe52bd1ffcabaf893f0a23581f9e6 | 2026-01-05T07:09:25.199514Z | false |
lucidrains/improving-transformers-world-model-for-rl | https://github.com/lucidrains/improving-transformers-world-model-for-rl/blob/c1b2007a94dbe52bd1ffcabaf893f0a23581f9e6/improving_transformers_world_model/world_model.py | improving_transformers_world_model/world_model.py | from __future__ import annotations
from math import ceil
from functools import wraps
import torch
import torch.nn.functional as F
from torch import nn, tensor, is_tensor, cdist, cat
from torch.nn import Module, ModuleList, Linear
from torch.utils._pytree import tree_map, tree_flatten, tree_unflatten
from vector_quan... | python | MIT | c1b2007a94dbe52bd1ffcabaf893f0a23581f9e6 | 2026-01-05T07:09:25.199514Z | false |
lucidrains/improving-transformers-world-model-for-rl | https://github.com/lucidrains/improving-transformers-world-model-for-rl/blob/c1b2007a94dbe52bd1ffcabaf893f0a23581f9e6/improving_transformers_world_model/mock_env.py | improving_transformers_world_model/mock_env.py | from __future__ import annotations
import torch
from torch import tensor
from torch.nn import Module
from improving_transformers_world_model.tensor_typing import (
Float,
Int,
Bool
)
# constants
FrameState = Float['c h w']
Scalar = Float['']
# mock env
class Env(Module):
def __init__(
self... | python | MIT | c1b2007a94dbe52bd1ffcabaf893f0a23581f9e6 | 2026-01-05T07:09:25.199514Z | false |
lucidrains/improving-transformers-world-model-for-rl | https://github.com/lucidrains/improving-transformers-world-model-for-rl/blob/c1b2007a94dbe52bd1ffcabaf893f0a23581f9e6/improving_transformers_world_model/distributed.py | improving_transformers_world_model/distributed.py | import torch
from torch import nn
from torch.nn import Module
import torch.nn.functional as F
from torch.autograd import Function
import torch.distributed as dist
import einx
def exists(val):
return val is not None
def default(val, d):
return val if exists(val) else d
def divisible_by(num, den):
return ... | python | MIT | c1b2007a94dbe52bd1ffcabaf893f0a23581f9e6 | 2026-01-05T07:09:25.199514Z | false |
lucidrains/improving-transformers-world-model-for-rl | https://github.com/lucidrains/improving-transformers-world-model-for-rl/blob/c1b2007a94dbe52bd1ffcabaf893f0a23581f9e6/improving_transformers_world_model/__init__.py | improving_transformers_world_model/__init__.py | from improving_transformers_world_model.world_model import (
BlockCausalAttention,
BlockCausalTransformer,
NearestNeighborTokenizer,
WorldModel
)
from improving_transformers_world_model.agent import (
Agent,
Impala
)
| python | MIT | c1b2007a94dbe52bd1ffcabaf893f0a23581f9e6 | 2026-01-05T07:09:25.199514Z | false |
lucidrains/improving-transformers-world-model-for-rl | https://github.com/lucidrains/improving-transformers-world-model-for-rl/blob/c1b2007a94dbe52bd1ffcabaf893f0a23581f9e6/improving_transformers_world_model/agent.py | improving_transformers_world_model/agent.py | from __future__ import annotations
from typing import NamedTuple, Deque
from collections import deque
import torch
from torch import nn, cat, stack, is_tensor, tensor, Tensor
from torch.nn import Module, ModuleList, GRU
import torch.nn.functional as F
from torch.utils.data import TensorDataset, ConcatDataset, DataLoa... | python | MIT | c1b2007a94dbe52bd1ffcabaf893f0a23581f9e6 | 2026-01-05T07:09:25.199514Z | false |
lucidrains/improving-transformers-world-model-for-rl | https://github.com/lucidrains/improving-transformers-world-model-for-rl/blob/c1b2007a94dbe52bd1ffcabaf893f0a23581f9e6/improving_transformers_world_model/tensor_typing.py | improving_transformers_world_model/tensor_typing.py | import jaxtyping
from torch import Tensor
class TorchTyping:
def __init__(self, abstract_dtype):
self.abstract_dtype = abstract_dtype
def __getitem__(self, shapes: str):
return self.abstract_dtype[Tensor, shapes]
Float = TorchTyping(jaxtyping.Float)
Int = TorchTyping(jaxtyping.Int)
Bool = ... | python | MIT | c1b2007a94dbe52bd1ffcabaf893f0a23581f9e6 | 2026-01-05T07:09:25.199514Z | false |
hpthreatresearch/subcrawl | https://github.com/hpthreatresearch/subcrawl/blob/54e4f79cfe428c97f6e959112bf8dea9ce4922d6/crawler/subcrawl.py | crawler/subcrawl.py | # © Copyright 2021 HP Development Company, L.P.
import argparse
import base64
import datetime
import hashlib
import inspect
import io
import json
import os
import re
import sys
import time
from concurrent.futures import ProcessPoolExecutor
from io import BytesIO
from multiprocessing import Pool, cpu_count
from urllib.p... | python | MIT | 54e4f79cfe428c97f6e959112bf8dea9ce4922d6 | 2026-01-05T07:09:22.940535Z | false |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.