Nodes/ComfyUI-NeurCADRecon/NeurCADRecon Train
ComfyUI Node

NeurCADRecon Train

5–15 minutes of patience

By PozzettiAndrea-archive·Created 9 months ago·Updated 7 months ago· 0
NeurCADRecon Train
  • model
  • point_cloud
  • trained_model
  • checkpoint_path
  • training_log
num_iterations10000
batch_size20000
learning_rate0.0001
loss_presetbalanced
save_checkpointtrue
checkpoint_dir
log_interval500

This is the node that actually does the work. Given a point cloud and the untrained network from Load NeurCADRecon Model, it runs a per-shape training loop that learns a signed distance function (SDF) - a field that says "how far am I from the surface, and which side am I on" for every point in space. Once that field exists, the Inference node can slice it into a mesh. This is reconstruction in the neural-implicit style, the same family of approach as NeuS and Neuralangelo, but tuned for the one thing those miss: sharp CAD edges.

The NeurCADRecon paper's trick is the Morse loss, a Gaussian-curvature regularization. CAD surfaces are mostly developable - flat or singly-curved, with zero Gaussian curvature - and the loss pushes the network toward exactly that, which is what keeps edges crisp instead of melting them into fillets. The training log shows you the three terms working together, with rough targets from the node's own description:

  • SDF (distance error at surface points) - good below 0.01
  • Eikonal (gradient magnitude should be 1, so the field is a real distance) - good below 0.1
  • Morse (curvature regularization) - good below 1.0
  • Total - typically starts 100–500 and ends 10–50

Inputs that matter

Required: model from LoadNeurCADReconModel, and point_cloud, which is a TRIMESH. The example workflow feeds it from Geometry Pack's GeomPackLoadMesh (a loaded Stanford Bunny) - any node that emits a TRIMESH works, and the code happily samples 50,000 points off the surface if you hand it a mesh rather than raw points.

The optional knobs, in rough order of "would you ever change this":

  • num_iterations (default 10000) - the one you're most likely to raise for noisy/scanned input or lower for a quick test. 1000–50000.
  • batch_size (default 20000) - points sampled per iteration; more = more VRAM. The comment in the tooltip is right: if you OOM, cut this before anything else.
  • learning_rate (default 5e-5) - Adam's rate. Leave it unless training diverges.
  • loss_preset (balanced / sharp_edges / smooth_surfaces) - sharp_edges cranks the Morse weight for parts with visible chamfers and bosses; smooth_surfaces dials it back if you're getting artifacts.
  • save_checkpoint (default true) and checkpoint_dir (empty = default location) - defaults drop .pth files into ComfyUI/output/neurcadrecon_checkpoints/ with a timestamp, so you can skip retraining next time via Load Checkpoint.
  • log_interval (default 500) - how often loss is printed.

Outputs

trained_model (NEURCADRECON_MODEL) → straight into NeurCADReconInference. checkpoint_path (STRING) tells you where the .pth landed. training_log (STRING) is the loss summary - the easiest way to tell if it converged.

How the training actually runs

The code builds a dataset with per-object normalization (center point, scale, bounding box), trains with Adam under automatic mixed precision, and clips gradients. Two ComfyUI-specific details worth knowing: it deliberately escapes ComfyUI's global inference_mode so autograd can actually run, and it uses num_workers=0 in the dataloader for compatibility. Expect roughly 5–15 minutes for 10k iterations on a GPU; on CPU, reconsider your life choices and drop to 3000 iterations for a smoke test.

Installation and gotchas

The pack installs via ComfyUI Manager (search "NeurCADRecon") or:

cd ComfyUI/custom_nodes
git clone https://github.com/PozzettiAndrea/ComfyUI-NeurCADRecon
pip install -r ComfyUI-NeurCADRecon/requirements.txt

then restart. Dependencies are light (torch, numpy, trimesh, scipy, PyMCubes) and there are no model downloads - this is pure training code, GPL-3.0, by Andrea Pozzetti of ComfyUI-CADabra. Fair warning from the README's own first line: the pack is marked "Work in Progress." The author has also said outright that he thinks ML-based reconstruction is a weak approach next to solid CAD tooling - so treat this as a niche tool, not the future of your pipeline. And since training is per-object, there's no general "it just works" - a dirty scan will give you a dirty mesh, which is where the Morse loss helps most.

CategoryNeurCADRecon

Inputs (9)

NameTypeDefaultDescription
modelNEURCADRECON_MODEL
point_cloudTRIMESH
num_iterationsoptINT100001000–50000Number of training iterations. 10000 is typical for good quality.
batch_sizeoptINT200005000–50000Number of points sampled per iteration. Higher uses more GPU memory.
learning_rateoptFLOAT0.00010.000001–0.001Learning rate for Adam optimizer.
loss_presetoptCOMBObalancedLoss weight preset. 'sharp_edges' increases morse weight for CAD-like shapes.
save_checkpointoptBOOLEANtrueSave checkpoint after training for later use.
checkpoint_diroptSTRINGDirectory to save checkpoint. Empty uses default location.
log_intervaloptINT500100–2000Print loss every N iterations.

Outputs (3)

NameTypeDescription
trained_modelNEURCADRECON_MODEL
checkpoint_pathSTRING
training_logSTRING