CADCrafter: Generating Computer-Aided Design Models from Unconstrained Images

Cheng Chen, Jiacheng Wei, Tianrun Chen, Chi Zhang, Xiaofeng Yang, Shangzhan Zhang, Bingchen Yang, Chuan-Sheng Foo, Guosheng Lin, Qixing Huang, Fayao Liu

Introduction

Generative AI has revolutionized 3D content creation, yet most existing methods produce "dead" geometry—unstructured meshes or point clouds that lack the parametric precision required for engineering and manufacturing. In contrast, Computer-Aided Design (CAD) models are defined by sequences of executable commands, such as sketching a profile and extruding it. This parametric representation is the industry standard because it is inherently editable and manufacturing-ready.

CADCrafter introduces a novel latent diffusion framework designed to bridge the gap between unconstrained real-world images and these structured CAD command sequences. By focusing on texture-invariant geometric features and employing a "code checker" via Direct Preference Optimization (DPO), CADCrafter successfully reconstructs high-fidelity CAD models from messy, real-world photos.

Overview of the CADCrafter system, converting unconstrained real-world images into editable parametric CAD sequences.

The Challenge of Image-to-CAD

Reverse-engineering CAD commands from a single photo is fraught with difficulties. First, there is a significant domain gap: models trained on clean, synthetic CAD renderings often fail when confronted with the shadows, lighting, and textures of real-world photography. Second, CAD compilers are unforgiving. A single incorrect parameter in a sequence can lead to an invalid CAD sequence, such as an open loop that cannot be extruded into a solid body. Finally, there is a severe data scarcity of paired real-world images and their corresponding CAD command histories.

The CADCrafter Pipeline

To address these hurdles, CADCrafter utilizes a three-stage architecture that moves beyond simple image-to-sequence translation.

Stage 1: CAD Encoding

The process begins by mapping discrete CAD command tokens into a continuous latent space ($z$). A transformer-based autoencoder is trained to compress these sequences, providing a smooth mathematical space for the subsequent diffusion process to operate within.

Stage 2: Geometry-Conditioned Diffusion

A key insight of CADCrafter is that RGB textures often act as noise that hinders generalization. Instead of raw images, the model uses a Geometry Conditioning Encoder. It extracts depth and surface normal maps from input images using a pre-trained Metric3D model. These geometric maps are processed by a DINO-v2 backbone, allowing the model to focus on shape rather than appearance. This approach enables a model trained on synthetic data to generalize effectively to "in-the-wild" photos.

Stage 3: DPO with a Code Checker

Because CAD compilers are non-differentiable, traditional gradient-based optimization cannot directly fix compilation errors. CADCrafter adopts Direct Preference Optimization (DPO), using the CAD compiler as an automated "code checker." By labeling generated sequences as "Valid" or "Invalid," the model is fine-tuned to prefer valid, compilable patterns, effectively learning the underlying grammar of engineering design.

The three-stage CADCrafter pipeline: CAD encoding into latent space, geometry-conditioned diffusion, and DPO-based fine-tuning using a code checker.

Experimental Results

The researchers evaluated CADCrafter on the standard DeepCAD synthetic dataset and a newly introduced RealCAD benchmark. RealCAD consists of 150 3D-printed models from the DeepCAD test set, captured in unconstrained environments using smartphone cameras.

  • Accuracy: On synthetic data, CADCrafter achieved a command accuracy of 83.23%. More impressively, it maintained an 81.23% accuracy on the RealCAD dataset, whereas previous state-of-the-art methods saw their performance drop significantly (to ~56%) due to the domain gap.
  • Validity: The DPO fine-tuning stage proved crucial, reducing the Invalid Rate (IR)—the percentage of models that fail to compile—from 12% to just 4% on synthetic data and 8% on real-world data.

Conclusion

CADCrafter represents a significant step forward in automated reverse engineering. By prioritizing geometric features over visual textures and incorporating a compiler-in-the-loop via DPO, it transforms unconstrained photos into professional-grade, editable CAD models. While currently focused on "sketch and extrude" operations, the framework lays the groundwork for more complex generative engineering tools that can bridge the physical and digital design worlds.

Summary updated

BibTeX
@inproceedings{chen2025cadcrafter,
  author = {Cheng Chen and Jiacheng Wei and Tianrun Chen and Chi Zhang and Xiaofeng Yang and Shangzhan Zhang and Bingchen Yang and Chuan-Sheng Foo and Guosheng Lin and Qixing Huang and Fayao Liu},
  title = {{CADCrafter: Generating Computer-Aided Design Models from Unconstrained Images}},
  booktitle = {IEEE/CVF Conference on Computer Vision and Pattern Recognition},
  year = {2025},
  doi = {10.1109/cvpr52734.2025.01034},
}
Figure