A Learned Representation for Scalable Vector Graphics

Total Page:16

File Type:pdf, Size:1020Kb

A Learned Representation for Scalable Vector Graphics A Learned Representation for Scalable Vector Graphics Raphael Gontijo Lopes,∗ David Ha, Douglas Eck, Jonathon Shlens Google Brain {iraphael, hadavid, deck, shlens}@google.com Abstract Learned Vector Graphics Representation Pixel Counterpart Dramatic advances in generative models have resulted moveTo (15, 25) in near photographic quality for artificially rendered faces, lineTo (-2, 0.3) cubicBezier (-7.4, 0.2) (-14.5, 11.7), (-12.1, 23.4) animals and other objects in the natural world. In spite of ... such advances, a higher level understanding of vision and imagery does not arise from exhaustively modeling an ob- ject, but instead identifying higher-level attributes that best summarize the aspects of an object. In this work we at- tempt to model the drawing process of fonts by building se- quential generative models of vector graphics. This model has the benefit of providing a scale-invariant representation for imagery whose latent representation may be systemati- cally manipulated and exploited to perform style propaga- tion. We demonstrate these results on a large dataset of fonts and highlight how such a model captures the statisti- Conveying Different Styles cal dependencies and richness of this dataset. We envision that our model can find use as a tool for graphic designers to facilitate font design. Figure 1: Learning fonts in a native command space. Un- like pixels, scalable vector graphics (SVG) [11] are scale- 1. Introduction invariant representations whose parameterizations may be The last few years have witnessed dramatic advances systematically adjusted to convey different styles. All vec- in generative models of images that produce near photo- tor images are samples from a generative model of the SVG graphic quality imagery of human faces, animals, and natu- specification. ral objects [4, 25, 27]. These models provide an exhaustive characterization of natural image statistics [52] and repre- sent a significant advance in this domain. However, these Our goal is to train a drawing model by presenting it advances in image synthesis ignore an important facet of with a large set of example images [16, 13]. To succeed, how humans interpret raw visual information [48], namely the model needs to learn both the underlying structure in that humans seem to exploit structured representations of those images and to generate drawings based on the learned visual concepts [33, 21]. Structured representations may be representation [2]. In computer vision this is referred to as readily employed to aid generalization and efficient learning an “inverse graphics” problem [38, 31, 22, 41]. In our case by identifying higher level primitives for conveying visual the output representation is not pixels but rather a sequence information [32] or provide building blocks for creative ex- of discrete instructions for rendering a drawing on a graph- ploration [21, 20]. This may be best seen in human drawing, ics engine. This poses dual challenges in terms of learning where techniques such as gesture drawing [44] emphasize discrete representations for latent variables [57, 23, 37] and parsimony for capturing higher level semantics and actions performing optimization through a non-differential graphics with minimal graphical content [54]. engine (but see [36, 31]). Previous approaches focused on ∗Work done as a member of the Google AI Residency Program (g. program synthesis approaches [32, 10] or employing rein- co/airesidency) forcement and adversarial learning [13]. We instead focus 17930 on a subset of this domain where we think we can make 2. Related Work progress and improves the generality of the approach. 2.1. Generative models of images Font generation represents a 30 year old problem posited as a constrained but diverse domain for understanding Generative models of images have generally followed higher level perception and creativity [21]. Early research two distinct directions. Generative adversarial networks attempted to heuristically systematize the creation of fonts [14] have demonstrated impressive advances [46, 14] over for expressing the identity of characters (e.g. a, 2) as well the last few years resulting in models that generate high as stylistic elements constituting the “spirit” of a font [20]. resolution imagery nearly indistinguishable from real pho- Although such work provides great inspiration, the results tographs [25, 4]. were limited by a reliance on heuristics and a lack of a A second direction has pursued building probabilistic learned, structured representation [47]. Subsequent work models largely focused on invertible representations [8, 27]. for learning representations for fonts focused on models Such models are highly tractable and do not suffer from with simple parameterizations [34], template matching [55], training instabilities largely attributable to saddle-point op- example-based hints [63], or more recently, learning mani- timization [14]. Additionally, such models afford a true folds for detailed geometric annotations [5]. probabilistic model in which the quality of the model may We instead focus the problem on generating fonts speci- be measured with well-characterized objectives such as log- fied with Scalable Vector Graphics (SVG) – a common file likelihood. format for fonts, human drawings, designs and illustrations [11]. SVG’s are a compact, scale-invariant representation 2.2. Autoregressive generative models that may be rendered on most web browsers. SVG’s spec- One method for vastly improving the quality of gener- ify an illustration as a sequence of a higher-level commands ative models with unsupervised objectives is to break the paired with numerical arguments (Figure 1, top). We take problem of joint prediction into a conditional, sequential inspiration from the literature on generative models of im- prediction task. Each step of the conditional prediction ages in rasterized pixel space [15, 56]. Such models provide task may be expressed with a sequential model (e.g. [19]) powerful auto-regressive formulations for discrete, sequen- trained in an autoregressive fashion. Such models are often tial data [15, 56] and may be applied to rasterized renderings trained with a teacher-forcing training strategy, but more so- of drawings [16]. We extend these approaches to the gener- phisticated methods may be employed [1]. ation of sequences of SVG commands for the inference of Autoregressive models have demonstrated great success individual font characters. in speech synthesis [42] and unsupervised learning tasks The goal of this work is to build a tool to learn a repre- [57] across multiple domains. Variants of autoregressive sentation for font characters and style that may be extended models paired with more sophisticated density modeling [3] to other artistic domains [7, 50, 16], or exploited as an in- have been employed for sequentially generating handwrit- telligent assistant for font creation [6]. We aspire that our ing [15]. methods could be applied generically, but we focus on font generation as our main inspiration in hopes that it opens op- 2.3. Modeling higher level languages portunities to work on more complex illustrations [7]. To The task of learning an algorithm from examples has this end, our main contributions are as follows: been widely studied. Lines of work vary from directly mod- eling computation [24] to learning a hierarchical composi- • Build a generative model for scalable vector graphics tion of given computational primitives [12]. Of particular (SVG) images and apply this to a large-scale dataset of relevance are efforts that learn to infer graphics programs 14 M font characters. from the visual features they render, often using constructs like variable bindings, loops, or simple conditionals [10]. • Demonstrate that the generative model provides a per- The most comparable methods to this work yield impres- ceptually smooth latent representation for font styles sive results on unsupervised induction of programs usable that captures a large amount of diversity and is consis- by a given graphics engine [13]. As their setup is non differ- tent across individual characters. entiable, they use the REINFORCE [60] algorithm to per- form adversarial training [14]. This method achieves im- • Exploit the latent representation from the model to in- pressive results despite not relying on labelled paired data. fer complete SVG fontsets from a single (or multiple) However, it tends to draw over previously-generated draw- characters of a font. ings, especially later in the generation process. While this could be suitable for modelling the generation of a 32x32 • Identify semantically meaningful directions in the la- rastered image, SVGs require a certain level of precision in tent representation to globally manipulate font style. order to scale with few perceptible issues. 7931 Modelling languages for image generation [13, 16], Image Autoencoder SVG Decoder which our work tackles, can be construed as a probabilistic “N” programming problem. What makes our problem unique, vector style MDN however, is (a) models must be perceptually judged [13] and image image SVG encoder decoder decoder (b) by working in the SVG format, we open the opportunity to exploit a de-facto standard format for icons and graphics. temperature 2.4. Learning representations for fonts Figure 2: Model architecture. Visual similarity between Previous work has focused on enabling propagation of SVGs is learned by a class-conditioned, convolutional vari- style between classes by identifying the class and style from ational
Recommended publications
  • Author Graphics Guide (PDF)
    Annual Reviews Graphics Guide 1. Keep figures editable If you are creating your figures from scratch: Annual Reviews has a team of Illustration Editors who work with your figures • Send the original, editable/vector format using Adobe Illustrator to ensure accuracy and consistency, provide graphical wherever possible (for graphs, diagrams, etc.). enhancements, and apply our house style. During this process, we may change Avoid creating line- or text-heavy diagrams in font, type size, colors, layout, figure size, and information hierarchy, and we may raster programs such as Photoshop. redraw certain elements. • Keep text/lines on separate layers from any Therefore, while we prefer that figures be as close to final as possible when you photo, or send one version of the image with send them, please make sure the files are not flattened* or uneditable. labels and one without. Suggested: place the photo in Illustrator or PowerPoint, then add NOTE: many other journals require print-ready, flattened files; our requirement text/lines; send us the original .AI or .PPT file. for editable files is quite different, due to the figure enhancement and editing we provide. • Make sure all photos you start with are high resolution (300 dpi at desired final size). Examples of desired figure attributes: Knob K If you are using previously published figures: Mauer’s Editable, vector clefts lines, shapes, MCs and arrows • The low-resolution figures found in online Parasite journals are usually not adequate for our plasma PPM membrane press-quality publication. Contact the author or PVM Text is live and publisher for high-resolution, editable files.
    [Show full text]
  • Using Typography and Iconography to Express Emotion
    Using typography and iconography to express emotion (or meaning) in motion graphics as a learning tool for ESL (English as a second language) in a multi-device platform. A thesis submitted to the School of Visual Communication Design, College of Communication and Information of Kent State University in partial fulfillment of the requirements for the degree of Master of Fine Arts by Anthony J. Ezzo May, 2016 Thesis written by Anthony J. Ezzo B.F.A. University of Akron, 1998 M.F.A., Kent State University, 2016 Approved by Gretchen Caldwell Rinnert, M.G.D., Advisor Jaime Kennedy, M.F.A., Director, School of Visual Communication Design Amy Reynolds, Ph.D., Dean, College of Communication and Information TABLE OF CONTENTS TABLE OF CONTENTS .................................................................................... iii LIST OF FIGURES ............................................................................................ v LIST OF TABLES .............................................................................................. v ACKNOWLEDGEMENTS ................................................................................ vi CHAPTER 1. THE PROBLEM .......................................................................................... 1 Thesis ..................................................................................................... 6 2. BACKGROUND AND CONTEXT ............................................................. 7 Understanding The Ell Process ..............................................................
    [Show full text]
  • 3D Graphics Fundamentals
    11BegGameDev.qxd 9/20/04 5:20 PM Page 211 chapter 11 3D Graphics Fundamentals his chapter covers the basics of 3D graphics. You will learn the basic concepts so that you are at least aware of the key points in 3D programming. However, this Tchapter will not go into great detail on 3D mathematics or graphics theory, which are far too advanced for this book. What you will learn instead is the practical implemen- tation of 3D in order to write simple 3D games. You will get just exactly what you need to 211 11BegGameDev.qxd 9/20/04 5:20 PM Page 212 212 Chapter 11 ■ 3D Graphics Fundamentals write a simple 3D game without getting bogged down in theory. If you have questions about how matrix math works and about how 3D rendering is done, you might want to use this chapter as a starting point and then go on and read a book such as Beginning Direct3D Game Programming,by Wolfgang Engel (Course PTR). The goal of this chapter is to provide you with a set of reusable functions that can be used to develop 3D games. Here is what you will learn in this chapter: ■ How to create and use vertices. ■ How to manipulate polygons. ■ How to create a textured polygon. ■ How to create a cube and rotate it. Introduction to 3D Programming It’s a foregone conclusion today that everyone has a 3D accelerated video card. Even the low-end budget video cards are equipped with a 3D graphics processing unit (GPU) that would be impressive were it not for all the competition in this market pushing out more and more polygons and new features every year.
    [Show full text]
  • 14. Using Your Own Images
    Cricut Design Space User Manual 14. Using your own images D. Preparing artwork from CorelDRAW Cricut Design Space™ lets you upload most .jpg, .gif, .png, .bmp, .svg, and .dxf images and convert them into cuttable shapes. The tool doesn’t allow you to make modifications to the design itself, which is why working with CorelDRAW to prepare your files is effective. With CorelDRAW, you can use the full range of tools to create and modify your designs, and then upload them to Cricut Design Space. The two different types of images are Basic and Vector. CorelDRAW is primarily a vector program, which means it saves vector files like .svg and .dxf, but it can also save .jpg, .png, and .bmp files. Artwork created in CorelDRAW can be used to: (1) Print the image on your home printer and cut it out using your Cricut® machine with the Print then Cut feature. (2) Cut or draw the outline of the image. Page | 1 Cricut Design Space User Manual (3) Create cuttable shapes and images. Multilayer images will be separated into layers on the Canvas. Tip: Multilayer images can be flattened into a single layer in Cricut Design Space. Use the Flatten tool to turn any multilayer image into a single layer that can be used with Print then Cut. Page | 2 Cricut Design Space User Manual Preparing artwork The following steps use CorelDRAW X8. Although the screenshots will be different in older versions, the process is the same. Vector files .dxf and .svg Step 1 Create or modify an image using any of the CorelDRAW tools.
    [Show full text]
  • Flood Insurance Rate Map (FIRM) Graphics Guidance
    Guidance for Flood Risk Analysis and Mapping Flood Insurance Rate Map (FIRM) Graphics November 2019 Requirements for the Federal Emergency Management Agency (FEMA) Risk Mapping, Assessment, and Planning (Risk MAP) Program are specified separately by statute, regulation, or FEMA policy (primarily the Standards for Flood Risk Analysis and Mapping). This document provides guidance to support the requirements and recommends approaches for effective and efficient implementation. The guidance, context, and other information in this document is not required unless it is codified separately in the aforementioned statute, regulation, or policy. Alternate approaches that comply with all requirements are acceptable. For more information, please visit the FEMA Guidelines and Standards for Flood Risk Analysis and Mapping webpage (www.fema.gov/guidelines-and-standards-flood-risk-analysis-and- mapping). Copies of the Standards for Flood Risk Analysis and Mapping policy, related guidance, technical references, and other information about the guidelines and standards development process are all available here. You can also search directly by document title at www.fema.gov/library. FIRM Graphics November 2019 Guidance Document 6 Page i Document History Affected Section or Date Description Subsection This guidance has been revised to align various November descriptions and specifications to standard operating Sections 4.3 and 5.2 2019 procedures, including labeling of structures and application of floodway and special floodway notes. FIRM Graphics November
    [Show full text]
  • Introduction to Scalable Vector Graphics
    Introduction to Scalable Vector Graphics Presented by developerWorks, your source for great tutorials ibm.com/developerWorks Table of Contents If you're viewing this document online, you can click any of the topics below to link directly to that section. 1. Introduction.............................................................. 2 2. What is SVG?........................................................... 4 3. Basic shapes............................................................ 10 4. Definitions and groups................................................. 16 5. Painting .................................................................. 21 6. Coordinates and transformations.................................... 32 7. Paths ..................................................................... 38 8. Text ....................................................................... 46 9. Animation and interactivity............................................ 51 10. Summary............................................................... 55 Introduction to Scalable Vector Graphics Page 1 of 56 ibm.com/developerWorks Presented by developerWorks, your source for great tutorials Section 1. Introduction Should I take this tutorial? This tutorial assists developers who want to understand the concepts behind Scalable Vector Graphics (SVG) in order to build them, either as static documents, or as dynamically generated content. XML experience is not required, but a familiarity with at least one tagging language (such as HTML) will be useful. For basic XML
    [Show full text]
  • Understanding Image Formats and When to Use Them
    Understanding Image Formats And When to Use Them Are you familiar with the extensions after your images? There are so many image formats that it’s so easy to get confused! File extensions like .jpeg, .bmp, .gif, and more can be seen after an image’s file name. Most of us disregard it, thinking there is no significance regarding these image formats. These are all different and not cross‐ compatible. These image formats have their own pros and cons. They were created for specific, yet different purposes. What’s the difference, and when is each format appropriate to use? Every graphic you see online is an image file. Most everything you see printed on paper, plastic or a t‐shirt came from an image file. These files come in a variety of formats, and each is optimized for a specific use. Using the right type for the right job means your design will come out picture perfect and just how you intended. The wrong format could mean a bad print or a poor web image, a giant download or a missing graphic in an email Most image files fit into one of two general categories—raster files and vector files—and each category has its own specific uses. This breakdown isn’t perfect. For example, certain formats can actually contain elements of both types. But this is a good place to start when thinking about which format to use for your projects. Raster Images Raster images are made up of a set grid of dots called pixels where each pixel is assigned a color.
    [Show full text]
  • Minnesota State Archives Preferred File Formats
    Minnesota State Archives Preferred File Formats This document outlines file formats preferred by the Minnesota State Archives for digital preservation. This list is not intended to be a comprehensive list of what is accepted, but to provide guidance where multiple formats are possible to transfer to the archives. At the end of this document, you can also find some best practices when preparing files for transfer to the state archives. File Formats by Content Type ● Text ○ PDF/A ○ PDF ○ TXT ○ RTF ○ DOC or DOCX ● Spreadsheets ○ CSV ○ XLS or XLSX ● Raster/Bitmap Images ○ TIFF ○ JPEG ○ PDF/A ○ PNG ○ DNG, RAW, or other ‘negative’ formats ○ JPEG2000 ● Vector Graphics ○ SVG ● Audio ○ BWF ○ WAV ○ Video ○ MP4 ○ MOV ○ AVI ○ Motion JPEG 2000 ● Web pages ○ WARC ○ HTML - for static/as-developed only ● Email ○ MBOX Minnesota State Archives, September 2016 (v.1) ○ MSG ● Presentations/Slideshows ○ PDF if possible ○ PPT or PPTX ● Database ○ CSV if possible, original format if not ● Containers ○ ZIP ● Other files ○ if they can be faithfully represented in PDF/A (secondarily, PDF), include the original format and PDF ○ sets of files, interdependent files, executable files, proprietary formats, other weird/complex files = provide in original format, zipped for download Best Practices for Preparing Files for Transfer Once you have negotiated the transfer of digital materials to the State Archives, the materials will then need to be prepared. The State Archives can offer guidance and assistance throughout this process, but these best practices are a useful place to start: ● Identify and remove as many duplicates as possible, whether they are identical digital copies or where both digital and paper copies exist ○ There are some free software tools available to help identify digital duplicates; talk to the State Archives staff for more information.
    [Show full text]
  • Coreldraw Graphics Suite 2020 Product Guide
    Create Connect Complete Welcome to our fastest, With a focus on innovation, CorelDRAW Graphics Suite 2020 powers the professional Say hello to smartest, and most connected graphic design workflow from concept to final graphics suite ever. output. Consider it done: Manage your creative Whether your preferred platform is Windows or workflow more efficiently with tools for serious Mac, CorelDRAW® Graphics Suite 2020 sets a productivity. Collaborate on important design new standard for productivity, power, and projects with clients and key stakeholders to collaboration. Experience design tools that use get more done in less time—and deliver artificial intelligence (AI) to anticipate the exceptional results. results you're looking for and make them a reality. Use CorelDRAW.app™ to collaborate Connect with your creative side: Applications with colleagues and clients in real time. Plus, for vector illustration and layout, photo editing, take advantage of performance boosts across and typography help unleash your creative the applications that further accelerate your genius in digital and print. Transform ideas into creative process. works of art with unique features that simplify complex workflows and inspire jaw-dropping Three years ago, CorelDRAW made history with designs. the introduction of LiveSketch™, the industry's first AI-based vector drawing experience. Now Express yourself with confidence: Control the we've incorporated AI technology across our design experience with powerful graphics tools key applications to expand your design built natively for Windows, macOS, and web. capabilities and accelerate your workflow. JPEG Customizable workspaces and flexible features artifact removal, upsampling results, bitmap- complement the way you work. Design how to-vector tracing, and eye-catching art styles you want, wherever and whenever it's are all made exceptional by machine-learned convenient for you.
    [Show full text]
  • Visualisation of Resource Flows Technical Report
    Visualisation of Resource Flows Technical Report Jesper Karjalainen (jeska043) Erik Johansson (erijo926) Anders Kettisen (andke020) Tobias Nilsson (tobni908) Alexander Eriksson (aleer034) Contents 1. Introduction 1 1.1. Problem description . .1 1.2. Tools . .1 2. Background/Theory 1 2.1. Sphere models . .1 2.2. Vector Graphics . .2 2.3. Cubic Beziers . .2 2.4. Cartesian Mapping of Earth . .3 2.5. Lines in 3D . .3 2.6. Rendering Polygons . .4 2.6.1 Splitting polygons . .4 2.6.2 Tessellate polygons . .4 2.6.3 Filling Polygon by the Stencil Method . .5 2.7. Picking . .5 3. Method 5 3.1. File Loading . .5 3.2. Formatting new files . .6 3.3. Data Management . .6 3.4. Creating the sphere . .6 3.4.1 Defining the first vertices . .6 3.4.2 Making the sphere smooth . .7 3.5. Texturing a Sphere . .8 3.6. Generating Country Borders . .8 3.7. Drawing 3D lines . 10 3.8. Assigning widths to flow lines . 12 3.8.1 Linear scaling . 12 3.8.2 Logarithmic scaling . 12 3.9. Drawing Flow Lines . 12 3.10.Picking . 13 3.10.1 Picking on Simple Geometry . 13 3.10.2 Picking on Closed Polygon . 14 3.11.Rendering Polygons . 14 3.11.1 Concave Polygon Splitting into Convex Parts . 14 3.11.2 Filling by the Stencil Buffer Method . 16 3.12.Shader Animations . 16 3.12.1 2D-3D Transition Animation . 16 3.12.2 Flowline Directions . 17 3.13.User interface . 17 3.13.1 Connecting JavaScript and C++ . 17 3.13.2 Filling the drop-down lists with data .
    [Show full text]
  • Progressive Imagery with Scalable Vector Graphics -..:: VCG Rostock
    Progressive imagery with scalable vector graphics Georg Fuchsa, Heidrun Schumanna, and Ren´eRosenbaumb aUniversity of Rostock, Institute for Computer Science, 18051 Rostock, Germany; bUC Davis, Institute of Data Analysis & Visualization, Davis, CA 95616 U.S.A. ABSTRACT Vector graphics can be scaled without loss of quality, making them suitable for mobile image communication where a given graphics must be typically represented in high quality for a wide range of screen resolutions. One problem is that file size increases rapidly as content becomes more detailed, which can reduce response times and efficiency in mobile settings. Analog issues for large raster imagery have been overcome using progressive refinement schemes. Similar ideas have already been applied to vector graphics, but an implementation that is compliant to a major and widely adopted standard is still missing. In this publication we show how to provide progressive refinement schemes based on the extendable Scalable Vector Graphics (SVG) standard. We propose two strategies: decomposition of the original SVG and incremental transmission using (1) several linked files and (2) element-wise streaming of a single file. The publication discusses how both strategies are employed in mobile image communication scenarios where the user can interactively define RoIs for prioritized image communication, and reports initial results we obtained from a prototypically implemented client/server setup. Keywords: Progression, Progressive refinement, Scalable Vector Graphics, SVG, Mobile image communication 1. INTRODUCTION Vector graphics use graphic primitives such as points, lines, curves, and polygons to represent image contents. As those primitives are defined by means of geometric coordinates that are independent of actual pixel resolutions, vector graphics can be scaled without loss of quality.
    [Show full text]
  • SVG Exploiting Browsers Without Image Parsing Bugs
    SVG Exploiting Browsers without Image Parsing Bugs Rennie deGraaf iSEC Partners 07 August 2014 Rennie deGraaf (iSEC Partners) SVG Security BH USA 2014 1 / 55 Outline 1 A brief introduction to SVG What is SVG? Using SVG with HTML SVG features 2 Attacking SVG Attack surface Security model Security model violations 3 Content Security Policy A brief introduction CSP Violations 4 Conclusion Rennie deGraaf (iSEC Partners) SVG Security BH USA 2014 2 / 55 A brief introduction to SVG What is SVG? What is SVG? Scalable Vector Graphics XML-based W3C (http://www.w3.org/TR/SVG/) Development started in 1999 Current version is 1.1, published in 2011 Version 2.0 is in development First browser with native support was Konqueror in 2004; IE was the last major browser to add native SVG support (in 2011) Rennie deGraaf (iSEC Partners) SVG Security BH USA 2014 3 / 55 A brief introduction to SVG What is SVG? A simple example Source code <? xml v e r s i o n = ” 1 . 0 ” encoding = ”UTF-8” standalone = ” no ” ? > <svg xmlns = ” h t t p : // www. w3 . org / 2 0 0 0 / svg ” width = ” 68 ” h e i g h t = ” 68 ” viewBox = ”-34 -34 68 68 ” v e r s i o n = ” 1 . 1 ” > < c i r c l e cx = ” 0 ” cy = ” 0 ” r = ” 24 ” f i l l = ”#c8c8c8 ” / > < / svg > Rennie deGraaf (iSEC Partners) SVG Security BH USA 2014 4 / 55 A brief introduction to SVG What is SVG? A simple example As rendered Rennie deGraaf (iSEC Partners) SVG Security BH USA 2014 5 / 55 A brief introduction to SVG What is SVG? A simple example I am not an artist.
    [Show full text]