Discovering Design Concepts for CAD Sketches Yuezhi Yang The University of Hong Kong

2025-05-03 0 0 2.21MB 24 页 10玖币
侵权投诉
Discovering Design Concepts for CAD Sketches
Yuezhi Yang
The University of Hong Kong
Microsoft Research Asia
yzyang@cs.hku.hk
Hao Pan
Microsoft Research Asia
haopan@microsoft.com
Abstract
Sketch design concepts are recurring patterns found in parametric CAD sketches.
Though rarely explicitly formalized by the CAD designers, these concepts are
implicitly used in design for modularity and regularity. In this paper, we propose a
learning based approach that discovers the modular concepts by induction over raw
sketches. We propose the dual implicit-explicit representation of concept structures
that allows implicit detection and explicit generation, and the separation of structure
generation and parameter instantiation for parameterized concept generation, to
learn modular concepts by end-to-end training. We demonstrate the design concept
learning on a large scale CAD sketch dataset and show its applications for design
intent interpretation and auto-completion.
1 Introduction
Parametric CAD modeling is a standard paradigm for mechanical CAD design nowadays. In
parametric modeling, CAD sketches are fundamental 2D shapes used for various 3D construction
operations. As shown in Fig. 1, a CAD sketch is made of primitive geometric elements (e.g. lines,
arcs, points) which are constrained by different relationships (e.g. coincident, parallel, tangent); the
sketch graph of primitive elements and constraints captures design intents, and allows adaptation and
reuse of designed parts by changing parameters and updating all related elements automatically [
1
].
Designers are therefore tasked with the meticulous design of such sketch graphs, so that the inherent
high-level design intents are easy to interpret and disentangle. To this end, meta-structures (Fig. 1),
which we call sketch concepts in this paper, capture repetitive design patterns and regulate the design
process with more efficient intent construction and communication [
9
,
12
]. Concretely, each sketch
concept is a structure that encapsulates specific primitive elements and their compositional constraints,
and the interactions of its internal elements with outside only go through the interface of the concept.
How to discover these modular concepts automatically from raw sketch graphs? In this paper, we cast
this task as a program library induction problem by formulating a domain specific language (DSL) for
sketch generation, where a sketch graph is formalized as a program, and sketch concepts are modular
functions that abstract primitive elements and compose the program (Fig. 1). Discovering sketch
concepts thus becomes the induction of library functions from sketch programs. While previous
works address the general library induction problem via expensive combinatorial search [
20
,
5
,
7
],
we present a simple end-to-end deep learning solution for sketch concepts. Specifically, we bridge
the implicit and explicit representations of sketch concepts, and separate concept structure generation
from parameter instantiation, so that a powerful deep network can detect and generate sketch concepts,
by training with the inductive objective of reconstructing sketch with modular concepts.
We conduct experiments on large-scale sketch datasets [
17
]. The learned sketch concepts show that
they provide modular interpretation of design sketches. The network can also be trained on incomplete
input sketches and learn to auto-complete them. Comparisons with state-of-the-art approaches that
Work done during internship at Microsoft Research Asia.
36th Conference on Neural Information Processing Systems (NeurIPS 2022).
arXiv:2210.14451v1 [cs.LG] 26 Oct 2022
Coinc. Coinc.
Coinc.
In arg: 1
Arc
Out arg: 0
Tangent
Out arg: 1
Coinc.
Arc
Out arg:1
Tangent
Coinc.
Out arg:0 Coinc.
Line
Line
Line
Line
Parallel
Distance
Perpend.
Horizon.
Tangent
Line
Line
Coinc.
Line
Coinc.
Arc
Parallel
Distance
Arc
Coinc.
Line
Perpend
Coinc. Coinc.
Horizon.
Tangent
Coinc.
Coinc.
Coinc.
Coinc.
Coinc.
In arg:0
(a) S.t0:T1
0
S.t1:T1
0
S.t2:T1
1
(b) Learned program that restructures the sketch:
T1
0λ(αo
0, αo
1).{t0:Arc, t1:Tang., t2, t3:Coinc., R={t1(t0, αo
0), t2(t0, αo
0), t3(t0, αo
1)}}
T1
1λ(αi
0, αi
1).{t0,t1,t2,t3:Line, t4,t5,t6,t7:Coinc., t8:Perpend., t9:Parallel, t10 :Distance, t11 :Horizon,
R={t4(t0, t3), t5(t0, t2), t0(t1, t2), t7(t1, t3), t8(t1, t2), t9(t2, t3), t10 (t2, t3), t11 (t3), αi
0(t1), αi
1(t0)}}
S→{t0,t1:T1
0,t2:T1
1, R={t0(t2i
1, t2i
0), t1(t2i
0, t2i
1)}}
Figure 1:
Concept learning from sketch graphs
.
(a)
In black are the raw sketch and its constraint
graph, with nodes showing primitives and edges depicting constraints. Colored are the restructured
sketch and its modular constraint graph, where each module box represents a concept; primitives and
constraint edges are colored according to the modular concepts.
(b)
The restructured sketch graph in
our DSL program representation (List 1), where the whole sketch
S
is compactly constructed with
three instances of two learned L1types. We simplify notation super/sub-scripts for readability.
solve sketch graph generation through autoregressive models show that the modular sketch concepts
learned by our approach enable more accurate and interpretable completion results.
To summarize, we make the following contributions in this paper:
We formulate the task of discovering modular CAD sketch concepts as program library
induction for a declarative DSL modeling sketch graphs.
We propose a self-supervised deep learning framework that discovers modular libraries for
the DSL with simple end-to-end training.
We show the framework learns from large-scale datasets sketch concepts capturing intuitive
and reusable components, and enables structured sketch interpretation and auto-completion.
2 Related work
Concept discovery for CAD sketch
It is well acknowledged in the CAD design community that
design intents are inherent to and implicitly encoded by the combinations of geometric primitives and
constraints [
12
,
10
]. However, there is generally no easy approach to discover the intents and make
them explicit, albeit through manual design of meta-templates guided by expert knowledge [
9
,
10
].
We propose an automatic approach to discover such intents, by formulating the intents as modular
structures with self-contained references, and learning them through self-supervised inductive training
with simple objectives on large raw sketch dataset. Therefore, we provide an automatic approach for
discovering combinatorially complex structures through end-to-end neural network learning.
Generative models for CAD sketch
A series of recent works [
6
,
24
,
13
,
18
,
25
] use autoregressive
models [
22
] to generate CAD sketches and constraints modeled through pointer networks [
23
]. These
works focus on learning from large datasets [
17
] to generate plausible layouts of geometric primitives
and their constraints, which can then be fine-tuned with a constraint solver for more regular sketches.
Different from these works, our aim is to discover modular structures (i.e. sketch concepts) from the
concrete sketches. Therefore, our framework provides higher-level interpretation of raw sketches and
more transparent auto-completion than these works (cf. Sec. 6).
Program library induction for CAD modeling
Program library induction has been studied in
the shape modeling domain [
7
]. General program synthesis assisted by deep learning is a research
topic with increasing popularity [
20
,
3
,
4
,
19
,
5
]. The library induction task specifically involves
combinatorial search, as has been handled by neural guided search [
20
,
5
] or by pure stochastic
sampling [
7
]. We instead present an end-to-end learning algorithm for sketch concept induction.
In particular, based on key observations about sketch concepts, we present implicit-explicit dual
representations of concept library functions, and separate the concept structure generation from
parameter instantiation, to enable self-supervised training with induction objectives.
2
List 1: A domain-specific language formulating CAD sketch concepts
// Basic data types
Length, Angle, Coord, Ref
// L0primitive types
Line cstart_x, cstart_y, cend_x, cend_y: Coord
Circle ccenter_x, ccenter_y: Coord, lradius : Length
· · ·
// L0constraint types
Coincident λ(r1, r2:Ref).{}
Parallel Distance λ(r1, r2:Ref).{ldist : Length}
· · ·
// L1composite types
T1
iλ([αk:Ref]).{t0
i,j :T0
jL0, RT1
i[t0
i,j ][αk]}
// Sketch decomposition
S→ {t1
i:T1
iL1, RS([t1
i])}
3 CAD sketch concept formulation
To capture the notion of sketch concepts precisely, we formulate a domain specific language (DSL)
(syntax given in List 1, an exhaustive list of data types given in the supplementary). In the DSL, we
first define the basic data types, including length, angle, coordinate, and the reference type, where a
reference binds to another reference or a primitive for modeling the constraint relationships. Second,
we define the
L0
collection of primitive and constraint types as given in raw sketches. In particular,
we regard the constraints as functions whose arguments are the references to bind with primitives, e.g.
a coincident constraint
c=λ(r1, r2:Ref).{}
, where a function is represented in the lambda calculus
style (one may refer to [
14
] for introductory lambda calculus formality). Some constraints have
parameters other than mere references, which are treated as variables inside, e.g. parallel distance in
List 1
2
. Third, we define the sketch concepts as
L1
types composed of
L0
types. To be specific, a
composite type
T1
iL1
is a function with arguments
[αk]
and members
t0
i,j :T0
jL0
, which are
connected through a composition operator
RT1
i={p(q)|p, q [t0
i,j ][αk]}
that specifies how each
pair of primitive elements binds together. For example, a coincident constraint
p=λ(r1, r2).{}
may
take a line primitive
q
as its first argument and bind to an argument
αk
of the composite type as its
second argument, i.e.
p(q, αk)RT1
i
; on the other hand, an argument
αk
may bind to a primitive
q
, which is specified by
αk(q)RT1
i
. Finally, an input sketch
S
is restructured as a collection of
composite types
t1
i:T1
iL1
, as well as their connections specified by a corresponding composition
operator
RS
.
RS
records how different concepts bind through their arguments, which further transfers
to
L0
typed elements inside the concepts and translates into the raw constraint relationships of the
sketch graph. Fig. 1(b) shows an example DSL program encoding sketches and concepts.
Given the explicit formulation of CAD sketches through a DSL, the discovery of sketch concepts
becomes the task of learning program libraries
L1
by induction on many sketch samples. Therefore,
our task resembles shape program synthesis that aims at building modular programs for generating
shapes [
5
,
7
], and differs from works that use autoregressive language models to generate CAD sketch
programs one token at a time [
6
,
13
,
18
]. In Sec. 6.2, we show that the structured learning of CAD
sketches enables more robust auto-completion than unstructured language modeling.
The search of structured concepts is clearly a combinatorial problem with exponential complexity,
which is intractable unless we can exploit the inherent patterns in large-scale sketch datasets. However,
to enable deep learning based detection and search of structured concepts, we need to bridge the
implicit deep representations and the explicit and interpretable structures, which we build through the
following two key observations:
A concept has dual representations
: implicit and explicit. The implicit representation as
embeddings in latent spaces is compatible with deep learning, while the explicit representa-
tion provides structures on which desired properties (e.g. modularity) can be imposed.
2
While other works [
13
,
18
] have skipped such constraints, we preserve them but omit generating the
parameter values that can be reliably deduced from primitives. See more discussions in the supplementary.
3
input sketch S=[t0
i]
[e0
t0
i
]
[qi]
[qi]
qR
qR
q0
q0
q0
0
concept lib L1structure T1
instance t1
[t1
i]
RS
assemble
generation
loss
target
Struct
Param
Encoder Decoder
(a) detection module (b) generation module (c) loss computation
Figure 2:
Framework illustration
.
(a)
The detection module is a transformer network that detects
from the sketch sequence
[t0
i]
implicitly encoded concepts
[qi]
and their composition
qR
.
(b)
Each
q
is quantized against the concept library
L1
to obtain prototype
q0
, which is expanded by structure
network into an explicit structure
T1
and further instantiated by parameter network into
t1
.
(c)
The
collection of
[t1
i]
are assembled by composition operator
RS
generated from
qR
to obtain the final
generated sketch graph, which is compared with the input sketch for loss computation.
A concept is a parameterized structure
. A concept is a composite type with fixed modular
structure for interpretability, but the structure is always instantiated by assigning parameters
to its component primitives when the concept is found in a sketch.
3.1 Method overview
According to the two observations, we design an end-to-end sketch concept learning framework by
self-supervised induction on sketch graphs. As shown in Fig. 2, the framework has two main steps
before loss computation: a detection step that generates implicit representations of concepts making
up the input sketch, and an explicit generation step that expands the implicit concepts into concrete
structures on which self-supervision targets like reconstruction and modularity are applied.
Building on a state-of-the-art detection architecture [
2
], the detection module
D
takes a sketch
S
as
input and detects the modular concepts within it, i.e.
{qi}=D(S, {qi})
, where the concepts are
represented implicitly as latent codes
{qi}
, and
{qi}
are a learnable set of concept instance queries.
Notably, we apply vector quantization to the latent codes and obtain
{q0
i= minpL1||pqi||2}
,
which ensures that each concept is selected from the common collection of learnable concepts
L1
used for restructuring all sketches.
The explicit generation module is separated into two sub-steps, structure generation and parameter
instantiation, which ensures that the modular concept structures are explicit and reused throughout
different sketch instances. Specifically, the structure network takes each quantized concept code
q0
i
and generates its explicit form
T1
i
in terms of primitives and constraints of
L0
types along with the
composition operator
RT1
i
. Subsequently, the parameter network instantiates the concept structure by
assigning parameter values to each component of
T1
i
conditioned on
qi
and input sketch, to obtain
t1
i
.
The composition operator
RS
for combining
{t1
i}
is generated from a special latent code
qR
trans-
formed by Dfrom a learnable token qRappended to {qi}.
The entire model is trained end-to-end by reconstruction and modularity objectives. In particular,
we design loss functions that measure differences between the generated and groundtruth sketch
graphs, in terms of both per-element attributes and pairwise references. Given our explicit modeling
of encapsulated structures of the learned concepts, we can further enhance the modularity of the
generation by introducing a bias loss that encourages in-concept references.
4 End-to-end sketch concept induction
4.1 Implicit concept detection
Sketch encoding
A raw sketch
S
can be serialized into a sequence of
L0
primitives and constraints.
Previous works have adopted slightly different schemes to encode the sequence [
6
,
13
,
18
,
24
,
25
].
In this paper, we build on the previous works and take a simple strategy akin to [
13
,
25
] for input
sketch encoding. Specifically, we split each
L0
typed instance
t0
into several tokens: type,parameter,
and a list of references. For each of the token category, we use a specific embedding module. For
4
example, parameters as scalars are quantized into finite bins before being embedded as vectors (see
supplementary for the quantization details), and since there are at most five parameters for each
primitive, we pack all parameter embeddings into a single code. On the other hand, each constraint
reference as a primitive index is directly embedded as a code. Therefore, each token of a
L0
typed
instance is encoded as
et0.x =enctype(t0) + encpos(t0.x) + encparam(t0.x)|encref (t0.x),(1)
where
t0.x
iterates over the split tokens (i.e., type, parameters, references), the type embedding is
shared for all tokens of the instance, the position embedding counts the token index in the whole
split-tokenized sequence of
S
, and parameter or reference embeddings are applied where applicable.
Concept detection
We build the detection network as an encoder-decoder transformer following
[
2
]. The transformer encoder operates on the sketch encoded sequence
[et0
iS]
and produces the
contextualized sequence
[e0
t0
iS]
through layers of self-attention and feed-forward. The transformer
decoder takes a learnable set of concept queries
[qi]
of size
kqry
plus a special query
qR
for
composition generation, and applies interleaved self-attention, cross-attention to
[e0
t0
i]
and feed-
forward layers to obtain the implicit concept codes
[qi]
and
qR
. The concept codes are further
quantized into
[q0
i]
by selecting concept prototypes from a library
L1
implicitly encoding
L1
, before
being expanded into explicit forms.
4.2 Explicit concept structure generation
Concept structure expansion
Given a library code
q0L1
representing a type
T1L1
, through
an MLP we expand its explicit structure as a collection of codes
[t0
i]
representing the
L0
type instances
[t0
i]and a matrix representing the composition RT1of [t0
i]and arguments (cf. List 1).
concept A concept B
RS
primitive constraint
inward arg outward arg
We fix the maximum number of
L0
type instances to
kL0
(12 by default), and
split the arguments into two groups, inward arguments and outward arguments,
each of maximum number
karg
(2 by default). Each type code
t0
i
is decoded
into discrete probabilities over
L0
with an additional probability for null type
φ
to indicate the emptiness of this element (cf. Sec. 5.1), by
dectype(·)
as
the inverse of
enctype(·)
in Sec. 4.1. An inward argument only points to a
primitive inside the concept structure and originates from a constraint outside,
and conversely an outward argument only points to primitives outside and
originates from a constraint inside the concept (see inset for illustration); the split into two groups
eases composition computation, as discussed below.
The composition operator
RT1
is implemented as an assignment matrix
RT1
of shape
(2kL0+karg )×
(kL0+karg )
, where each row corresponds to a constraint reference or inward argument, and each
column to a primitive or outward argument. The two-fold coefficient of constraint references comes
from that any constraint we considered in the dataset [
17
] has at most two arguments. Each row is a
discrete probability distribution such that
PjRT1[i, j] = 1
, with the maximum entry signifying that
the
i
-th constraint/outward argument refers to the
j
-th primitive/inward argument. We compute
RT1
by first mapping the concept code
q0
to a matrix of logits in the shape of
RT1
, and then applying
softmax transform for each row. Notably, we avoid the meaningless loops of an element referring
back to itself, and inward arguments referring to outward arguments, by masking the diagonal blocks
RT1[2i:2i+2, i], i[kL0]and the argument block RT1[2kL0:, kL0:] by setting their logits to −∞.
Cross-concept composition
Aside from references inside a concept, references across concepts are
generated to complete the whole sketch graph. We achieve cross-concept references by argument
passing (see inset above for illustration). In particular, we implement the cross-concept composition
operator
RS
as an assignment matrix
RS
of shape
(kqry·karg)×(kqry ·karg)
directly mapped from
qR
through an MLP. Similar to the in-concept composition matrix, each row of the cross-concept matrix
is a discrete distribution such that
PjRS[i, j]=1
, with the maximum entry signifying that the
(imod karg )
-th outward argument of the
bi/karg c
-th concept instance refers to the
(jmod karg )
-th
inward argument of the bj/kargc-th concept instance.
The complete cross-concept reference is therefore the product of three transport matrices:
Rcref [t1
i, t1
j] = Rt1
i[:2kL0, kL0:]×RS[i·karg :(i+1)·karg, j·karg:(j+1)·karg]×Rt1
j[2kL0:,:kL0],
5
摘要:

DiscoveringDesignConceptsforCADSketchesYuezhiYangTheUniversityofHongKongMicrosoftResearchAsiayzyang@cs.hku.hkHaoPanMicrosoftResearchAsiahaopan@microsoft.comAbstractSketchdesignconceptsarerecurringpatternsfoundinparametricCADsketches.ThoughrarelyexplicitlyformalizedbytheCADdesigners,theseconceptsare...

展开>> 收起<<
Discovering Design Concepts for CAD Sketches Yuezhi Yang The University of Hong Kong.pdf

共24页,预览5页

还剩页未读, 继续阅读

声明:本站为文档C2C交易模式,即用户上传的文档直接被用户下载,本站只是中间服务平台,本站所有文档下载所得的收益归上传人(含作者)所有。玖贝云文库仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对上载内容本身不做任何修改或编辑。若文档所含内容侵犯了您的版权或隐私,请立即通知玖贝云文库,我们立即给予删除!
分类:图书资源 价格:10玖币 属性:24 页 大小:2.21MB 格式:PDF 时间:2025-05-03

开通VIP享超值会员特权

  • 多端同步记录
  • 高速下载文档
  • 免费文档工具
  • 分享文档赚钱
  • 每日登录抽奖
  • 优质衍生服务
/ 24
客服
关注