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.
使用深度学习的形状解析中,二维领域的相关文献并不多,但已有研究者利用神经网络来推断一些通过特定领域语言表达的程序,例如Balog等[10]提出的DeepCoder,是一种使用深度学习自动编程的方法,可以根据输入输出示例生成程序。Johnson等[11]则提出一种视觉推理模型,根据程序生成器和执行引擎来显式获取推理预测过程。此后,Sharma等[2]提出了在二维图形解析领域中具有代表性的工作CSGNet,该方法使用神经网络生成一组由形状建模指令组成的程序,继而通过形状渲染器组合建模形状来匹配目标图像。Zhou等[12]则提出一种无监督学习模型,该模型无需预训练,结合语法编码树LSTM及路径采样来解析形状。Jones等[13]通过引入伪标签和近似分布(pseudo-labels and approximate distributions, PLAD)构造数据对,提出PLAD训练框架,将一系列相关的自监督学习技术分组,用于形状程序推理。受上述研究工作的启发,本文延续图形编码与序列解码相结合的解析框架,设计并提出一种CAD语言序列生成模型。该模型有效整合多个模块组件,并结合监督学习、强化学习以及PLAD训练方法,实验结果表明其性能优于现有主流的二维形状解析模型。
VaswaniA, ShazeerN, ParmarN, 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]
SharmaG, GoyalR, LiuD 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]
SimonyanK, ZissermanA. Very deep convolutional networks for large-scale image recognition[EB/OL]. arXiv 2014: 1409.1556. (2014-09-04)[2024-12-06].
[4]
FischlerM A, ElschlagerR A. The representation and matching of pictorial structures[J]. IEEE Transactions on Computers, 1973, C-22(1): 67-92. DOI:10.1109/T-C.1973.223602 .
[5]
FelzenszwalbP F, HuttenlocherD P. Pictorial structures for object recognition[J]. International Journal of Computer Vision, 2005, 61(1): 55-79. DOI:10.1023/B:VISI.0000042934.15159.49 .
[6]
YangY, RamananD. 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]
WeissD. Geometry-based structural optimization on CAD specification trees[D/OL]. Zurich: ETH Zurich, 2009[2024-12-06].
[8]
FoleyJ, ShapiroV, VosslerD L. Separation for boundary to CSG conversion[J]. ACM Transactions on Graphics, 1993, 12(1): 35-55. DOI: 10.1145/169728.169723 .
[9]
BucheleS F, CrawfordR 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]
BalogM, GauntA, BrockschmidtM, et al. DeepCoder: learning to write programs[EB/OL]. arXiv 2016: 1611.01989. (2016-11-07)[2024-12-06].
[11]
JohnsonJ, HariharanB, Van Der MaatenL, 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]
ZhouC H, LiC L, PóczosB. Unsupervised program synthesis for images by sampling without replacement[EB/OL]. arXiv 2020: 2001.10119. (2020-01-21)[2024-12-06].
[13]
JonesR K, WalkeH, RitchieD. 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]
LiL X, SungM, DubrovinaA, 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]
LambourneJ G, WillisK D D, JayaramanP 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 .
RenD X, ZhengJ M, CaiJ 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]
ChenZ Q, TagliasacchiA, ZhangH. 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]
YuF G, ChenZ Q, LiM 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]
YuF G, ChenZ Q, TanveerM, 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]
WuR D, XiaoC, ZhengC 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]
XuX, WillisK D D, LambourneJ 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]
KhanM S, DupontE, AliS 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]
YangB C, JiangH Y, PanH, 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].