code-loader 0.2.65__tar.gz → 0.2.67__tar.gz
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.
- {code_loader-0.2.65 → code_loader-0.2.67}/PKG-INFO +1 -1
- {code_loader-0.2.65 → code_loader-0.2.67}/code_loader/helpers/detection/yolo/loss.py +4 -3
- {code_loader-0.2.65 → code_loader-0.2.67}/code_loader/helpers/detection/yolo/pytorch_utils.py +1 -1
- {code_loader-0.2.65 → code_loader-0.2.67}/pyproject.toml +1 -1
- {code_loader-0.2.65 → code_loader-0.2.67}/LICENSE +0 -0
- {code_loader-0.2.65 → code_loader-0.2.67}/README.md +0 -0
- {code_loader-0.2.65 → code_loader-0.2.67}/code_loader/__init__.py +0 -0
- {code_loader-0.2.65 → code_loader-0.2.67}/code_loader/contract/__init__.py +0 -0
- {code_loader-0.2.65 → code_loader-0.2.67}/code_loader/contract/datasetclasses.py +0 -0
- {code_loader-0.2.65 → code_loader-0.2.67}/code_loader/contract/enums.py +0 -0
- {code_loader-0.2.65 → code_loader-0.2.67}/code_loader/contract/exceptions.py +0 -0
- {code_loader-0.2.65 → code_loader-0.2.67}/code_loader/contract/responsedataclasses.py +0 -0
- {code_loader-0.2.65 → code_loader-0.2.67}/code_loader/contract/visualizer_classes.py +0 -0
- {code_loader-0.2.65 → code_loader-0.2.67}/code_loader/helpers/__init__.py +0 -0
- {code_loader-0.2.65 → code_loader-0.2.67}/code_loader/helpers/detection/__init__.py +0 -0
- {code_loader-0.2.65 → code_loader-0.2.67}/code_loader/helpers/detection/utils.py +0 -0
- {code_loader-0.2.65 → code_loader-0.2.67}/code_loader/helpers/detection/yolo/__init__.py +0 -0
- {code_loader-0.2.65 → code_loader-0.2.67}/code_loader/helpers/detection/yolo/decoder.py +0 -0
- {code_loader-0.2.65 → code_loader-0.2.67}/code_loader/helpers/detection/yolo/grid.py +0 -0
- {code_loader-0.2.65 → code_loader-0.2.67}/code_loader/helpers/detection/yolo/utils.py +0 -0
- {code_loader-0.2.65 → code_loader-0.2.67}/code_loader/leap_binder/__init__.py +0 -0
- {code_loader-0.2.65 → code_loader-0.2.67}/code_loader/leap_binder/leapbinder.py +0 -0
- {code_loader-0.2.65 → code_loader-0.2.67}/code_loader/leaploader.py +0 -0
- {code_loader-0.2.65 → code_loader-0.2.67}/code_loader/metrics/__init__.py +0 -0
- {code_loader-0.2.65 → code_loader-0.2.67}/code_loader/metrics/default_metrics.py +0 -0
- {code_loader-0.2.65 → code_loader-0.2.67}/code_loader/utils.py +0 -0
- {code_loader-0.2.65 → code_loader-0.2.67}/code_loader/visualizers/__init__.py +0 -0
- {code_loader-0.2.65 → code_loader-0.2.67}/code_loader/visualizers/default_visualizers.py +0 -0
@@ -165,13 +165,13 @@ class YoloLoss:
|
|
165
165
|
gj: List[torch.Tensor], gi: List[torch.Tensor],
|
166
166
|
target: List[torch.Tensor]) -> Tuple[tf.Tensor, tf.Tensor]:
|
167
167
|
# temp
|
168
|
+
assert self.anchors is not None
|
168
169
|
gt_class = tf.ones((batch_size,
|
169
|
-
|
170
|
+
self.anchors.shape[1], *self.feature_maps[i]), dtype=tf.int32) * self.background_label
|
170
171
|
if len(b[i]) > 0:
|
171
172
|
gt_class = tf.tensor_scatter_nd_update(gt_class, torch.stack([b[i], a[i], gj[i], gi[i]]).T.numpy(),
|
172
173
|
target[i][:, 1])
|
173
174
|
conf_t_tensor = tf.reshape(gt_class, [gt_class.shape[0], -1])
|
174
|
-
assert self.anchors is not None
|
175
175
|
gt_loc = tf.zeros((batch_size, len(self.anchors[i]), *self.feature_maps[i], 4), dtype=tf.float32)
|
176
176
|
if len(b[i]) > 0:
|
177
177
|
gt_loc = tf.tensor_scatter_nd_update(gt_loc, torch.stack([b[i], a[i], gj[i], gi[i]]).T.numpy(),
|
@@ -181,6 +181,7 @@ class YoloLoss:
|
|
181
181
|
|
182
182
|
def get_yolo_match(self, batch_size: int, y_true: tf.Tensor, loc_data: List[tf.Tensor], conf_data: List[tf.Tensor]) \
|
183
183
|
-> Tuple[List[torch.Tensor], ...]:
|
184
|
+
assert self.anchors is not None
|
184
185
|
yolo_targets: List[NDArray[np.float32]] = []
|
185
186
|
scales_num = len(loc_data)
|
186
187
|
for i in range(batch_size):
|
@@ -189,7 +190,7 @@ class YoloLoss:
|
|
189
190
|
yolo_targets_cat: NDArray[np.float32] = np.concatenate(yolo_targets, axis=0)
|
190
191
|
orig_pred = [torch.from_numpy(tf.concat([loc_data[i], conf_data[i]], axis=-1).numpy()) for i in
|
191
192
|
range(scales_num)]
|
192
|
-
fin_pred = [pred.reshape([pred.shape[0],
|
193
|
+
fin_pred = [pred.reshape([pred.shape[0], self.anchors.shape[1], *self.feature_maps[i], -1]) for i, pred in
|
193
194
|
enumerate(orig_pred)]
|
194
195
|
yolo_anchors = np.array(self.anchors) * np.swapaxes(np.array([*self.feature_maps])[..., None], 1, 2) / 640
|
195
196
|
b, a, gj, gi, target, anch = build_targets(fin_pred, torch.from_numpy(yolo_targets_cat.astype(np.float32)),
|
{code_loader-0.2.65 → code_loader-0.2.67}/code_loader/helpers/detection/yolo/pytorch_utils.py
RENAMED
@@ -12,7 +12,7 @@ def find_3_positive(p: List[torch.Tensor], targets: torch.Tensor, anchors: torch
|
|
12
12
|
# p.shape = [B,3, GX, GW, 5+CLASSES]
|
13
13
|
# targers.shape = [B,6=[image, class, x, y, w, h,]]
|
14
14
|
# targets=torch.from_numpy(truths.numpy())
|
15
|
-
na, nt = anchors.shape[
|
15
|
+
na, nt = anchors.shape[1], targets.shape[0] # number of anchors, targets
|
16
16
|
indices, anch = [], []
|
17
17
|
gain = torch.ones(7, device=targets.device).long() # normalized to gridspace gain
|
18
18
|
ai = torch.arange(na, device=targets.device).float().view(na, 1).repeat(1, nt) # same as .repeat_interleave(nt)
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|