feat(ll_brepnet): B-Rep face-segmentation package — trained (test mIoU 0.71)#14
Merged
Conversation
Turn the empty ll_brepnet scaffold into a working, MIT-clean B-Rep
face-segmentation package, verified end-to-end on real STEP fixtures.
Independent implementation on the toolkit's own MIT machinery; inspired
by BRepNet (arXiv:2104.00706) but no CC BY-NC-SA code copied (see
ll_brepnet/ATTRIBUTION.md).
- M0 scaffold: pyproject/env/__init__/conftest (torch-first OpenMP guard),
MIT LICENSE + ATTRIBUTION; installs + imports; ruff/black clean.
- M1 extraction (pipelines/): STEP -> unit-box scale -> coedge graph
(next/prev/mate/face/edge incidence via cadling CoedgeExtractor) +
per-face/edge features + UV-grids -> .npz; manifest builder with
train-only standardization; JSON front-end. Self-contained indexing +
uvgrid("inside") trim mask to bypass two latent cadling pythonocc-7.8
bugs (face_identity topods import; uv_grid_extractor numpy gp_Pnt2d).
- M2 dataset (dataloaders/): BRepDataset + BRepBatch + offset-aware
collate (mate involution survives batching) + MaxNumFacesSampler +
BRepDataModule.
- M3 model (models/): UV-Net surface/curve encoders + feature fusion ->
reused cadling BRepNetEncoder coedge message passing -> per-face seg
head; cross-entropy + torchmetrics mIoU/accuracy.
- M4 training (train.py): pytorch-lightning Trainer + ModelCheckpoint +
TensorBoard/CSV logging. Proof-of-life on 12 real fixtures: train loss
2.13 -> 0.72, real val mIoU computed, checkpoint saved.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…, tests, docs (M5-M7) - M5: real training on a Fusion 360 Gallery segmentation s2.0.0 subset (3400 train / 600 val / 800 test, official 8 classes + train/test split, 35 epochs CPU). Honest held-out result: test mIoU 0.709, accuracy 0.912 (per-class IoU in the plan/docs; rare RevolveEnd weak at 0.11). Competitive with the BRepNet paper (~0.65-0.72) using the MIT-clean reused-coedge encoder. Adds parallel STEP extraction (extract_step_files, ProcessPoolExecutor) and a quickstart.prepare_fusion360 orchestrator (extract -> copy labels -> manifest). - M6: eval/evaluate.py evaluate_folder -- checkpoint + STEP folder -> per-face .logits (softmax rows); reuses the training manifest's standardization+classes. - M7: 21 tests on real fixtures (extraction topology/grids, dataset+collate offset & mate-survival, model forward/learning, JSON front-end, slow end-to-end segment); lazy public API in __init__ (cheap import); add -e ./ll_brepnet + pytorch-lightning/tensorboard to root environment.yml; flip the site roadmap page to real Overview/Installation/Usage pages (site builds; all internal links valid). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Contributor
There was a problem hiding this comment.
Sorry @LayerDynamics, your pull request is larger than the review limit of 150000 diff characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What this is
Turns the empty
ll_brepnet/scaffold into a working, trained B-Repface-segmentation package — STEP solid → coedge graph + UV-grid geometry →
per-face semantic segmentation. Built across 8 verified milestones (M0–M7).
It is an independent, MIT-licensed implementation on the toolkit's own MIT
machinery (
cadling). It is inspired by BRepNet(arXiv:2104.00706, licensed CC BY-NC-SA) and
UV-Net, but copies no code from them — see
ll_brepnet/ATTRIBUTION.md. Thearchitecture deliberately uses the monorepo's existing coedge encoder rather
than BRepNet's kernel convolution, keeping the package MIT.
Result (real, reproducible)
Trained on a real subset of the Fusion 360 Gallery segmentation set (s2.0.0) —
3,400 train / 600 val / 800 test solids, official 8 manufacturing-feature classes
and train/test split, 35 epochs CPU.
Held-out test split (800 real solids): mIoU = 0.709, accuracy = 0.912.
Per-class IoU: Fillet 0.94 · ExtrudeSide 0.89 · ExtrudeEnd 0.86 · Chamfer 0.84 ·
CutEnd 0.71 · RevolveSide 0.66 · CutSide 0.66 · RevolveEnd 0.11. Competitive with
the BRepNet paper's reported ~0.65–0.72 mIoU.
Milestones
LICENSE+ATTRIBUTION, OpenMP-guarded conftestpipelines/: STEP → coedge graph + features + UV-grids →.npz; manifest builder; JSON front-end; parallel extractiondataloaders/:BRepDataset, offset-aware collate (mate involution survives batching), face-count sampler,BRepDataModulemodels/: UV-Net surface/curve encoders + reused coedgeBRepNetEncoder+ per-face seg headtrain.py: pytorch-lightning Trainer + checkpoint/TensorBoardquickstartorchestration + the real training run aboveeval/:evaluate_folder— checkpoint + STEP folder → per-face.logitsVerification
Note on cadling
While building this I found two latent
cadlingbugs on pythonocc 7.8(
ShapeIdentityRegistryregistered nothing; face UV-grids always failed).ll_brepnetis self-contained and works around both, so this PR is independent.The underlying fixes are in #13 (
fix/cadling-pythonocc-7.8).Plan:
docs/plans/2026-06-10-implement-ll-brepnet.md.🤖 Generated with Claude Code