Author Archives: Julia Computing, Inc.

Neural Style Transfer in Julia on GPUs

Have you ever wondered how the app Prisma manages to turn your photos into impressionist paintings? They use, amongst
other things, a special type of algorithm called neural styles.

Neural styles are a special type of algorithm that combines the content of one
image with the style of another using deep neural networks. It was first
introduced in a famous paper by LA Gatys
and team at the University of Tubingen, Germany. Here they demonstrate how one
can use a class of deep neural networks to extract features from any “style” image
and subsequently “apply” them onto any “content” image.

The class of deep neural networks that are most powerful for image processing
tasks are called Convolutional Neural Networks (CNN).
It consists of a series of layers, which act as image filters. Each filter
extracts a feature from the input image. This series of layers form a model, or a network, that describes the transformations from the input image to the output features. The model used for this particular exercise was the VGG Network, which is a popular model used for object recognition tasks.

Training

As mentioned earlier, we have two images: a style image, from which we extract
features, and a content image, on which these features are applied.

Here’s the content image, a photograph of the Taj Mahal in Agra, India.


The Taj Mahal

Here’s the style image, one of the famous Water Lilies by the French impressionist, Claude Monet. We shall extract features from this particular image, and then apply them to our content image.


Water Lilies by Claude Monet, 1916-19

When we train our model on these two images, learning the styles from the style image, and appying them to the content image, we obtain the following output – the Taj Mahal drawn in the style of the lilies.

Notice that the structural features of the content image (or in other words, the
borders of the building) have been preserved. We find that a kind of texture has
been extracted from the style image and applied to the content image.

Pretrained Models

We can also load pre-trained models. In fact, this is what most mobile apps do.
The picture we take on our camera is our content image. The app then takes our content
image and performs a single forward pass on the model, “applying” a texture onto it.

We can see this with another content image. This is an artist’s impression of Kvothe,
one of my favorite fictional characters.


Potrait of a Red-haired Man

We have two pretrained models that are meant to provide two kinds of textures:
fire and frost. We pass the content image into our pretrained model
and obtain the following results, which shows the original image with two different styles applied.

Fire Texture
Frost Texture

The Code

The code for the above exercise can be found here.
We observe fast training times thanks in large part to optimized convolution
kernels on the GPU. Using the MXNet deep learning library, Julia makes it very easy
to perform these operations on a GPU. The following chart shows that the benefits of using the GPU are very large indeed!

We performed this excercise on a a IBM PowerNV 8335-GCA server, which has 160 CPU
cores, and a Tesla K80 (dual) GPU accelerator.

Future Work

It would be nice to make stylized videos, such as this.
This would involve taking a pretrained model and passing every frame of the video
into a pretained model, thereby generating a new video. We will write about that work in subsequent blog posts.

Amazon Web Services Announces MXNet Is “Framework of Choice” for Deep Learning Using Julia and Other Languages

Las Vegas, NV – Amazon Web Services announced at this week’s AWS re:Invent 2016 conference that MXNet is the framework of choice for deep learning using Julia and other languages.

According to Amazon.com CTO Werner Vogels, “In addition to scalability, MXNet offers the ability to both mix programming models (imperative and declarative), and code in a wide number of programming languages, including Python, C++, R, Scala, Julia, Matlab and JavaScript.” The full blog post is available here.

AWS provides the world’s largest cloud environment, which means that deep learning using Julia and MXNet is now available for more than 1 million businesses that use AWS.

Matt Wood, GM Product Strategy, Amazon Web Services
AWS re:Invent 2016
Photo by Greg Kelleher @gregkel

According to Matt Wood, GM Product Strategy for Amazon Web Services: “MXNet has a lot of the characteristics that developers like when they are going off and building deep learning.  First is programmability.  MXNet supports a really broad set of programming languages.  So whether you are used to using Python or Scala, or whether, like me, you are a fan of Julia or Javascript or Matlab or Go, you can use all of the languages you are used to using, and start running your deep learning straight away.” The full video is available here.

You can learn more about MXNet.jl by clicking here, or visit our Website to learn about Julia’s deep learning and GPU capabilities.

About Julia Computing and Julia

Julia Computing was founded in 2015 by the co-creators of the Julia language to provide support to businesses and researchers who use Julia, the fastest modern open source programming language for data and analytics.

Julia combines the functionality of quantitative environments such as Python and R with the speed of production programming languages like Java and C++ to solve big data and analytics problems. Julia delivers dramatic improvements in simplicity, speed, capacity and productivity.

Julia users and partners include: IBM, Intel, DARPA, Lawrence Berkeley National Laboratory, National Energy Research Scientific Computing Center (NERSC), Federal Aviation Administration (FAA), MIT Lincoln Labs, Moore Foundation, Nobel Laureate Thomas J. Sargent, Federal Reserve Bank of New York (FRBNY), Brazilian National Development Bank (BNDES), BlackRock, Conning, Berkery Noyes, BestX and many of the world’s largest investment banks, asset managers, fund managers, foreign exchange analysts, insurers, hedge funds and regulators. Julia is being used to analyze images of the universe and research dark matter, drive parallel computing on supercomputers, diagnose medical conditions, manage 3D printers, build drones, improve air safety, provide analytics for foreign exchange trading, insurance, regulatory compliance, macroeconomic modeling, sports analytics, manufacturing and much, much more.

Julia for Astronomy: Parallel Computing with Julia on NERSC Supercomputer Increases Speed of Image Analysis 225x

Berkeley, CA – Researchers from Julia Computing, UC Berkeley, Intel, the National Energy Research Scientific Computing Center (NERSC), Lawrence Berkeley National Laboratory, and JuliaLabs@MIT have developed a new parallel computing method to dramatically scale up the process of cataloging astronomical objects. This major improvement leverages 8,192 Intel® Xeon® processors in Berkeley Lab’s new Cori supercomputer and Julia, the high-performance, open-source scientific computing language to deliver a 225x increase in the speed of astronomical image analysis.

The code used for this analysis is called Celeste. It was developed at Berkeley Lab and uses statistical inference to mathematically locate and characterize light sources in the sky. When it was first released in 2015, Celeste was limited to single-node execution on at most hundreds of megabytes of astronomical images. In the case of the Sloan Digital Sky Survey, which is the dataset used for this research, this analysis is conducted by identifying points of light in nearly 5 million images of approximately 12 megabytes each – a dataset of 55 terabytes.

Using the new parallel implementation, the research team dramatically increased the speed of its analysis by an estimated 225x. This enabled the processing of more than 20 thousand images, or 250 gigabytes – an increase of more than 3 orders of magnitude compared with previous iterations.

“Astronomical surveys are the primary source of data about the Universe beyond our solar system,” said Jeff Regier, a postdoctoral fellow in the UC Berkeley Department of Electrical Engineering and Computer Sciences who has been instrumental in the development of Celeste. “Through Bayesian statistics, Celeste combines what we already know about stars and galaxies from previous surveys and from physics theories, with what can be learned from new data. Its output is a highly accurate catalog of galaxies’ locations, shapes and colors. Such catalogs let astronomers test hypotheses about the origin of the Universe, as well as about the nature of dark matter and dark energy.”

“It is exactly to enable such cutting-edge machine-learning algorithms on massive data that we designed the Julia language,” said Viral Shah, CEO of Julia Computing. “Researchers can now focus on problem solving rather than programming.”

NERSC provided the extensive computing resources the team needed to apply such a complex algorithm to so much data, assisting with many aspects of designing a program to run at scale, including load balancing and interprocess communication, Regier noted.

“Practically all the significant code that runs on supercomputers is written in C/C++ and Fortran, for good reason: efficiency is critically important,” said Pradeep Dubey, Intel Fellow and Director of the Parallel Computing Lab at Intel. “With Celeste, we are closer to bringing Julia into the conversation because we’ve demonstrated excellent efficiency using hybrid parallelism – not just processes, but threads as well – something that’s still impossible to do with Python or R.”

Alan Edelman, co-creator of the Julia language and professor of applied mathematics at MIT, said, “The JuliaLabs group at MIT is thrilled and impressed with this advancement in the use of Julia for High Performance Computing. The dream of ‘ease of use’ and (‘and’ not ‘or!’) ‘high performance’ is becoming a reality.”

The Celeste project is at the cutting edge of scientific big data analysis along multiple fronts, added Prabhat, NERSC Data and Analytics Services Group Lead and principal investigator for the MANTISSA project. “From a scientific perspective, it is one of the first codes that can conduct inference across multiple imaging surveys and create a unified catalog with uncertainties,” he said. “From a methods perspective, it is the first demonstration of large scale variational inference applied to hundreds of gigabytes of scientific data. From a software perspective, I believe it is one of the largest applications of the Julia language to a significant problem: we have integrated the DTree scheduler and utilized MPI-3 one-sided communication primitives.”

This implementation of Celeste also demonstrated good weak and strong scaling properties on 256 nodes of the Cori Phase I system, Prabhat added. The group’s next step will be to apply Celeste to the entire SDSS imaging dataset, followed by a joint SDSS + DECaLS analysis on Cori Phase II.


About the National Energy Research Scientific Computing Center (NERSC) and Lawrence Berkeley National Laboratory: The National Energy Research Scientific Computing Center (NERSC) is the primary high-performance computing facility for scientific research sponsored by the U.S. Department of Energy’s Office of Science. Located at Lawrence Berkeley National Laboratory, the NERSC Center serves more than 6,000 scientists at national laboratories and universities researching a wide range of problems in combustion, climate modeling, fusion energy, materials science, physics, chemistry, computational biology, and other disciplines. Berkeley Lab is a U.S. Department of Energy national laboratory located in Berkeley, California. It conducts unclassified scientific research and is managed by the University of California for the U.S. DOE Office of Science.

About Julia, Julia Computing and JuliaLabs@MIT: Julia is the high performance open source computing language that is taking astronomy, finance and other big data analytics fields by storm.  Julia users and partners include: Intel, DARPA, Lawrence Berkeley National Laboratory, National Energy Research Scientific Computing Center (NERSC), IBM, Federal Aviation Administration (FAA), MIT Lincoln Labs, Moore Foundation, Nobel Laureate Thomas J. Sargent, Federal Reserve Bank of New York (FRBNY), Brazilian National Development Bank (BNDES), BlackRock, Conning, Berkery Noyes, BestX and researchers at MIT, Harvard, UC Berkeley, Stanford and NYU. Julia Computing is the for-profit Julia consulting firm founded by the co-creators of the Julia computing language to help researchers and businesses maximize productivity and efficiency using Julia. JuliaLabs@MIT, led by Professor Alan Edelman, conducts research using the Julia language.
Intel is a registered trademark of Intel Corporation in the United States and other countries.