Nodes/ComfyUI-SECADNET/SECAD-Net Fine-tune (Required!)
ComfyUI Node

SECAD-Net Fine-tune (Required!)

The node whose display name says '(Required!)' — and it's not lying

By PozzettiAndrea-archive·Created 8 months ago·Updated 7 months ago· 0
SECAD-Net Fine-tune (Required!)
  • model
  • voxels
  • latent_code
  • optimized_latent
  • status
num_epochs200
num_samples8192
learning_rate0.0005

Every other node in this pack has a calm, descriptive name. This one is named SECAD-Net Fine-tune (Required!) with an exclamation mark baked into the UI. That's the author telling you, in the only way a node name can, that the rough mesh you got from SECADNetInference is not what you came for. SECAD-Net is built around test-time optimization: the encoder only produces an initialization, and the real quality comes from fine-tuning the latent code against your specific voxel shape. Skip this node and the whole pack underdelivers.

How it works

This is also the most technically interesting node in the pack, because it has to fight ComfyUI to exist. ComfyUI wraps everything in torch.inference_mode(), which means the model weights you loaded are "inference tensors" that refuse to participate in backprop. The node's workaround: it re-creates the decoder and generator inside inference_mode(False), clones the weights to get normal tensors, and makes the latent code a learnable parameter. Then it runs an Adam optimizer (betas 0.5/0.999) that nudges three things at once - the latent code, the decoder, and the generator - to minimize MSE between the predicted occupancy and the ground-truth occupancy sampled from your voxel grid.

Every epoch, it randomly samples num_samples points from the 64³ grid, maps them to the (-0.5, 0.5) unit cube, and checks whether the network thinks each point is inside the shape. It tracks the best latent it finds along the way and hands that back to you.

Inputs that matter

  • model (SECADNET_MODEL) and voxels (VOXEL_GRID) - same sources as Inference: the loader and MeshToVoxel.
  • latent_code (SECADNET_LATENT) - the output of SECADNetInference. This is the whole point of the previous node's second output.
  • num_epochs (default 200, up to 2000) - the tooltip says 200–500 for good results. Start at 200; push higher only if the mesh still looks wrong.
  • num_samples (default 8192) - points sampled per epoch. Higher = better gradients, slower. Drop to 2048–4096 for quick previews.
  • learning_rate (default 0.0005) - lower (0.0001–0.001) is more stable, per the tooltip. If the loss explodes or the mesh degrades, halve it.

Outputs are optimized_latent (SECADNET_LATENT) - wire it into SECADNetLatentToMesh - and status (STRING) with the best loss.

What to expect

Patience, mostly. This is a real optimization loop, not a one-shot inference, and 200 epochs of point sampling takes a while even on a GPU. Console output prints progress every 100 epochs. The pack is honest about being unfinished (README says "Work in Progress"), so watch for the log line about the voxel shape if you fed in something that isn't 64³ - it warns and tries to squeeze anyway, with mixed results.

If you run into "inference tensor" errors, that's the ComfyUI inference_mode clash this node exists to dodge - make sure you're feeding it the SECADNET_MODEL and SECADNET_LATENT from this pack's own nodes, not some other pack's lookalikes. And a practical tip: when you're iterating on settings, run one short pass (like 50 epochs at low num_samples) to confirm the loss actually falls before committing to the full 500.

CategoryCADabra/SECAD-Net

Inputs (6)

NameTypeDefaultDescription
modelSECADNET_MODEL
voxelsVOXEL_GRID
latent_codeSECADNET_LATENT
num_epochsoptINT20010–2000Number of optimization epochs. 200-500 recommended for good results.
num_samplesoptINT81921024–65536Number of point samples per iteration. Higher = better but slower.
learning_rateoptFLOAT0.00050.00001–0.01Learning rate for optimization. Lower values (0.0001-0.001) are more stable.

Outputs (2)

NameTypeDescription
optimized_latentSECADNET_LATENT
statusSTRING