{"id":677,"date":"2022-08-11T23:29:59","date_gmt":"2022-08-11T23:29:59","guid":{"rendered":"http:\/\/summergeometry.org\/sgi2022\/?p=677"},"modified":"2022-08-11T23:29:59","modified_gmt":"2022-08-11T23:29:59","slug":"text-guided-shape-assembly","status":"publish","type":"post","link":"https:\/\/summergeometry.org\/sgi2022\/text-guided-shape-assembly\/","title":{"rendered":"Text-Guided Shape Assembly"},"content":{"rendered":"\n<p class=\"has-text-align-center wp-block-paragraph\"><em>By Tiago De Souza Fernandes,  Bryan Dumond, Daniel Scrivener and Vivien van Veldhuizen<\/em><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">If you have been keeping up with some of the recent developments in artificial intelligence, you might have seen AI models that can generate images from a text-based description, such as CLIP or <a href=\"https:\/\/huggingface.co\/spaces\/dalle-mini\/dalle-mini\">DALL\u00b7E<\/a>. These models are able to generate completely new images from just a single text-prompt (see for example <a href=\"https:\/\/twitter.com\/weirddalle?lang=en\">this twitter account<\/a>). Models such as CLIP and DALL\u00b7E operate by embedding text and images in the same vector space, which makes it possible to frame the image synthesis as an optimization problem, ie: find&nbsp; an image that, when processed by a neural network, yields an embedding similar to a corresponding text embedding. A problem with this setup, however, is that it is severely underconstrained: there are many such images and some of them are not very interesting from the perspective of a human. To circumvent this issue, previous research has focused on incorporating priors into this optimization.&nbsp;<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Over the last few weeks, our team, under the supervision of Matheus Gadelha from Adobe Research, looked into a specific instance of such constraints: namely, what would happen if the images could only be formed through a simple assembly of geometric primitives (spheres, cuboids, planes, etc)?<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">An Overview of the Optimization Problem<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">The ability to unite text and images in the same vector space through neural networks like CLIP lends itself to an intuitive formulation of the problem we&#8217;d like to solve: What image comprising a set of geometric primitives is most similar to a given text prompt?<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">We&#8217;ll represent CLIP&#8217;s mapping between images\/text and vectors as a function, $\\phi$. Since CLIP represents text and images alike as n-dimensional vectors, we can measure their similarity in terms of the angle between the two vectors. Assuming that the vectors it generates are normalized, the cosine of the angle between them is simply the dot product \\(\\langle \\phi(Image), \\phi(Text) \\rangle\\). Minimizing this quantity with respect to the image generated from our geometric primitive of choice should yield a locally optimal solution: something that more closely approximates the desired text prompt than its neighbors.<\/p>\n\n\n\n<figure class=\"wp-block-gallery aligncenter has-nested-images columns-default is-cropped wp-block-gallery-1 is-layout-flex wp-block-gallery-is-layout-flex\">\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"256\" height=\"256\" data-id=\"686\" src=\"http:\/\/summergeometry.org\/sgi2022\/wp-content\/uploads\/2022\/08\/image7.jpg\" alt=\"\" class=\"wp-image-686\" srcset=\"https:\/\/summergeometry.org\/sgi2022\/wp-content\/uploads\/2022\/08\/image7.jpg 256w, https:\/\/summergeometry.org\/sgi2022\/wp-content\/uploads\/2022\/08\/image7-150x150.jpg 150w\" sizes=\"auto, (max-width: 256px) 100vw, 256px\" \/><\/figure>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"256\" height=\"256\" data-id=\"680\" src=\"http:\/\/summergeometry.org\/sgi2022\/wp-content\/uploads\/2022\/08\/image1.jpg\" alt=\"\" class=\"wp-image-680\" srcset=\"https:\/\/summergeometry.org\/sgi2022\/wp-content\/uploads\/2022\/08\/image1.jpg 256w, https:\/\/summergeometry.org\/sgi2022\/wp-content\/uploads\/2022\/08\/image1-150x150.jpg 150w\" sizes=\"auto, (max-width: 256px) 100vw, 256px\" \/><\/figure>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"318\" height=\"323\" data-id=\"694\" src=\"http:\/\/summergeometry.org\/sgi2022\/wp-content\/uploads\/2022\/08\/combi.png\" alt=\"\" class=\"wp-image-694\" srcset=\"https:\/\/summergeometry.org\/sgi2022\/wp-content\/uploads\/2022\/08\/combi.png 318w, https:\/\/summergeometry.org\/sgi2022\/wp-content\/uploads\/2022\/08\/combi-295x300.png 295w\" sizes=\"auto, (max-width: 318px) 100vw, 318px\" \/><\/figure>\n<figcaption class=\"blocks-gallery-caption\"><em>Two sample images \u2014 a golden retriever and a 2006 Toyota Camry \u2014 alongside their respective descriptions according to CLIP. The cosine similarity of the first image relative to the prompt \u201ca golden retriever\u201d is 0.2690, compared to 0.1586 for the second image.<\/em><\/figcaption><\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">In order to get a sense of where the solution might exist relative to our starting point, we&#8217;d like all operations involved in the process of computing this similarity score to be differentiable. That way, we&#8217;ll be able to follow the gradient of the function and use it to update our image at each step.&nbsp;<br>To achieve our goals within a limited two-week timeframe, we desire rasterizers built on simple but powerful frameworks that would allow for as rapid iteration as possible. As such, PyTorch-based differentiable renderers like <a href=\"https:\/\/github.com\/BachiLi\/diffvg\">diffvg<\/a> (2D) and <a href=\"https:\/\/github.com\/NVlabs\/nvdiffrast\">Nvdiffrast<\/a> (3D) provide the machinery to relate image embeddings with the parameters used to draw our primitives to the screen: we&#8217;ll be making extensive use of both throughout this project.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">2D Shape Optimization<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">We started by looking at the 2D case, taking <a href=\"https:\/\/arxiv.org\/abs\/2106.14843\">this paper<\/a> as our basis. In this paper, the authors propose CLIPDraw: an algorithm that creates drawings from textual input. The authors use a pre-trained CLIP language-image encoder as a metric for maximizing the similarity between the given description and a generated drawing. This idea is similar to what our project hopes to accomplish, with the main difference being that CLIPDraw operates over vector strokes. We tried a couple of methods to make the algorithm more geometrically aware, the first of which is some data augmentations.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">By default, the optimizer has too much creative leeway to interpret which images match our text prompt, leading to some borderline incomprehensible results. Here\u2019s an example of a result that CLIP identifies as a \u201cgolden retriever\u201d when left to its own devices:<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"224\" height=\"224\" src=\"http:\/\/summergeometry.org\/sgi2022\/wp-content\/uploads\/2022\/08\/image12-2.png\" alt=\"\" class=\"wp-image-720\" srcset=\"https:\/\/summergeometry.org\/sgi2022\/wp-content\/uploads\/2022\/08\/image12-2.png 224w, https:\/\/summergeometry.org\/sgi2022\/wp-content\/uploads\/2022\/08\/image12-2-150x150.png 150w\" sizes=\"auto, (max-width: 224px) 100vw, 224px\" \/><figcaption><em>Prompt = \u201ca golden retriever\u201d after 8400 iterations<\/em><\/figcaption><\/figure>\n<\/div>\n\n\n<p class=\"wp-block-paragraph\">Here, the optimizer gets the general color palette right while missing out completely on the geometric features of the image. Fortunately, we can force the optimizer to approach the problem in a more comprehensive manner by \u201caugmenting\u201d (transforming) the output at each step. In our case, we applied four random perspective &amp; crop transformations (as do the authors of CLIPDraw) and a grayscale transformation at each step. This forces the optimizer to imitate human perception in the sense that it must identify the same object when viewed under different ambient conditions.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Fortunately, the introduction of data augmentations produced near-instant improvements in our results! Here is a taste of what the neural network can generate using triangles:<\/p>\n\n\n\n<figure class=\"wp-block-gallery aligncenter has-nested-images columns-4 is-cropped wp-block-gallery-2 is-layout-flex wp-block-gallery-is-layout-flex\">\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"704\" height=\"396\" data-id=\"724\" src=\"http:\/\/summergeometry.org\/sgi2022\/wp-content\/uploads\/2022\/08\/Empty.png\" alt=\"\" class=\"wp-image-724\" srcset=\"https:\/\/summergeometry.org\/sgi2022\/wp-content\/uploads\/2022\/08\/Empty.png 704w, https:\/\/summergeometry.org\/sgi2022\/wp-content\/uploads\/2022\/08\/Empty-300x169.png 300w\" sizes=\"auto, (max-width: 704px) 100vw, 704px\" \/><\/figure>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"800\" height=\"800\" data-id=\"701\" src=\"http:\/\/summergeometry.org\/sgi2022\/wp-content\/uploads\/2022\/08\/image3-1.png\" alt=\"\" class=\"wp-image-701\" srcset=\"https:\/\/summergeometry.org\/sgi2022\/wp-content\/uploads\/2022\/08\/image3-1.png 800w, https:\/\/summergeometry.org\/sgi2022\/wp-content\/uploads\/2022\/08\/image3-1-300x300.png 300w, https:\/\/summergeometry.org\/sgi2022\/wp-content\/uploads\/2022\/08\/image3-1-150x150.png 150w, https:\/\/summergeometry.org\/sgi2022\/wp-content\/uploads\/2022\/08\/image3-1-768x768.png 768w\" sizes=\"auto, (max-width: 800px) 100vw, 800px\" \/><figcaption>Prompt = &#8220;a Golden Retriever&#8221;<\/figcaption><\/figure>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"800\" height=\"800\" data-id=\"700\" src=\"http:\/\/summergeometry.org\/sgi2022\/wp-content\/uploads\/2022\/08\/image18.png\" alt=\"\" class=\"wp-image-700\" srcset=\"https:\/\/summergeometry.org\/sgi2022\/wp-content\/uploads\/2022\/08\/image18.png 800w, https:\/\/summergeometry.org\/sgi2022\/wp-content\/uploads\/2022\/08\/image18-300x300.png 300w, https:\/\/summergeometry.org\/sgi2022\/wp-content\/uploads\/2022\/08\/image18-150x150.png 150w, https:\/\/summergeometry.org\/sgi2022\/wp-content\/uploads\/2022\/08\/image18-768x768.png 768w\" sizes=\"auto, (max-width: 800px) 100vw, 800px\" \/><figcaption>Prompt = &#8220;a lighthouse&#8221;<\/figcaption><\/figure>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"704\" height=\"396\" data-id=\"725\" src=\"http:\/\/summergeometry.org\/sgi2022\/wp-content\/uploads\/2022\/08\/Empty-copy.png\" alt=\"\" class=\"wp-image-725\" srcset=\"https:\/\/summergeometry.org\/sgi2022\/wp-content\/uploads\/2022\/08\/Empty-copy.png 704w, https:\/\/summergeometry.org\/sgi2022\/wp-content\/uploads\/2022\/08\/Empty-copy-300x169.png 300w\" sizes=\"auto, (max-width: 704px) 100vw, 704px\" \/><\/figure>\n<\/figure>\n\n\n\n<h3 class=\"wp-block-heading\">Generating Meshes<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">In addition to manipulating individual shapes, we also tried to generate 2D triangular meshes using CLIP and diffvg. Since diffvg doesn\u2019t provide automatic support for meshes, we circumvented this problem using our own implementation where individual triangles are connected to form a mesh. We started our algorithm with a simple uniform randomly-colored triangulation:<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter is-resized\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/lh6.googleusercontent.com\/tM2x38OR3sH21Fw5Efzk_P36kiJGYTxCp3BWVc6iimd2tMn-rT0jT3e8ZTTeVcKi7LZMirTP1CLv89_M-nk7CNs3mpZFRapsA-MzCIMf9ycEFYtxR4K_opGaq34HTr7iKW6maQxjVjglgLmU-sjlhtY\" alt=\"\" width=\"220\" height=\"220\"\/><figcaption><em>Initial mesh<\/em><\/figcaption><\/figure>\n<\/div>\n\n\n<p class=\"wp-block-paragraph\">Simply following each step in the&nbsp; gradient direction could change their positions individually, destroying the mesh structure. So, at each iteration, we merge together vertices that would have been pushed away from each other. We also prevent triangles from \u201cflipping\u201d, or changing orientation in such a way that would produce an intersection with another existing triangle. Two of the results can be seen below:<\/p>\n\n\n\n<figure class=\"wp-block-gallery aligncenter has-nested-images columns-4 is-cropped wp-block-gallery-3 is-layout-flex wp-block-gallery-is-layout-flex\">\n<figure class=\"wp-block-image size-thumbnail\"><img loading=\"lazy\" decoding=\"async\" width=\"704\" height=\"396\" data-id=\"725\" src=\"http:\/\/summergeometry.org\/sgi2022\/wp-content\/uploads\/2022\/08\/Empty-copy.png\" alt=\"\" class=\"wp-image-725\" srcset=\"https:\/\/summergeometry.org\/sgi2022\/wp-content\/uploads\/2022\/08\/Empty-copy.png 704w, https:\/\/summergeometry.org\/sgi2022\/wp-content\/uploads\/2022\/08\/Empty-copy-300x169.png 300w\" sizes=\"auto, (max-width: 704px) 100vw, 704px\" \/><\/figure>\n\n\n\n<figure class=\"wp-block-image size-thumbnail\"><img loading=\"lazy\" decoding=\"async\" width=\"894\" height=\"897\" data-id=\"718\" src=\"http:\/\/summergeometry.org\/sgi2022\/wp-content\/uploads\/2022\/08\/image5-2.png\" alt=\"\" class=\"wp-image-718\" srcset=\"https:\/\/summergeometry.org\/sgi2022\/wp-content\/uploads\/2022\/08\/image5-2.png 894w, https:\/\/summergeometry.org\/sgi2022\/wp-content\/uploads\/2022\/08\/image5-2-300x300.png 300w, https:\/\/summergeometry.org\/sgi2022\/wp-content\/uploads\/2022\/08\/image5-2-150x150.png 150w, https:\/\/summergeometry.org\/sgi2022\/wp-content\/uploads\/2022\/08\/image5-2-768x771.png 768w\" sizes=\"auto, (max-width: 894px) 100vw, 894px\" \/><figcaption>Prompt = &#8220;Monalisa&#8221;<\/figcaption><\/figure>\n\n\n\n<figure class=\"wp-block-image size-thumbnail\"><img loading=\"lazy\" decoding=\"async\" width=\"670\" height=\"672\" data-id=\"719\" src=\"http:\/\/summergeometry.org\/sgi2022\/wp-content\/uploads\/2022\/08\/image1-3.png\" alt=\"\" class=\"wp-image-719\" srcset=\"https:\/\/summergeometry.org\/sgi2022\/wp-content\/uploads\/2022\/08\/image1-3.png 670w, https:\/\/summergeometry.org\/sgi2022\/wp-content\/uploads\/2022\/08\/image1-3-300x300.png 300w, https:\/\/summergeometry.org\/sgi2022\/wp-content\/uploads\/2022\/08\/image1-3-150x150.png 150w\" sizes=\"auto, (max-width: 670px) 100vw, 670px\" \/><figcaption>Prompt = &#8220;Batman&#8221;<\/figcaption><\/figure>\n\n\n\n<figure class=\"wp-block-image size-thumbnail\"><img loading=\"lazy\" decoding=\"async\" width=\"704\" height=\"396\" data-id=\"724\" src=\"http:\/\/summergeometry.org\/sgi2022\/wp-content\/uploads\/2022\/08\/Empty.png\" alt=\"\" class=\"wp-image-724\" srcset=\"https:\/\/summergeometry.org\/sgi2022\/wp-content\/uploads\/2022\/08\/Empty.png 704w, https:\/\/summergeometry.org\/sgi2022\/wp-content\/uploads\/2022\/08\/Empty-300x169.png 300w\" sizes=\"auto, (max-width: 704px) 100vw, 704px\" \/><\/figure>\n<\/figure>\n\n\n\n<p class=\"wp-block-paragraph\">Throughout this process, we introduce and subsequently undo a lot of changes, making the process inefficient and the convergence slow. Another nice approach is to modify only the colors of the triangles rather than their positions and shapes, allowing us to color the mesh structure like a pixel grid:<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter is-resized\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/lh6.googleusercontent.com\/wIgVnYlCM_DRJpIA0YaZtG5nLEVeF53NzoxpW3kYJz4kbR9-_dNAJP8-qZ3p8-Hosb9Q2embJhEFF6ofAxF83ge7B4UpAyxuFpexQarXzqXB5_6g0GRKsiRyBbP6v0D5_LEFc_LTuRLEzIDR_3gd_YU\" alt=\"\" width=\"220\" height=\"220\"\/><figcaption>Prompt = \u201cBalloon\u201d without changing triangle positions<\/figcaption><\/figure>\n<\/div>\n\n\n<h3 class=\"has-text-align-left wp-block-heading\">Non-differentiable Operations and the Evolutionary Approach<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Up until this point, we&#8217;ve only considered gradient descent as a means of solving our central optimization problem. In reality, certain operations involved in this pipeline are not always guaranteed to be differentiable, especially when it comes to rendering. Furthermore, gradient descent optimization narrows the range of images that we&#8217;re able to explore. Once a locally optimal solution is found, the optimizer tends to &#8220;settle&#8221; on it without experimenting further \u2014 often to the detriment of the result.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">On the other end of the &#8220;random-deterministic&#8221; spectrum are evolutionary models, which work by introducing random changes at each step. Changes that improve the result are preserved through future steps, whereas superfluous or detrimental changes are discarded. Unlike gradient descent optimization, evolutionary approaches are not guaranteed to improve the result at each step, which makes them considerably slower. However, by exploring a wider set of possible changes to the images, rather than just the changes introduced by gradient descent, we gain the ability to explore more images.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Though we did not tune our evolutionary model to the same extent as our gradient descent optimizer, we were able to produce a version of the program that performs simple tasks such as optimizing with respect to the overall image color.<\/p>\n\n\n\n<figure class=\"wp-block-gallery aligncenter has-nested-images columns-4 is-cropped wp-block-gallery-4 is-layout-flex wp-block-gallery-is-layout-flex\">\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"704\" height=\"396\" data-id=\"725\" src=\"http:\/\/summergeometry.org\/sgi2022\/wp-content\/uploads\/2022\/08\/Empty-copy.png\" alt=\"\" class=\"wp-image-725\" srcset=\"https:\/\/summergeometry.org\/sgi2022\/wp-content\/uploads\/2022\/08\/Empty-copy.png 704w, https:\/\/summergeometry.org\/sgi2022\/wp-content\/uploads\/2022\/08\/Empty-copy-300x169.png 300w\" sizes=\"auto, (max-width: 704px) 100vw, 704px\" \/><\/figure>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"224\" height=\"224\" data-id=\"693\" src=\"http:\/\/summergeometry.org\/sgi2022\/wp-content\/uploads\/2022\/08\/image14.png\" alt=\"\" class=\"wp-image-693\" srcset=\"https:\/\/summergeometry.org\/sgi2022\/wp-content\/uploads\/2022\/08\/image14.png 224w, https:\/\/summergeometry.org\/sgi2022\/wp-content\/uploads\/2022\/08\/image14-150x150.png 150w\" sizes=\"auto, (max-width: 224px) 100vw, 224px\" \/><\/figure>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"224\" height=\"224\" data-id=\"687\" src=\"http:\/\/summergeometry.org\/sgi2022\/wp-content\/uploads\/2022\/08\/image8.png\" alt=\"\" class=\"wp-image-687\" srcset=\"https:\/\/summergeometry.org\/sgi2022\/wp-content\/uploads\/2022\/08\/image8.png 224w, https:\/\/summergeometry.org\/sgi2022\/wp-content\/uploads\/2022\/08\/image8-150x150.png 150w\" sizes=\"auto, (max-width: 224px) 100vw, 224px\" \/><\/figure>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"704\" height=\"396\" data-id=\"724\" src=\"http:\/\/summergeometry.org\/sgi2022\/wp-content\/uploads\/2022\/08\/Empty.png\" alt=\"\" class=\"wp-image-724\" srcset=\"https:\/\/summergeometry.org\/sgi2022\/wp-content\/uploads\/2022\/08\/Empty.png 704w, https:\/\/summergeometry.org\/sgi2022\/wp-content\/uploads\/2022\/08\/Empty-300x169.png 300w\" sizes=\"auto, (max-width: 704px) 100vw, 704px\" \/><\/figure>\n<figcaption class=\"blocks-gallery-caption\"><em>Prompt = \u201cred\u201d after 0 and 60 iterations<\/em><\/figcaption><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\">3D Shape Optimization<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Moving into the third dimension not only gives us a whole new set of geometric primitives to play with, but also introduces fascinating ideas for image augmentations, such as changing the position of the virtual camera. While Nvdiffrast provides a powerful interface for rendering in 3D with automatic differentiation, we quickly discovered that we\u2019d need to implement our own geometric framework before we could test its capabilities.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Nvdiffrast&#8217;s renderer is very elegant in its design. It needs only a set of triangles and their indices in addition to a set of vertex colors in order to render a scene. Our first task was to define a set of geometric primitives, as Nvdiffrast doesn&#8217;t provide out-of-the-box support for anything but triangles. For anyone familiar with OpenGL, creating an elementary shape such as a sphere is very similar to setting up a VBO\/EBO. We set to work creating classes for a sphere, a cylinder, and a cube.<\/p>\n\n\n<div class=\"wp-block-image\">\n<figure class=\"aligncenter is-resized\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/lh5.googleusercontent.com\/aQtTwCOsIvjGd_aSp7gMAwKh_W8hNW8jgStP71ZqTxdeoeqPv19onvnamkdTvSDVpwlf0Y9IKP3_2jGXJBH-jZ7tN3wg_sj19qQM_ag8YBU31kUuMRX-HBHcgvKEToZFoewkZy16DofWfmlmV0mnb1g\" alt=\"\" width=\"224\" height=\"224\"\/><figcaption><em>Random configuration of geometric primitives \u2014 a cube, a cylinder, and a sphere \u2014 rendered with Nvdiffrast. One example of an input to our algorithm.<\/em><\/figcaption><\/figure>\n<\/div>\n\n\n<p class=\"wp-block-paragraph\">Because the input to Nvdiffrast is one contiguous set of triangles, we also had to design data structures to mark the boundaries between discrete shapes in our triangle list. We did not want the optimizer to operate erratically on individual triangles, potentially breaking up the connectivity of the underlying shape: to this end, we devised a system by which shapes could only be manipulated by a series of standard linear transformations. Specifically, we allowed the optimizer to rotate, scale, and translate shapes at will. We also optimized according to vertex colors as in our previous 2D implementation.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">With more time, it would have been great to experiment with new augmentations and learning rates for these parameters: however, setting up a complex environment like Nvdiffrast takes more time than one might expect, and so we have only begun to explore different results at the writing of this blog post. Some features that show promising outcomes are color gradient optimization, as well as the general positioning of shapes:<\/p>\n\n\n\n<figure class=\"wp-block-gallery has-nested-images columns-4 is-cropped wp-block-gallery-5 is-layout-flex wp-block-gallery-is-layout-flex\">\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"704\" height=\"396\" data-id=\"725\" src=\"http:\/\/summergeometry.org\/sgi2022\/wp-content\/uploads\/2022\/08\/Empty-copy.png\" alt=\"\" class=\"wp-image-725\" srcset=\"https:\/\/summergeometry.org\/sgi2022\/wp-content\/uploads\/2022\/08\/Empty-copy.png 704w, https:\/\/summergeometry.org\/sgi2022\/wp-content\/uploads\/2022\/08\/Empty-copy-300x169.png 300w\" sizes=\"auto, (max-width: 704px) 100vw, 704px\" \/><\/figure>\n\n\n\n<figure class=\"wp-block-image size-small\"><img loading=\"lazy\" decoding=\"async\" width=\"224\" height=\"224\" data-id=\"690\" src=\"http:\/\/summergeometry.org\/sgi2022\/wp-content\/uploads\/2022\/08\/image11.png\" alt=\"\" class=\"wp-image-690\" srcset=\"https:\/\/summergeometry.org\/sgi2022\/wp-content\/uploads\/2022\/08\/image11.png 224w, https:\/\/summergeometry.org\/sgi2022\/wp-content\/uploads\/2022\/08\/image11-150x150.png 150w\" sizes=\"auto, (max-width: 224px) 100vw, 224px\" \/><figcaption>Prompt = &#8220;red&#8221;<\/figcaption><\/figure>\n\n\n\n<figure class=\"wp-block-image size-small\"><img loading=\"lazy\" decoding=\"async\" width=\"224\" height=\"224\" data-id=\"689\" src=\"http:\/\/summergeometry.org\/sgi2022\/wp-content\/uploads\/2022\/08\/image10.png\" alt=\"\" class=\"wp-image-689\" srcset=\"https:\/\/summergeometry.org\/sgi2022\/wp-content\/uploads\/2022\/08\/image10.png 224w, https:\/\/summergeometry.org\/sgi2022\/wp-content\/uploads\/2022\/08\/image10-150x150.png 150w\" sizes=\"auto, (max-width: 224px) 100vw, 224px\" \/><figcaption>Prompt = &#8220;rainbow&#8221;<\/figcaption><\/figure>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"704\" height=\"396\" data-id=\"724\" src=\"http:\/\/summergeometry.org\/sgi2022\/wp-content\/uploads\/2022\/08\/Empty.png\" alt=\"\" class=\"wp-image-724\" srcset=\"https:\/\/summergeometry.org\/sgi2022\/wp-content\/uploads\/2022\/08\/Empty.png 704w, https:\/\/summergeometry.org\/sgi2022\/wp-content\/uploads\/2022\/08\/Empty-300x169.png 300w\" sizes=\"auto, (max-width: 704px) 100vw, 704px\" \/><\/figure>\n<\/figure>\n\n\n\n<p class=\"wp-block-paragraph\"><\/p>\n\n\n\n<figure class=\"wp-block-gallery has-nested-images columns-4 is-cropped wp-block-gallery-6 is-layout-flex wp-block-gallery-is-layout-flex\">\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"704\" height=\"396\" data-id=\"725\" src=\"http:\/\/summergeometry.org\/sgi2022\/wp-content\/uploads\/2022\/08\/Empty-copy.png\" alt=\"\" class=\"wp-image-725\" srcset=\"https:\/\/summergeometry.org\/sgi2022\/wp-content\/uploads\/2022\/08\/Empty-copy.png 704w, https:\/\/summergeometry.org\/sgi2022\/wp-content\/uploads\/2022\/08\/Empty-copy-300x169.png 300w\" sizes=\"auto, (max-width: 704px) 100vw, 704px\" \/><\/figure>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"224\" height=\"224\" data-id=\"714\" src=\"http:\/\/summergeometry.org\/sgi2022\/wp-content\/uploads\/2022\/08\/image13-1.png\" alt=\"\" class=\"wp-image-714\" srcset=\"https:\/\/summergeometry.org\/sgi2022\/wp-content\/uploads\/2022\/08\/image13-1.png 224w, https:\/\/summergeometry.org\/sgi2022\/wp-content\/uploads\/2022\/08\/image13-1-150x150.png 150w\" sizes=\"auto, (max-width: 224px) 100vw, 224px\" \/><\/figure>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"224\" height=\"224\" data-id=\"713\" src=\"http:\/\/summergeometry.org\/sgi2022\/wp-content\/uploads\/2022\/08\/image12-1.png\" alt=\"\" class=\"wp-image-713\" srcset=\"https:\/\/summergeometry.org\/sgi2022\/wp-content\/uploads\/2022\/08\/image12-1.png 224w, https:\/\/summergeometry.org\/sgi2022\/wp-content\/uploads\/2022\/08\/image12-1-150x150.png 150w\" sizes=\"auto, (max-width: 224px) 100vw, 224px\" \/><\/figure>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"704\" height=\"396\" data-id=\"724\" src=\"http:\/\/summergeometry.org\/sgi2022\/wp-content\/uploads\/2022\/08\/Empty.png\" alt=\"\" class=\"wp-image-724\" srcset=\"https:\/\/summergeometry.org\/sgi2022\/wp-content\/uploads\/2022\/08\/Empty.png 704w, https:\/\/summergeometry.org\/sgi2022\/wp-content\/uploads\/2022\/08\/Empty-300x169.png 300w\" sizes=\"auto, (max-width: 704px) 100vw, 704px\" \/><\/figure>\n<figcaption class=\"blocks-gallery-caption\"><em>prompt = \u201ca centered red squ<\/em>are&#8221;<em> (before and after optimization)<\/em><\/figcaption><\/figure>\n\n\n\n<h2 class=\"wp-block-heading\">Conclusion<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Working on this project over the last few weeks, we saw that it is possible to achieve a lot with neural networks in a relatively short amount of time. Through our exploration of 2D and 3D cases, we were able to generate some early but promising results. More experiments are needed to test the limits of our model, especially with respect to the assembly of complex 3D scenes. Nonetheless, this method of using geometric primitives to synthesize images seems to have great potential, with a number of artistic applications making themselves evident through the results of our work<\/p>\n","protected":false},"excerpt":{"rendered":"<p>By Tiago De Souza Fernandes, Bryan Dumond, Daniel Scrivener and Vivien van Veldhuizen If you have been keeping up with some of the recent developments in artificial intelligence, you might have seen AI models that can generate images from a text-based description, such as CLIP or DALL\u00b7E. These models are able to generate completely new [&hellip;]<\/p>\n","protected":false},"author":11,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[45],"tags":[122,123,120,121,114],"class_list":["post-677","post","type-post","status-publish","format-standard","hentry","category-research","tag-clip","tag-computer-graphics","tag-deep-learning","tag-machine-learning","tag-optimization"],"_links":{"self":[{"href":"https:\/\/summergeometry.org\/sgi2022\/wp-json\/wp\/v2\/posts\/677","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/summergeometry.org\/sgi2022\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/summergeometry.org\/sgi2022\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/summergeometry.org\/sgi2022\/wp-json\/wp\/v2\/users\/11"}],"replies":[{"embeddable":true,"href":"https:\/\/summergeometry.org\/sgi2022\/wp-json\/wp\/v2\/comments?post=677"}],"version-history":[{"count":10,"href":"https:\/\/summergeometry.org\/sgi2022\/wp-json\/wp\/v2\/posts\/677\/revisions"}],"predecessor-version":[{"id":730,"href":"https:\/\/summergeometry.org\/sgi2022\/wp-json\/wp\/v2\/posts\/677\/revisions\/730"}],"wp:attachment":[{"href":"https:\/\/summergeometry.org\/sgi2022\/wp-json\/wp\/v2\/media?parent=677"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/summergeometry.org\/sgi2022\/wp-json\/wp\/v2\/categories?post=677"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/summergeometry.org\/sgi2022\/wp-json\/wp\/v2\/tags?post=677"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}