File size: 5,899 Bytes
e3be084
1d589e4
 
 
e3be084
1d589e4
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
da19857
1d589e4
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
e3be084
1d589e4
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
33e4072
1d589e4
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
da19857
 
33e4072
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
---
datasets:
- tbhugging/gummybear-tomography
library_name: pytorch
license: apache-2.0
metrics:
- rmse
pipeline_tag: image-feature-extraction
tags:
- tomography
- particle-localization
- cnn
- pooled
- gap
- multiview
- geometry-fusion
model-index:
- name: tbhugging/camera_orbit_compact_09_2b
  results:
  - task:
      type: image-feature-extraction
      name: Multi-view camera-orbit particle localisation (xyz)
    dataset:
      name: GummyBear Tomography (M8 catalog, M9 multi-view)
      type: tbhugging/gummybear-tomography
      config: m8_1
      split: validation
    metrics:
    - type: rmse
      value: 1.320252
      name: RMSE_total (Euclidean xyz)
    source:
      url: https://github.com/tbgitoo/gummybear-tomography/blob/master/GummyBearTomography_Final_Report.ipynb
      name: Final Report M9 Step 2 / 09_2B (pooled GAP)
  - task:
      type: image-feature-extraction
      name: Multi-view camera-orbit particle localisation (xyz)
    dataset:
      name: GummyBear Tomography (M8 catalog, M9 multi-view)
      type: tbhugging/gummybear-tomography
      config: m8_1
      split: test
    metrics:
    - type: rmse
      value: 0.860746
      name: RMSE_total (Euclidean xyz)
    source:
      url: https://github.com/tbgitoo/gummybear-tomography/blob/master/GummyBearTomography_Final_Report.ipynb
      name: Final Report M9 Step 2 / 09_2B (pooled GAP)
---

# `tbhugging/camera_orbit_compact_09_2b`

## What this model does

Given **6** camera-orbit views (0°, 60°, 120°, 180°, 240°, 300°) of 128×128 projections from the GummyBear Tomography dataset, the model predicts

- particle_x
- particle_y
- particle_z

coordinates of the embedded particle.



## Architecture

Per-view **GAP (pooled) CNN trunk** → camera **sin/cos geometry tokens** →
**compact fusion MLP** (`e2e_pooled_geometry_fusion`).

Final Report **M9 Step 2 / 09_2B** — compact head (`f2_state`).

- Hub: [tbhugging/camera_orbit_compact_09_2b](https://huggingface.co/tbhugging/camera_orbit_compact_09_2b)
- Companion dataset: [tbhugging/gummybear-tomography](https://huggingface.co/datasets/tbhugging/gummybear-tomography)
- Runnable report: [GummyBearTomography_Final_Report.ipynb](https://github.com/tbgitoo/gummybear-tomography/blob/master/GummyBearTomography_Final_Report.ipynb) (M9 Step 2 — 09_2B pooled ladder)
- Source study checkpoint: [checkpoints/m9/m09_e2e_pooled_geometry_fusion.pt](https://huggingface.co/datasets/tbhugging/gummybear-tomography/blob/main/checkpoints/m9/m09_e2e_pooled_geometry_fusion.pt) (`f2_state` / `m09_2_e2e_pooled_geometry_fusion`)

## Training configuration

- Protocol: `09_2B` (pooled GAP; excludes 09_2A Fourier)
- Backbone: `pooled_gap` (`pooled` trunk)
- Input field: `anomaly_ref`
- Normalisation: `per_image_zscore`
- Camera orbit: `0°, 60°, 120°, 180°, 240°, 300°` (6 views)
- Geometry: `sin_theta, cos_theta` (concat)
- Fusion: hidden `128`, depth `1`
- Targets: `particle_x, particle_y, particle_z`
- Builder: `GeometryAwareFourierFusionLocalizer.for_09_2_pooled()`
- Variant: `m09_2_e2e_pooled_geometry_fusion`
- Trainable parameters: `132358`
- Stage-A learning rate: `0.001`

## Evaluation Results

Structured scores for the Hub widget are declared in the YAML `model-index` / `metrics` metadata ([Model Cards — Evaluation Results](https://huggingface.co/docs/hub/model-cards#evaluation-results)).

### Testing Data

- Dataset: [tbhugging/gummybear-tomography](https://huggingface.co/datasets/tbhugging/gummybear-tomography) (config `m8_1`)
- Splits: `validation`, `test`
- Protocol: Final Report **M9 Step 2 / 09_2B** (camera orbit 0°, 60°, 120°, 180°, 240°, 300°, `anomaly_ref`, `per_image_zscore`, **GAP pooled trunk only**, compact geometry fusion; excludes 09_2A Fourier)
- Source checkpoint: [checkpoints/m9/m09_e2e_pooled_geometry_fusion.pt](https://huggingface.co/datasets/tbhugging/gummybear-tomography/blob/main/checkpoints/m9/m09_e2e_pooled_geometry_fusion.pt) (`f2_state` only)

### Metrics

Reported error is **Euclidean RMSE** over particle `(x,y,z)`:
`d_i = ||pred_i - y_i||_2`, then `RMSE_total = sqrt(mean_i d_i^2)`.
Hub metric id: `rmse` (display name `RMSE_total (Euclidean xyz)`).

### Results

Scores match the Final Report M9 Step 2 **09_2B pooled GAP** bar (not 09_2A Fourier; not element-wise MSE).

| Split | Metric | Value |
| --- | --- | ---: |
| `validation` | RMSE_total (Euclidean xyz) | `1.320252` |
| `test` | RMSE_total (Euclidean xyz) | `0.860746` |

Source: [Final Report M9 Step 2 / 09_2B](https://github.com/tbgitoo/gummybear-tomography/blob/master/GummyBearTomography_Final_Report.ipynb).

## Load

```python
import torch
# libraries from https://github.com/tbgitoo/gummybear-tomography
# Historical class name — use .for_09_2_pooled() for this GAP checkpoint only.
from tomography_ml.localization.localize_multiview import (
    GeometryAwareFourierFusionLocalizer,
)

n_views = 6
view_angles_deg = [0.0, 60.0, 120.0, 180.0, 240.0, 300.0]
model = GeometryAwareFourierFusionLocalizer.for_09_2_pooled(
    n_views=n_views,
    view_angles_deg=view_angles_deg,
)
views = torch.zeros(1, n_views, 1, 128, 128)
model(views)  # materialise lazy layers
state = torch.load('pytorch_model.bin', map_location='cpu', weights_only=True)
model.load_state_dict(state)
model.eval()
xyz = model(views)
```

Input tensor shape: `[batch, n_views, channels, height, width]`.
Do **not** load with `.for_09_2()` (that builds the 09_2A Fourier trunk).
Also excludes single-view M8, 09_3 large fusion, and M10 illumination stacks.

## Inference

For an example with worked download, model instanciation and inference, see: [11_2_test_camera_orbit_compact_09_2b.ipynb](https://github.com/tbgitoo/gummybear-tomography/blob/master/notebooks/milestone_11/11_2_test_camera_orbit_compact_09_2b.ipynb) in the [github.com/tbgitoo/gummybear-tomography](https://github.com/tbgitoo/gummybear-tomography) repository.