attr-eomt 2.1.0__tar.gz → 3.1.1__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.
Files changed (113) hide show
  1. {attr_eomt-2.1.0 → attr_eomt-3.1.1}/.github/workflows/prerelease.yml +3 -2
  2. {attr_eomt-2.1.0 → attr_eomt-3.1.1}/.github/workflows/publish.yml +8 -6
  3. {attr_eomt-2.1.0 → attr_eomt-3.1.1}/.github/workflows/release.yml +3 -1
  4. {attr_eomt-2.1.0 → attr_eomt-3.1.1}/.github/workflows/tests.yml +3 -0
  5. {attr_eomt-2.1.0 → attr_eomt-3.1.1}/.gitignore +5 -0
  6. attr_eomt-3.1.1/CHANGELOG.md +228 -0
  7. attr_eomt-3.1.1/PKG-INFO +443 -0
  8. attr_eomt-3.1.1/README.md +402 -0
  9. attr_eomt-3.1.1/eomt/__init__.py +51 -0
  10. attr_eomt-3.1.1/eomt/_log.py +33 -0
  11. attr_eomt-3.1.1/eomt/api.py +454 -0
  12. {attr_eomt-2.1.0 → attr_eomt-3.1.1}/eomt/aux_cls.py +99 -90
  13. {attr_eomt-2.1.0 → attr_eomt-3.1.1}/eomt/box_loss.py +17 -42
  14. {attr_eomt-2.1.0 → attr_eomt-3.1.1}/eomt/config.py +14 -8
  15. attr_eomt-3.1.1/eomt/configs/coco.yaml +10 -0
  16. {attr_eomt-2.1.0 → attr_eomt-3.1.1}/eomt/data/__init__.py +1 -5
  17. {attr_eomt-2.1.0 → attr_eomt-3.1.1}/eomt/data/coco.py +102 -39
  18. {attr_eomt-2.1.0 → attr_eomt-3.1.1}/eomt/data/config.py +20 -19
  19. {attr_eomt-2.1.0 → attr_eomt-3.1.1}/eomt/data/download.py +3 -1
  20. attr_eomt-3.1.1/eomt/data/subjects.py +458 -0
  21. {attr_eomt-2.1.0 → attr_eomt-3.1.1}/eomt/data/transforms.py +154 -27
  22. {attr_eomt-2.1.0 → attr_eomt-3.1.1}/eomt/device.py +5 -3
  23. attr_eomt-3.1.1/eomt/engine/__init__.py +14 -0
  24. {attr_eomt-2.1.0 → attr_eomt-3.1.1}/eomt/engine/distributed.py +19 -0
  25. attr_eomt-3.1.1/eomt/engine/match.py +254 -0
  26. attr_eomt-3.1.1/eomt/engine/predict.py +695 -0
  27. attr_eomt-3.1.1/eomt/engine/train.py +1404 -0
  28. attr_eomt-3.1.1/eomt/engine/validate.py +1105 -0
  29. attr_eomt-3.1.1/eomt/lora.py +84 -0
  30. {attr_eomt-2.1.0 → attr_eomt-3.1.1}/eomt/loss.py +65 -118
  31. attr_eomt-3.1.1/eomt/matcher.py +216 -0
  32. {attr_eomt-2.1.0 → attr_eomt-3.1.1}/eomt/model.py +228 -337
  33. {attr_eomt-2.1.0 → attr_eomt-3.1.1}/eomt/plotting.py +6 -3
  34. {attr_eomt-2.1.0 → attr_eomt-3.1.1}/eomt/postprocess.py +31 -64
  35. attr_eomt-3.1.1/eomt/preprocess.py +303 -0
  36. attr_eomt-3.1.1/eomt/progress.py +72 -0
  37. {attr_eomt-2.1.0 → attr_eomt-3.1.1}/eomt/reid.py +62 -10
  38. attr_eomt-3.1.1/eomt/serialization.py +501 -0
  39. {attr_eomt-2.1.0 → attr_eomt-3.1.1}/eomt/tta.py +22 -8
  40. {attr_eomt-2.1.0/eomt/engine → attr_eomt-3.1.1/examples}/track.py +15 -3
  41. {attr_eomt-2.1.0 → attr_eomt-3.1.1}/pyproject.toml +6 -8
  42. {attr_eomt-2.1.0 → attr_eomt-3.1.1}/sample_data/run.yaml +30 -17
  43. attr_eomt-3.1.1/scripts/export.py +30 -0
  44. {attr_eomt-2.1.0 → attr_eomt-3.1.1}/scripts/info.py +1 -1
  45. attr_eomt-3.1.1/scripts/match.py +47 -0
  46. attr_eomt-3.1.1/scripts/predict.py +41 -0
  47. attr_eomt-3.1.1/scripts/train.py +94 -0
  48. attr_eomt-3.1.1/scripts/val.py +65 -0
  49. {attr_eomt-2.1.0 → attr_eomt-3.1.1}/site/index.html +22 -36
  50. {attr_eomt-2.1.0 → attr_eomt-3.1.1}/tests/test_api.py +46 -14
  51. {attr_eomt-2.1.0 → attr_eomt-3.1.1}/tests/test_architecture.py +171 -152
  52. {attr_eomt-2.1.0 → attr_eomt-3.1.1}/tests/test_augment.py +56 -24
  53. attr_eomt-3.1.1/tests/test_multiview.py +532 -0
  54. {attr_eomt-2.1.0 → attr_eomt-3.1.1}/tests/test_parity.py +11 -6
  55. attr_eomt-3.1.1/tests/test_predict_pipeline.py +225 -0
  56. {attr_eomt-2.1.0 → attr_eomt-3.1.1}/tests/test_recipe.py +20 -25
  57. {attr_eomt-2.1.0 → attr_eomt-3.1.1}/tests/test_regression_attr.py +20 -5
  58. {attr_eomt-2.1.0 → attr_eomt-3.1.1}/tests/test_reid.py +17 -0
  59. attr_eomt-3.1.1/tests/test_review_fixes.py +127 -0
  60. attr_eomt-3.1.1/tests/test_rle_gpu.py +55 -0
  61. {attr_eomt-2.1.0 → attr_eomt-3.1.1}/tests/test_run_config.py +15 -8
  62. {attr_eomt-2.1.0 → attr_eomt-3.1.1}/tests/test_smoke.py +37 -7
  63. {attr_eomt-2.1.0 → attr_eomt-3.1.1}/tests/test_sweep.py +2 -1
  64. attr_eomt-3.1.1/tests/test_train_speed.py +45 -0
  65. {attr_eomt-2.1.0 → attr_eomt-3.1.1}/uv.lock +12 -19
  66. attr_eomt-2.1.0/PKG-INFO +0 -825
  67. attr_eomt-2.1.0/README.md +0 -785
  68. attr_eomt-2.1.0/configs/coco.yaml +0 -10
  69. attr_eomt-2.1.0/configs/xview.yaml +0 -26
  70. attr_eomt-2.1.0/docs/examples/billie_eilish.jpg +0 -0
  71. attr_eomt-2.1.0/docs/examples/rosalia.jpg +0 -0
  72. attr_eomt-2.1.0/docs/examples/taylor_swift.jpg +0 -0
  73. attr_eomt-2.1.0/eomt/__init__.py +0 -63
  74. attr_eomt-2.1.0/eomt/api.py +0 -553
  75. attr_eomt-2.1.0/eomt/compress.py +0 -94
  76. attr_eomt-2.1.0/eomt/data/sets.py +0 -352
  77. attr_eomt-2.1.0/eomt/data/subjects.py +0 -278
  78. attr_eomt-2.1.0/eomt/engine/__init__.py +0 -9
  79. attr_eomt-2.1.0/eomt/engine/match.py +0 -401
  80. attr_eomt-2.1.0/eomt/engine/predict.py +0 -411
  81. attr_eomt-2.1.0/eomt/engine/train.py +0 -1773
  82. attr_eomt-2.1.0/eomt/engine/validate.py +0 -766
  83. attr_eomt-2.1.0/eomt/preprocess.py +0 -144
  84. attr_eomt-2.1.0/eomt/serialization.py +0 -508
  85. attr_eomt-2.1.0/scripts/match.py +0 -83
  86. attr_eomt-2.1.0/scripts/predict.py +0 -45
  87. attr_eomt-2.1.0/scripts/track.py +0 -50
  88. attr_eomt-2.1.0/scripts/train.py +0 -149
  89. attr_eomt-2.1.0/scripts/train_detect_coco.sh +0 -43
  90. attr_eomt-2.1.0/scripts/train_multiview.py +0 -47
  91. attr_eomt-2.1.0/scripts/val.py +0 -88
  92. attr_eomt-2.1.0/tests/test_compress.py +0 -61
  93. attr_eomt-2.1.0/tests/test_hires.py +0 -70
  94. attr_eomt-2.1.0/tests/test_subjects.py +0 -242
  95. attr_eomt-2.1.0/tests/test_xview.py +0 -415
  96. {attr_eomt-2.1.0 → attr_eomt-3.1.1}/.github/workflows/pages.yml +0 -0
  97. {attr_eomt-2.1.0 → attr_eomt-3.1.1}/LICENSE +0 -0
  98. {attr_eomt-2.1.0 → attr_eomt-3.1.1}/docs/assets/00-hero-banner.png +0 -0
  99. {attr_eomt-2.1.0 → attr_eomt-3.1.1}/docs/assets/00-hero-banner.svg +0 -0
  100. {attr_eomt-2.1.0 → attr_eomt-3.1.1}/docs/examples/sample.jpg +0 -0
  101. {attr_eomt-2.1.0 → attr_eomt-3.1.1}/eomt/ema.py +0 -0
  102. {attr_eomt-2.1.0 → attr_eomt-3.1.1}/eomt/visualize.py +0 -0
  103. {attr_eomt-2.1.0 → attr_eomt-3.1.1}/sample_data/README.md +0 -0
  104. {attr_eomt-2.1.0 → attr_eomt-3.1.1}/sample_data/annotations/instances_train.json +0 -0
  105. {attr_eomt-2.1.0 → attr_eomt-3.1.1}/sample_data/annotations/instances_val.json +0 -0
  106. {attr_eomt-2.1.0 → attr_eomt-3.1.1}/sample_data/data.yaml +0 -0
  107. {attr_eomt-2.1.0 → attr_eomt-3.1.1}/sample_data/images/train/.gitkeep +0 -0
  108. {attr_eomt-2.1.0 → attr_eomt-3.1.1}/sample_data/images/val/.gitkeep +0 -0
  109. {attr_eomt-2.1.0 → attr_eomt-3.1.1}/scripts/push_to_hub.py +0 -0
  110. {attr_eomt-2.1.0 → attr_eomt-3.1.1}/tests/test_ddp.py +0 -0
  111. {attr_eomt-2.1.0 → attr_eomt-3.1.1}/tests/test_tta.py +0 -0
  112. {attr_eomt-2.1.0 → attr_eomt-3.1.1}/tools/attr_tagger/README.md +0 -0
  113. {attr_eomt-2.1.0 → attr_eomt-3.1.1}/tools/attr_tagger/tag.py +0 -0
@@ -16,7 +16,8 @@ name: prerelease
16
16
  # (merge to main with the final version).
17
17
  #
18
18
  # NOTE: the PyPI trusted publisher (workflow publish.yml, environment pypi) must accept runs from branches other
19
- # than main: if the `pypi` environment limits its deployment branches, allow these branches (or tags) there.
19
+ # than main: if the `pypi` environment limits its deployment branches, allow the pre-release tags (v*rc*, ...) there,
20
+ # not every branch, and keep Required reviewers on the environment so each publish is approved.
20
21
 
21
22
  on:
22
23
  push:
@@ -40,7 +41,7 @@ jobs:
40
41
  run: |
41
42
  VERSION=$(grep -m1 -E '^version *= *"' pyproject.toml | sed -E 's/.*"([^"]+)".*/\1/')
42
43
  echo "version=$VERSION" >> "$GITHUB_OUTPUT"
43
- if ! python3 -c "import re, sys; sys.exit(0 if re.search(r'(a|b|rc|\.dev)[0-9]+$', '$VERSION') else 1)"; then
44
+ if ! [[ "$VERSION" =~ (a|b|rc|\.dev)[0-9]+$ ]]; then # matched in bash: the version is never pasted into code
44
45
  echo "::error::$VERSION is not a pre-release version (X.Y.ZaN / bN / rcN / .devN); final releases go through release.yml"
45
46
  exit 1
46
47
  fi
@@ -1,19 +1,21 @@
1
1
  name: publish
2
2
 
3
- # Builds the package and publishes to PyPI when a GitHub Release is published.
3
+ # Builds the package and publishes it to PyPI. Only release.yml and prerelease.yml call it, after the tests pass and the
4
+ # GitHub Release is cut: it has no trigger of its own, so nothing reaches PyPI untested. To publish again, re-run the
5
+ # failed `publish` job of that release run.
4
6
  # Uses PyPI Trusted Publishing (OIDC) — no API token stored as a secret.
5
7
  # One-time setup on PyPI: project Settings -> Publishing -> add a trusted publisher
6
8
  # owner: imagra93 repo: attr-eomt workflow: publish.yml environment: pypi
9
+ # Recommended on GitHub: Settings -> Environments -> pypi -> Required reviewers, so a publish waits for an approval.
7
10
 
8
11
  on:
9
- release:
10
- types: [published]
11
- workflow_dispatch: # allow manual runs (e.g. re-publishing an existing release)
12
- workflow_call: # called by release.yml after it cuts a Release on a version bump
12
+ workflow_call: # release.yml / prerelease.yml, after their tests and Release
13
13
 
14
14
  jobs:
15
15
  build:
16
16
  runs-on: ubuntu-latest
17
+ permissions:
18
+ contents: read
17
19
  steps:
18
20
  - uses: actions/checkout@v5
19
21
  - name: Install uv
@@ -21,7 +23,7 @@ jobs:
21
23
  - name: Build sdist + wheel
22
24
  run: uv build
23
25
  - name: Check metadata
24
- run: uvx twine check dist/*
26
+ run: uvx twine==7.0.0 check dist/* # 7.0: Metadata-Version 2.5 (hatchling >= 1.32); the PyPI action uses 7.0.0 too
25
27
  - uses: actions/upload-artifact@v4
26
28
  with:
27
29
  name: dist
@@ -67,7 +67,9 @@ jobs:
67
67
  VERSION: ${{ needs.check.outputs.version }}
68
68
  run: |
69
69
  # a pre-release version (aN / bN / rcN / .devN) merged to main is released as a GitHub pre-release
70
- PRE=$(python3 -c "import re; print('--prerelease' if re.search(r'(a|b|rc|\.dev)[0-9]+$', '$VERSION') else '')")
70
+ # (matched in bash: the version is never pasted into code)
71
+ PRE=""
72
+ if [[ "$VERSION" =~ (a|b|rc|\.dev)[0-9]+$ ]]; then PRE=--prerelease; fi
71
73
  gh release create "v$VERSION" \
72
74
  --title "v$VERSION" \
73
75
  --generate-notes \
@@ -6,6 +6,9 @@ on:
6
6
  pull_request:
7
7
  workflow_call: # callable by release.yml to gate a release on tests passing
8
8
 
9
+ permissions:
10
+ contents: read
11
+
9
12
  jobs:
10
13
  test:
11
14
  runs-on: ubuntu-latest
@@ -33,3 +33,8 @@ local_training_scripts/
33
33
  .vscode/
34
34
  .DS_Store
35
35
  .env
36
+
37
+ # Local, never published: run scripts and notes of private datasets
38
+ /train*.sh
39
+ /wishlist.md
40
+ /training/
@@ -0,0 +1,228 @@
1
+ # Changelog
2
+
3
+ ## 3.1.1 (2026-12-01)
4
+
5
+ Faster training, validation, data loading and inference, new training options, and fixes from a review of the
6
+ whole package; no change to the models or checkpoints.
7
+
8
+ - **Dependencies**:
9
+ - `torch>=2.6` / `torchvision>=0.21`. On older torch, a crafted `.pt` can run code despite `weights_only=True`
10
+ (CVE-2025-32434); `load_raw` refuses to load checkpoints there.
11
+ - `torchao` dropped, since nothing imports it.
12
+ - OpenCV and supervision move to the `track` extra (`pip install "attr-eomt[track]"`, for `examples/track.py`); the
13
+ `dev` extra keeps OpenCV for the augmentation tests.
14
+ - The build backend is bounded (`hatchling>=1.27,<2`).
15
+ - **Packaging**: `data="coco"` works from an installed wheel. `coco.yaml` ships inside the package, and COCO 2017
16
+ downloads into `$EOMT_DATASETS/coco`, else `./datasets/coco` under the current directory. In a source checkout it
17
+ went to `configs/datasets/coco`.
18
+ - **Release CI**:
19
+ - `publish.yml` runs only when `release.yml` / `prerelease.yml` call it, after their tests, so nothing reaches PyPI
20
+ untested.
21
+ - Workflows get read-only `permissions`.
22
+ - The version is matched in bash instead of being pasted into Python code.
23
+ - `twine` is pinned.
24
+ - **Validation speed**: the masks are run-length encoded where they are, on the GPU (`encode_masks`), byte for byte as
25
+ pycocotools. `_records` takes 0.05 s instead of 1.7 s for 100 detections of a 12 MP photo; a validation is 5x faster
26
+ on 1024 px photos and 13x on 3 MP ones, with identical metrics.
27
+ - **Data loading speed**: samples are bit-identical, for less time and memory.
28
+ - Masks stay one byte per pixel until they are resized, shrunk in exact integers, decoded into one buffer, and
29
+ flipped after the shrink; an empty mask is found from its RLE.
30
+ - A 12 MP photo with 20 instances takes 0.29 s instead of 1.4 s per sample, and 0.46 GB instead of 2.3 GB.
31
+ - **Training without host-device waits**: the Hungarian assignments reach the GPU in one non-blocking copy, the
32
+ instance count stays a Python number, and the attribute heads' checks are read at once. Multi-view groups and
33
+ partners are built without blocking copies. That is ~133 waits for the GPU per step down to ~10, with equivalent
34
+ results (the same matching, the loss to ~1 ulp, gradients within the GPU's own run-to-run noise): +1-2 % on a ViT-L
35
+ step, more on smaller models.
36
+ - **Frozen ViT blocks**:
37
+ - `optim.freeze_blocks: k` freezes the patch embedding and ViT blocks `0..k-1` (only blocks below the queries; not
38
+ with `multiview`). With `llrd` 0.8 those blocks learn at 0.6-7 % of the head's LR anyway. **On a ViT-L it defaults
39
+ to 8**; S / B train every block (not measured), a multi-view post-training and a resumed run are unchanged
40
+ (a resume keeps its run's setting, 0 for runs from before).
41
+ - Measured with ViT-L 644 on two datasets: steps 9-18 % faster and 2.8 GiB less, with the same or a better mAP:
42
+ +0.009 (95 % CI [+0.006, +0.012]) and +0.0035 class-agnostic (CI [+0.0004, +0.0067]), where two seeds of one
43
+ recipe differ by up to 0.003. On a full training set too: +0.0014 class-agnostic (CI [-0.002, +0.004]), 18 %
44
+ faster, 2.8 GiB less.
45
+ - 12 blocks: steps 16-25 % faster and 4.1 GiB less, but -0.007 mAP on one of the two datasets.
46
+ - **Weights of chosen epochs**: `train(save_epochs=...)` (`train.save_epochs` in the run config) also keeps the EMA
47
+ weights of those epochs, stored as `best.pt` is (the weights only, with the LoRA factors merged, and the epoch's
48
+ metrics row), in `weights/epoch<N>.pt`. It takes a list of epochs, numbered from 0 as `metrics.csv` and the log
49
+ number them, or `k` for every k-th epoch (`k - 1`, `2k - 1`, ...). Use it to compare the epochs of a run on a test
50
+ the validation does not stand for. An epoch whose masked attention is still annealing is saved too, with a note in
51
+ the log: predict runs it mask-free, unlike its training.
52
+ - **Checking a run without training it**: `eomt.check_train(data, model=..., **kw)` and `scripts/train.py --check` check
53
+ a run as `EoMT(model).train(data, **kw)` would start it: the run config (its sections, their keys and values, the
54
+ `train` keys it cannot set), the `train()` keywords, and the files the run reads (the data, the checkpoint it starts
55
+ from, the fixed validation sets). It takes ~2 s, with no GPU, and loads and downloads nothing. It prints the run's
56
+ settings, or the first problem and exit status 1. `train()` checks its settings the same way before it loads anything.
57
+ - **Validation every epoch by default** (`val.interval`: 2 -> 1): the metrics of every epoch, and `best.pt` chosen
58
+ among all of them. This costs one validation per epoch; in the ViT-L runs measured, ~2 % of an epoch with a photo
59
+ validation and ~8 % with a multi-view set validation. `val: {interval: 2}` restores the old behaviour.
60
+ - **Inference speed**: `predict()` returns identical results, bit for bit (every tensor of 72 real photos, at the
61
+ checkpoint's thresholds and at conf 0), faster. ViT-L 644 on an RTX 5090: one 12 MP photo takes ~72 ms instead of
62
+ ~158 ms, a folder of 12 MP photos ~44 ms/photo instead of ~165; one ~1 MP photo ~24 ms instead of ~35, a folder of
63
+ them ~17.5 ms/photo instead of ~20.
64
+ - JPEG / PNG files are decoded by torchvision (`eomt.preprocess.decode_image` / `read_image`, the same pixels as
65
+ PIL's, with the EXIF orientation applied as `open_image` does). A CUDA model gets them resized on its GPU,
66
+ with `preprocess_torch`, whose input is `preprocess_numpy`'s bit for bit; it now also takes a `(3, H, W)` uint8
67
+ tensor. Other formats, and layouts the two decoders might not agree on, are decoded by PIL as before. Pillow 13
68
+ runs its vertical pass first when the height shrinks by more than twice as many pixels as the width; the GPU
69
+ resize follows the installed Pillow's order, so the input stays PIL's bit for bit with Pillow 12 and 13.
70
+ - A folder is decoded with one job per photo (8 threads, two batches ahead) instead of one per batch.
71
+ - Masks come to the CPU through two reused pinned buffers, in chunks, the transfer of one overlapping the copy of
72
+ the one before: 10 masks of 12 MP take ~6 ms instead of ~50 ms. Every result keeps its own memory.
73
+ - On a folder or a list, each batch's results come to the CPU in a thread and on a CUDA stream of their own while
74
+ the next batch runs: with 12 MP photos and ~7.6 detections each, 26.8 -> 23.6 ms/photo at batch 8 and 28.0 ->
75
+ 23.8 at batch 1 (unchanged with ~1 detection per photo).
76
+ - Photos in memory (a PIL image of any mode, or an RGB uint8 array) given to `predict_image` / `predict_batch` /
77
+ `predict_set` on a CUDA model are resized on the GPU too, from pinned memory: the same input bit for bit, 1.2 ms
78
+ instead of 9.4 ms for a 1 MP photo. An app that runs two models on each 1-3 MP photo went from 103 to 89 ms
79
+ per photo and from 90 to 76 ms per video frame, with identical responses.
80
+ - **Test-time augmentation** (`augment=` / `tiles=`, `predict_views`): on a CUDA model the photo is uploaded once
81
+ and each view cut, mirrored and resized on the GPU (the same input as PIL's, bit for bit), and the views' match
82
+ matrix is read back once instead of once per pair of views. Identical results; a 1024 px photo with ViT-L 644 on
83
+ an RTX 5090: 12 views (flip, scales 1 and 1.5, tiles) 272 -> 259 ms, 2 views (flip) 40 -> 36 ms. The forward
84
+ passes are now ~93 % of the time.
85
+ - **Blur**: on a photo the augmentation shrinks, the blur is applied after the resize, with sigma x the scale.
86
+ - It uses a Gaussian corrected for small sigmas, and is skipped under 0.1 output px.
87
+ - Before a JPEG step, or without a shrink, it stays at source resolution as before, now separable.
88
+ - Blurred samples change by about 0.2 grey levels; every other output is identical.
89
+ - A "degraded" 12 MP anchor takes 1.1 s instead of 4.0 s.
90
+
91
+ - **Prediction**:
92
+ - `EoMT.predict` / `predict()` take a PIL image, an RGB array or a list (of files, folders and images), not only a
93
+ path. Their results are on the CPU: a folder's full-resolution masks no longer pile up on the GPU (16 phone
94
+ photos held 18 GiB).
95
+ - Detections are always returned highest score first; before, that held only when `max_det` cut them.
96
+ - Image files are turned upright by their EXIF orientation (`eomt.preprocess.open_image`), so a portrait phone photo
97
+ is predicted and returned as a viewer shows it.
98
+ - `predict_image(array, augment=True)` works.
99
+ - `preprocess_numpy` resizes a PIL image as it is, and `open_image` decodes a photo with no copy when it needs no
100
+ turn: two to four fewer full-resolution copies per 12 MP photo (139 -> 77 ms end to end for one), identical output.
101
+ - **Data**:
102
+ - A dataset image is turned upright only when its record proves the annotations were made upright (a portrait record
103
+ of landscape pixels, or the reverse); before, such masks were stretched onto the sideways pixels.
104
+ - A missing `iscrowd` is 0, and degenerate polygons are left out at load time, instead of failing in a worker.
105
+ - When every instance is cropped away, the photo has no target, instead of an invented class-0 one (a full-image box
106
+ for the detect family).
107
+ - Instances that mosaic / mixup / copy-paste paste into a negative image pass the keep filter.
108
+ - Attribute sidecar values that are bare numbers map to their labels.
109
+ - `flip_aware` swaps on a mirror image (one flip, horizontal or vertical), not on a horizontal flip.
110
+ - The set validation letterboxes with `round`, as inference does (it gave 643 for 644).
111
+ - `instances_val_retrain.json` is the `val` split.
112
+ - **Training**:
113
+ - The Hungarian costs are computed in fp32 (under autocast their matmuls ran in bf16).
114
+ - A dataset smaller than one batch trains on a partial batch (the sample run trained 0 steps and reported success);
115
+ an empty loader raises.
116
+ - A resume without `name` continues in the resumed run's folder (it wrote into `runs/train/eomt-<size>`).
117
+ - Unknown `aux.per_head` heads raise.
118
+ - TF32 / cuDNN settings are restored when `train()` returns.
119
+ - `EoMT.train()` releases its loaded copy of the model during the run.
120
+ - **Validation**:
121
+ - The val JSON's classes must be the model's, in the same order. Another order scored every class as another one.
122
+ - COCO's `-1` (no ground truth) is NaN.
123
+ - The best-F1 link threshold is found exactly over the observed similarities (a 0.01 grid gave `match_thres=0.02`).
124
+ - **Checkpoints**:
125
+ - A bf16 checkpoint re-saves as bf16 (`dtype="fp32"` for full precision).
126
+ - Saving over an existing file works on Windows.
127
+ - `push_to_hub` refuses an existing repo of the other visibility and a file name with folders, and leaves out the
128
+ run's local data paths, provenance and per-field metrics.
129
+
130
+ ## 3.1.0 (2026-11-19)
131
+
132
+ The multi-view post-training, rebuilt from what the 3.0 runs showed: the cross-view attention's null token never
133
+ learned (its logit stayed at its starting value), the matching head linked hardly better than plain re-identification
134
+ (link F1 0.68 vs 0.66), and the photos' own features never saw the other photos. **Multi-view checkpoints of 3.0 and
135
+ before are refused** (their single-photo starting checkpoints load as before, with identical predictions).
136
+
137
+ - **Cross-view attention, gated.** Each row's update is gated per head by `tanh` of a learned function of the row,
138
+ starting at 0 (the sublayer starts as the identity), in place of the null token and the LayerScale. The patch tokens,
139
+ pooled 2x2, attend to the other photos too and their update is spread back over the patches, so the mask features see
140
+ the other photos (`xview: {patches, pool}`; ~+3 % per step). One attention call per set. The output projection has no
141
+ bias, so a closed gate adds nothing.
142
+ - **Attention supervision** (`multiview.attn_w`): a loss pointing each linked query's cross-view attention at the same
143
+ instance in the other photos (its mask and its query there).
144
+ - **The set matcher** (`eomt.matcher.SetMatcher`, replaces the matching head, `match_dim`, `match_residual` and the
145
+ sigmoid matching loss): the detected instances of the photos, by their query embedding and mask box, attend to each
146
+ other within and across photos; every two instances of two photos get a probability of being the same (a dual softmax
147
+ with a "no partner in that photo" bin), trained on the `instance_id` links (`multiview.match_w`). Inference links with
148
+ it (the photos predicted together as one set, any other two as a pair) at its calibrated probability threshold.
149
+ - **LoRA** (`multiview.lora: {rank, blocks, alpha}`, `eomt.lora`): the attention of the frozen ViT blocks below the query
150
+ blocks adapts; the trainer's `best.pt` holds the merged weights, and any checkpoint with factors is merged on loading.
151
+ Trainable group `lora`; the `match_head` group is now `matcher`.
152
+ - **Validation**: `sets/{match,reid}_oracle/*`, the links between the annotated instances themselves (linking with
153
+ perfect detection); the blocks below the queries run once per set for the photos alone and together;
154
+ `val.final_epochs` validates every epoch at the end of a run validated every `interval` epochs.
155
+ - **Training**: DDP no longer searches for unused parameters (every trainable parameter joins each step's graph) and
156
+ keeps the gradients in its buckets.
157
+ - `EoMTModel.forward(trunk=..., keep_xview_attn=...)` and `EoMTEncoder.encode_trunk()`.
158
+ - **Groups of a subject's photos** (`eomt.engine.predict`): a photo may be in several groups (predicted in the first,
159
+ context in the others, `group_owners`); `fill=True` (`subject_groups`, `predict_subject`, `predict(subject=True)`,
160
+ `match`, `scripts/match.py --fill`) tops the last default group up with the photos before it, so 5 photos at 4 a
161
+ time are two groups of 4 instead of 4 + 1; `similar_groups(features, max_views)` groups photos by
162
+ `photo_similarity`: the cosine of one or several descriptions of each photo (e.g. a first model's class areas and the
163
+ photo's appearance), averaged with `weights`, optionally `center`ed, filled the same way.
164
+ - **`photo_embed`**: every forward returns each photo's mean final patch token `(B, hidden)` over the photo (the
165
+ letterbox padding left out); `predict_set` results carry it, and `predict_batch(photo_embed=True)`.
166
+ - `predict_batch` / `predict_set` / `predict_subject` take RGB arrays as well as PIL images, already preprocessed inputs
167
+ (`prepared`: numpy or tensors, from `preprocess_numpy` or `preprocess_torch`) and the size each result is returned at
168
+ (`sizes`).
169
+
170
+
171
+ ## 3.0.0 (2026-11-19)
172
+
173
+ A cleanup for a public release: one way to do each thing, one config per concern, and the options no trained model
174
+ uses removed. **Checkpoints of 2.x load and predict exactly as before** (they are upgraded on load); run configs and
175
+ code written for 2.x need the changes below.
176
+
177
+ ### Training: settings by concern
178
+
179
+ `train()` keeps the keywords of the run (data, `size`, `family`, `epochs`, `batch`, `nominal_batch`, `imgsz`, `device`,
180
+ `workers`, `seed`, `project` / `name`, `resume` / `init_weights`, `keep_empty`, `stop_after_epochs`, `logger`) and takes
181
+ the rest by section, each a dataclass or a mapping (and a section of the run config YAML):
182
+
183
+ | 2.x keyword | 3.0 |
184
+ |---|---|
185
+ | `lr0`, `weight_decay`, `llrd`, `backbone_lr_mult`, `poly_power`, `warmup_steps`, `clip_norm`, `ema`, `ema_decay`, `ema_tau` | `optim: {...}` |
186
+ | `mask_anneal`, `mask_anneal_start` / `_end`, `--mask-free` | `optim.mask_anneal` (true: the reference windows; false: mask-free) |
187
+ | `fpn_scales`, `num_upscale_blocks`, loss weights, `iou_aware_cls`, `quality_weight`, `aux_head_*` | `model: {...}` (IoU-aware targets and the quality head now on by default) |
188
+ | `aux_w`, `aux_w_per_head`, `aux_class_weights`, `aux_iou_gate`, `aux_class_gate` | `aux: {w, per_head, class_weights, iou_gate, class_gate}` |
189
+ | `val_interval`, `val_imgsz`, `conf_thres`, `max_det`, `val_group_by`, `best_key` | `val: {interval, imgsz, conf_thres, max_det, group_by, best_key}` |
190
+ | `flip_prob`, `min_scale`, `max_scale`, `train_aug` (YAML) | `aug: {...}` |
191
+ | `accum`, `amp_dtype`, `tf32`, `prefetch`, `letterbox`, `ddp` | removed (from `nominal_batch`; bf16 where supported; always on) |
192
+
193
+ Removed options: `box_head`, `deep_supervision=False`, `hires_*`, `aux_balance`, `aux_w_warmup`, the gradient probe.
194
+
195
+ ### Several photos of one subject
196
+
197
+ `multiview` is a post-training on **real** sets (images with `subject_id`, annotations with `instance_id`):
198
+ `{xview, matching, match_w, gate, trainable, sets, val_sets}`. `xview` and `matching` are each optional: the matching
199
+ head trains without cross-view attention too. `trainable` takes the presets `new` and `query_blocks`, or a dict.
200
+ New: `sets.groups` (an image field) trains on the fixed groups of photos an application predicts together, each once
201
+ per epoch, with a `sets.p_random` share of random sets; validation scores those groups.
202
+
203
+ Removed: synthetic sets (`sets.cases`, distractors, mirrored copies, `p_subject`, `focus`), the `real` sub-section (the
204
+ run's own data is the sets' data), the refiner, view types, `xview.keys`, `xview_scale`, the InfoNCE and dustbin
205
+ matching losses (sigmoid only), `match_dim` / `match_residual` / `match_tau` (a residual head at the hidden size),
206
+ `match_neg_conf` (the inference threshold), `match_hard_*`, `linked_w`, `consistency_*`, `harm_w`, `val_synthetic`,
207
+ per-part `val_interval`. The metrics are `val/sets/...` (was `val/real/...`); the link sources are `match` and `reid`.
208
+
209
+ ### Inference and API
210
+
211
+ - `EoMT.match()` is the one linking entry point, for any number of photos (`infer_match` is gone);
212
+ `predict_subject(identities=True)` links in code. The grouping modes `partition` / `anchor` are gone (`groups=`).
213
+ - `predict()` batches (`batch=8`), decodes in the background, streams (`stream=True`) and runs in bf16 by default.
214
+ - `val()` defaults to the checkpoint's own validation data.
215
+ - Tracking moved to `examples/track.py`; int8 compression and the auxiliary box head were removed.
216
+ - Checkpoints load with `weights_only=True` and strictly; `eomt.migrate_checkpoint` upgrades 2.x ones.
217
+ - Messages go through the standard `eomt` logger (stdout, INFO) instead of `print`:
218
+ `logging.getLogger("eomt").setLevel(logging.WARNING)` silences them.
219
+
220
+ ### Fixes
221
+
222
+ - Unaugmented validation sets are placed as inference letterboxes the photos (they were placed at random): the stored
223
+ link threshold is calibrated on the inputs inference sees, and fixed sets read back reproduce the trainer's numbers.
224
+ - Validation runs in bf16 like training and inference (it ran in fp16), in PyTorch's default numerics.
225
+ - Thin or tiny instances are no longer dropped from the set validation's ground truth.
226
+ - `last.pt` is written before validating; a resumed run reads the best so far from `best.pt` too.
227
+ - No GPU synchronisation per forward pass (masked-attention probabilities) or per training step; the final matching is
228
+ solved once per step; `predict()` keeps no full-resolution float copies of the masks.