feat(semantics): add portable annotation, learning and review contracts
Add portable corpus, annotation provenance, admission, review and bounded agent-cycle contracts. Preserve dataset ownership and explicit research acceptance limits.
This commit is contained in:
@@ -0,0 +1,22 @@
|
||||
"""Exact D4 training transforms; no RNG, interpolation or new supervision."""
|
||||
import numpy as np
|
||||
|
||||
|
||||
def permute_training_pair(rgb, target, element):
|
||||
"""Rotate counterclockwise element%4 times, then reflect if element>=4.
|
||||
|
||||
Input must already be a square crop/padded tile. This is training-only:
|
||||
scene-coordinate metadata is not transformed or exported by this function.
|
||||
"""
|
||||
if (type(element) is not int or not 0 <= element < 8
|
||||
or not isinstance(rgb, np.ndarray) or not isinstance(target, np.ndarray)
|
||||
or target.ndim != 2 or rgb.shape != (*target.shape, 3)
|
||||
or not target.shape[0] or target.shape[0] != target.shape[1]
|
||||
or rgb.dtype != np.uint8 or target.dtype != np.uint8
|
||||
or not np.isin(target, [0, 1, 255]).all()):
|
||||
raise ValueError("Square uint8 RGB/0,1,255 target and D4 integer 0..7 required")
|
||||
image = np.rot90(rgb, element % 4, axes=(0, 1))
|
||||
labels = np.rot90(target, element % 4, axes=(0, 1))
|
||||
if element >= 4:
|
||||
image, labels = image[:, ::-1], labels[:, ::-1]
|
||||
return image.copy(order="C"), labels.copy(order="C")
|
||||
Reference in New Issue
Block a user