birder 0.2.2__py3-none-any.whl → 0.2.3__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- birder/common/lib.py +2 -9
- birder/common/training_cli.py +18 -0
- birder/common/training_utils.py +123 -10
- birder/data/collators/detection.py +10 -3
- birder/data/datasets/coco.py +8 -10
- birder/data/transforms/detection.py +30 -13
- birder/inference/detection.py +108 -4
- birder/inference/wbf.py +226 -0
- birder/net/__init__.py +8 -0
- birder/net/detection/efficientdet.py +65 -86
- birder/net/detection/rt_detr_v1.py +1 -0
- birder/net/detection/yolo_anchors.py +205 -0
- birder/net/detection/yolo_v2.py +25 -24
- birder/net/detection/yolo_v3.py +39 -40
- birder/net/detection/yolo_v4.py +28 -26
- birder/net/detection/yolo_v4_tiny.py +24 -20
- birder/net/fasternet.py +1 -1
- birder/net/gc_vit.py +671 -0
- birder/net/lit_v1.py +472 -0
- birder/net/lit_v1_tiny.py +342 -0
- birder/net/lit_v2.py +436 -0
- birder/net/mobilenet_v4_hybrid.py +1 -1
- birder/net/resnet_v1.py +1 -1
- birder/net/resnext.py +67 -25
- birder/net/se_resnet_v1.py +46 -0
- birder/net/se_resnext.py +3 -0
- birder/net/simple_vit.py +2 -2
- birder/net/vit.py +0 -15
- birder/net/vovnet_v2.py +31 -1
- birder/scripts/benchmark.py +90 -21
- birder/scripts/predict.py +1 -0
- birder/scripts/predict_detection.py +18 -11
- birder/scripts/train.py +10 -34
- birder/scripts/train_barlow_twins.py +10 -34
- birder/scripts/train_byol.py +10 -34
- birder/scripts/train_capi.py +10 -35
- birder/scripts/train_data2vec.py +9 -34
- birder/scripts/train_data2vec2.py +9 -34
- birder/scripts/train_detection.py +48 -40
- birder/scripts/train_dino_v1.py +10 -34
- birder/scripts/train_dino_v2.py +9 -34
- birder/scripts/train_dino_v2_dist.py +9 -34
- birder/scripts/train_franca.py +9 -34
- birder/scripts/train_i_jepa.py +9 -34
- birder/scripts/train_ibot.py +9 -34
- birder/scripts/train_kd.py +156 -64
- birder/scripts/train_mim.py +10 -34
- birder/scripts/train_mmcr.py +10 -34
- birder/scripts/train_rotnet.py +10 -34
- birder/scripts/train_simclr.py +10 -34
- birder/scripts/train_vicreg.py +10 -34
- birder/tools/auto_anchors.py +20 -1
- birder/tools/pack.py +172 -103
- birder/tools/show_det_iterator.py +10 -1
- birder/version.py +1 -1
- {birder-0.2.2.dist-info → birder-0.2.3.dist-info}/METADATA +3 -3
- {birder-0.2.2.dist-info → birder-0.2.3.dist-info}/RECORD +61 -55
- {birder-0.2.2.dist-info → birder-0.2.3.dist-info}/WHEEL +0 -0
- {birder-0.2.2.dist-info → birder-0.2.3.dist-info}/entry_points.txt +0 -0
- {birder-0.2.2.dist-info → birder-0.2.3.dist-info}/licenses/LICENSE +0 -0
- {birder-0.2.2.dist-info → birder-0.2.3.dist-info}/top_level.txt +0 -0
|
@@ -15,18 +15,13 @@ import torch
|
|
|
15
15
|
from torch import nn
|
|
16
16
|
from torchvision.ops import Conv2dNormActivation
|
|
17
17
|
|
|
18
|
+
from birder.model_registry import registry
|
|
18
19
|
from birder.net.base import DetectorBackbone
|
|
20
|
+
from birder.net.detection.yolo_anchors import resolve_anchor_groups
|
|
19
21
|
from birder.net.detection.yolo_v3 import YOLOAnchorGenerator
|
|
20
22
|
from birder.net.detection.yolo_v3 import YOLOHead
|
|
21
|
-
from birder.net.detection.yolo_v3 import scale_anchors
|
|
22
23
|
from birder.net.detection.yolo_v4 import YOLO_v4
|
|
23
24
|
|
|
24
|
-
# Default anchors from YOLO v4 Tiny (COCO)
|
|
25
|
-
DEFAULT_ANCHORS = [
|
|
26
|
-
[(10.0, 14.0), (23.0, 27.0), (37.0, 58.0)], # Medium
|
|
27
|
-
[(81.0, 82.0), (135.0, 169.0), (344.0, 319.0)], # Large
|
|
28
|
-
]
|
|
29
|
-
|
|
30
25
|
# Scale factors per detection scale to eliminate grid sensitivity
|
|
31
26
|
DEFAULT_SCALE_XY = [1.05, 1.05] # [medium, large]
|
|
32
27
|
|
|
@@ -92,7 +87,6 @@ class YOLOTinyNeck(nn.Module):
|
|
|
92
87
|
# pylint: disable=invalid-name
|
|
93
88
|
class YOLO_v4_Tiny(YOLO_v4):
|
|
94
89
|
default_size = (416, 416)
|
|
95
|
-
auto_register = True
|
|
96
90
|
|
|
97
91
|
def __init__(
|
|
98
92
|
self,
|
|
@@ -104,22 +98,26 @@ class YOLO_v4_Tiny(YOLO_v4):
|
|
|
104
98
|
export_mode: bool = False,
|
|
105
99
|
) -> None:
|
|
106
100
|
super().__init__(num_classes, backbone, config=config, size=size, export_mode=export_mode)
|
|
107
|
-
assert self.config is None, "
|
|
101
|
+
assert self.config is not None, "must set config"
|
|
108
102
|
|
|
109
103
|
# self.num_classes = self.num_classes - 1 (Subtracted at parent)
|
|
110
104
|
|
|
111
105
|
score_thresh = 0.05
|
|
112
106
|
nms_thresh = 0.45
|
|
113
107
|
detections_per_img = 300
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
self.
|
|
108
|
+
ignore_thresh = 0.7
|
|
109
|
+
noobj_coeff = 0.25
|
|
110
|
+
coord_coeff = 3.0
|
|
111
|
+
obj_coeff = 1.0
|
|
112
|
+
cls_coeff = 1.0
|
|
113
|
+
label_smoothing = 0.1
|
|
114
|
+
anchor_spec = self.config["anchors"]
|
|
115
|
+
|
|
116
|
+
self.ignore_thresh = ignore_thresh
|
|
117
|
+
self.noobj_coeff = noobj_coeff
|
|
118
|
+
self.coord_coeff = coord_coeff
|
|
119
|
+
self.obj_coeff = obj_coeff
|
|
120
|
+
self.cls_coeff = cls_coeff
|
|
123
121
|
self.scale_xy = DEFAULT_SCALE_XY
|
|
124
122
|
self.score_thresh = score_thresh
|
|
125
123
|
self.nms_thresh = nms_thresh
|
|
@@ -128,12 +126,18 @@ class YOLO_v4_Tiny(YOLO_v4):
|
|
|
128
126
|
self.backbone.return_channels = self.backbone.return_channels[-2:]
|
|
129
127
|
self.backbone.return_stages = self.backbone.return_stages[-2:]
|
|
130
128
|
|
|
131
|
-
self.label_smoothing =
|
|
129
|
+
self.label_smoothing = label_smoothing
|
|
132
130
|
self.smooth_positive = 1.0 - self.label_smoothing
|
|
133
131
|
self.smooth_negative = self.label_smoothing / self.num_classes
|
|
134
132
|
|
|
135
133
|
self.neck = YOLOTinyNeck(self.backbone.return_channels)
|
|
136
134
|
|
|
137
|
-
|
|
135
|
+
anchors = resolve_anchor_groups(
|
|
136
|
+
anchor_spec, anchor_format="pixels", model_size=self.size, model_strides=(16, 32)
|
|
137
|
+
)
|
|
138
|
+
self.anchor_generator = YOLOAnchorGenerator(anchors)
|
|
138
139
|
num_anchors = self.anchor_generator.num_anchors_per_location()
|
|
139
140
|
self.head = YOLOHead(self.neck.out_channels, num_anchors, self.num_classes)
|
|
141
|
+
|
|
142
|
+
|
|
143
|
+
registry.register_model_config("yolo_v4_tiny", YOLO_v4_Tiny, config={"anchors": "yolo_v4_tiny"})
|
birder/net/fasternet.py
CHANGED