欢迎访问中国科学院大学学报,今天是
数学与物理学

基于CSG的二维CAD形状智能解析方法

  • 冯卓航 ,
  • 申立勇
展开
  • 中国科学院大学数学科学学院,北京 100049

收稿日期: 2024-12-09

  修回日期: 2025-03-03

  网络出版日期: 2025-03-26

基金资助

国家自然科学基金(12371384);中央高校基本科研业务费专项资助

An intelligent analysis method for 2D CAD shapes based on CSG

  • Zhuohang FENG ,
  • Liyong SHEN
Expand
  • School of Mathematical Sciences,University of Chinese Academy of Sciences,Beijing 100049,China

Received date: 2024-12-09

  Revised date: 2025-03-03

  Online published: 2025-03-26

摘要

构造实体几何 CSG 技术通过几何基元集与基元间的布尔运算来定义复杂形状,但从已有的几何形状逆向建模恢复 CSG 构造序列一直是富有挑战性的研究问题。提出一种基于Transformer的深度网络架构,解析输入的几何形状,并输出该形状的 CSG 建模序列。采取CSGNet算法作为基线,首先扩充训练所用的合成数据集,使得模型能够学习并解析更广泛的形状。此外,采取VGG编码器-Transformer解码器的自回归学习架构,基于注意力机制更好地关联生成序列,将二维形状输入解析为固定格式的CSG序列输出,得到更好的重建质量。还引入预测有效性矫正模块,确保模型不会输出无效的重建序列。结果表明,本文提出的模型在合成数据集和真实CAD数据集上都能够取得更好的质量。

本文引用格式

冯卓航 , 申立勇 . 基于CSG的二维CAD形状智能解析方法[J]. 中国科学院大学学报, 2026 , 43(5) : 603 -613 . DOI: 10.7523/j.ucas.2025.006

Abstract

Constructive solid geometry (CSG) is a geometric modeling technique that defines complex shapes through Boolean operations between basic geometric primitives. However, reverse modeling to recover the CSG construction sequence from existing geometric shapes has been a challenging research problem. In this paper, we propose a Transformer-based deep network architecture that can parse input geometric shapes and output their corresponding CSG modeling sequences. Using the CSGNet algorithm as a baseline, we first expanded the synthetic dataset used for training, enabling the model to learn and parse a broader range of shapes. Additionally, we adopted an autoregressive learning architecture with a VGG encoder and a Transformer decoder, leveraging the attention mechanism to better correlate the generated sequences. This approach translates 2D shape inputs into CSG sequence outputs in a fixed format, resulting in improved reconstruction quality. We also introduced a validity correction module to ensure that the model does not output invalid reconstruction sequences. Experimental results show that the proposed model achieves better quality on both synthetic and real CAD datasets.

参考文献

[1] Vaswani A, Shazeer N, Parmar N, et al. Attention is all you need[C]//Proceedings of the 31st International Conference on Neural Information Processing Systems. December 4 - 9, 2017, Long Beach, California, USA. New York: ACM, 2017: 6000-6010. DOI: 10.5555 /3295222.3295349 .
[2] Sharma G, Goyal R, Liu D F, et al. CSGNet: neural shape parser for constructive solid geometry[C]//2018 IEEE/CVF Conference on Computer Vision and Pattern Recognition. June 18-23, 2018, Salt Lake City, UT, USA. IEEE, 2018: 5515-5523. DOI:10.1109/CVPR.2018.00578 .
[3] Simonyan K, Zisserman A. Very deep convolutional networks for large-scale image recognition[EB/OL]. arXiv 2014: 1409.1556. (2014-09-04)[2024-12-06]. .
[4] Fischler M A, Elschlager R A. The representation and matching of pictorial structures[J]. IEEE Transactions on Computers1973, C-22(1): 67-92. DOI:10.1109/T-C.1973.223602 .
[5] Felzenszwalb P F, Huttenlocher D P. Pictorial structures for object recognition[J]. International Journal of Computer Vision200561(1): 55-79. DOI:10.1023/B:VISI.0000042934.15159.49 .
[6] Yang Y, Ramanan D. Articulated pose estimation with flexible mixtures-of-parts[C]//CVPR 2011. June 20-25, 2011, Colorado Springs, CO, USA. IEEE, 2011: 1385-1392. DOI:10.1109/CVPR.2011.5995741 .
[7] Weiss D. Geometry-based structural optimization on CAD specification trees[D/OL]. Zurich: ETH Zurich2009[2024-12-06]. .
[8] Foley J, Shapiro V, Vossler D L. Separation for boundary to CSG conversion[J]. ACM Transactions on Graphics199312(1): 35-55. DOI: 10.1145/169728.169723 .
[9] Buchele S F, Crawford R H. Three-dimensional halfspace constructive solid geometry tree construction from implicit boundary representations[C]//Proceedings of the Eighth ACM Symposium on Solid Modeling and Applications. June 16 - 20, 2003, Seattle, Washington, USA. ACM, 2003: 135-144. DOI:10.1145/781606.781629 .
[10] Balog M, Gaunt A, Brockschmidt M, et al. DeepCoder: learning to write programs[EB/OL]. arXiv 2016: 1611.01989. (2016-11-07)[2024-12-06]. .
[11] Johnson J, Hariharan B, Van Der Maaten L, et al. Inferring and executing programs for visual reasoning[C]//2017 IEEE International Conference on Computer Vision (ICCV). October 22-29, 2017, Venice, Italy. IEEE, 2017: 3008-3017. DOI:10.1109/ICCV.2017.325 .
[12] Zhou C H, Li C L, Póczos B. Unsupervised program synthesis for images by sampling without replacement[EB/OL]. arXiv 2020: 2001.10119. (2020-01-21)[2024-12-06]. .
[13] Jones R K, Walke H, Ritchie D. PLAD: learning to infer shape programs with pseudo-labels and approximate distributions[C]//2022 IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR). June 18-24, 2022, New Orleans, LA, USA. IEEE, 2022: 9861-9870. DOI:10.1109/CVPR52688.2022.00964 .
[14] Li L X, Sung M, Dubrovina A, et al. Supervised fitting of geometric primitives to 3D point clouds[C]//2019 IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR). June 15-20, 2019, Long Beach, CA, USA. IEEE, 2019: 2647-2655. DOI:10.1109/CVPR.2019.00276 .
[15] Lambourne J G, Willis K D D, Jayaraman P K, et al. BRepNet: a topological message passing system for solid models[C]//2021 IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR). June 20-25, 2021, Nashville, TN, USA. IEEE, 2021: 12768-12777. DOI:10.1109/CVPR46437.2021.01258 .
[16] Kania K, Zi?ba M, Kajdanowicz T. UCSG-net: unsupervised discovering of constructive solid geometry tree[EB/OL]. arXiv 2020: 2006.09102. (2020-06-16)[2024-12-06]. .
[17] Ren D X, Zheng J M, Cai J F, et al. CSG-stump: a learning friendly CSG-like representation for interpretable shape parsing[C]//2021 IEEE/CVF International Conference on Computer Vision (ICCV). October 10-17, 2021, Montreal, QC, Canada. IEEE, 2021: 12458-12467. DOI:10.1109/ICCV48922.2021.01225 .
[18] Chen Z Q, Tagliasacchi A, Zhang H. BSP-net: generating compact meshes via binary space partitioning[C]//2020 IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR). June 13-19, 2020. Seattle, WA, USA. IEEE, 2020: 42-51. DOI:10.1109/cvpr42600.2020.00012 .
[19] Yu F G, Chen Z Q, Li M Y, et al. CAPRI-net: learning compact CAD shapes with adaptive primitive assembly[C]//2022 IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR). June 18-24, 2022, New Orleans, LA, USA. IEEE, 2022: 11758-11768. DOI:10.1109/CVPR52688.2022.01147 .
[20] Yu F G, Chen Z Q, Tanveer M, et al. D2 CSG: unsupervised learning of compact CSG trees with dual complements and dropouts[EB/OL]. arXiv 2023: 2301.11497. (2023-01-27)[2024-12-06]. .
[21] Wu R D, Xiao C, Zheng C X. DeepCAD: a deep generative network for computer-aided design models[C]//2021 IEEE/CVF International Conference on Computer Vision (ICCV). October 10-17, 2021, Montreal, QC, Canada. IEEE, 2021: 6752-6762. DOI:10.1109/ICCV48922.2021.00670 .
[22] Xu X, Willis K D D, Lambourne J G, et al. SkexGen: autoregressive generation of CAD construction sequences with disentangled codebooks[EB/OL]. arXiv 2022: 2207.04632. (2022-07-11)[2024-12-06]. .
[23] Khan M S, Dupont E, Ali S A, et al. CAD-SIGNet: CAD language inference from point clouds using layer-wise sketch instance guided attention[C]//2024 IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR). June 16-22, 2024, Seattle, WA, USA. IEEE, 2024: 4713-4722. DOI:10.1109/CVPR52733.2024.00451 .
[24] Yang B C, Jiang H Y, Pan H, et al. PS-CAD: local geometry guidance via prompting and selection for CAD reconstruction[EB/OL]. arXiv 2024: 2405.15188. (2024-05-24)[2024-12-06]. .
[25] 何皓辰,方正,卢政达,等. PT-MFR:一种基于Point Transformer的CAD模型加工特征识别方法[J].中国科学院大学学报202643(1):115-124. DOI:10.7523/j.ucas.2024.041 .
[26] 黄玉林,梁磊,李卫军,等.基于多尺度特征和注意力机制的深度学习点云压缩[J].中国科学院大学学报202441(5): 687-694. DOI:10.7523/j.ucas.2023.077 .
文章导航

/