• TwitterFacebookGoogle PlusLinkedInRSS FeedEmail

Wolfram Mathematica Neural Networks

13.10.2019 

Mathematica Stack Exchange is a question and answer site for users of Wolfram Mathematica. It only takes a minute to sign up. Graph neural networks are useful for. I expect the original pioneers of neural networks—like Warren McCulloch and Walter Pitts—would find little surprising about the core of what the Wolfram Language Image Identification Project does, though they might be amazed that it’s taken 70 years to get here.

For three decades, Mathematica has defined the state of the art in technical computing—and provided the principal computation environment for millions of innovators, educators, students, and others around the world.Widely admired for both its technical prowess and elegant ease of use, Mathematica provides a single integrated, continually expanding system that covers the breadth and depth of technical computing—and seamlessly available in the cloud through any web browser, as well as natively on all modern desktop systems.

✕ netNeural nets have generated a lot of interest recently, and rightly so: they form the basis for state-of-the-art solutions to a dizzying array of problems, from to, from to. Fortunately, the Wolfram Language now has a state-of-the-art (and a growing ). This has made possible a whole new set of Wolfram Language functions, such as,. And deep learning will no doubt play an important role in our continuing mission to make.However, training state-of-the art neural nets often requires huge datasets and that are inaccessible to most users. A repository of nets gives Wolfram Language users easy access to the latest net architectures and pre-trained nets, representing thousands of hours of computation time on powerful GPUs.A great thing about the deep learning community is that it’s common for researchers to make their trained nets publicly available.

These are often in the form of disparate scripts and data files using a multitude of neural net frameworks. A major goal of our repository is to curate and publish these models into a standard, easy-to-use format soon after they are released. In addition, we are providing our own trained models for various tasks.This blog will cover three main use cases of the Wolfram Neural Net Repository:. Exposing technology based on deep learning.

Mathematica Machine Learning

Although much of this functionality will eventually be packaged as official Wolfram Language functions, the repository provides early access to a large set of functionality that until now was entirely impossible to do in the Wolfram Language. Using pre-trained nets as powerful feature extractors. Pre-trained nets can be used as powerful functions throughout the Wolfram Language’s other machine learning functionalities, such as, etc. This gives users fine-grained control over incorporating prior knowledge into their machine learning pipelines. Building nets using off-the-shelf architectures and pre-trained components. Access to carefully designed and trained modules unlocks a higher-level paradigm for using the.

This paradigm frees users from the difficult and laborious task of building good net architectures from individual layers and allows them to transfer knowledge from nets trained on different domains to their own problems.An important but indirect benefit of having a diverse and rich library of nets available in the Wolfram Neural Net Repository is to catalyze the development of the Wolfram neural net framework itself. In particular, the addition of models operating on audio and text has driven a diverse set of improvements to the framework; these include extensive support for so-called dynamic dimensions (variable-length tensors), five new audio types and for easy recurrent generation. An ExampleEach net published in the Wolfram Neural Net Repository gets its own webpage. Here, for example, is the page for a net that:At the top of the page is information about the net, such as its size and the data it was trained on. In this case, the net was trained on 100 million images. After that is a showing how to use the net, which can be downloaded or opened in the via these buttons:Using notebooks in the Wolfram Cloud allows running of the examples in your browser without needing to install anything.Under the Basic Usage section, we can immediately see how easy it is to perform a computation with this net. Let’s trace this example in more detail.

Firstly, we obtain the net itself using NetModel. ✕ position = netThe produced as the output of this net is in sharp contrast to most other frameworks, where only numeric arrays are valid inputs and outputs of a net. A to import an image, reshape it, conform it to the correct color space and possibly remove the mean image, before producing the numeric tensor the net requires. In the Wolfram Language, we like nets to be “batteries included,” with the pre- and post-processing logic as part of the net itself. This is achieved by having an ' NetEncoder attached to the input port of the net and a that interprets the output as a GeoPosition object.As the net returns a GeoPosition object rather than a simple list of data, further computation can immediately be performed on it. For example, we can plot the position on a map.

✕ GeoGraphicsGeoMarkerposition, GeoRange - 4000000After the basic example section are sections with other interesting demonstrations—for example:One very important feature we provide is the ability to export nets to other frameworks. Currently, we support exporting to, and the final section in each example page usually shows how to do this:After the examples is a link to a notebook that shows how a user might construct the net themselves using, and individual layers:What’s in the Wolfram Neural Net Repository So Far?We have invested much effort in converting publicly available models from other neural net frameworks (such as, etc.) into the Wolfram neural net format. In addition, we have trained a number of nets ourselves. For example, the net called by ImageIdentify is available via NetModel'Wolfram ImageIdentify Net V1'.

Football manager 2009 9.2 patch. As of this release, there are around 70 available models. ✕ FeatureSpacePlotsentences,FeatureExtractor - (First@model#'ContextualEmbedding/2' &),LabelingFunction - CalloutFeature Extraction for Transfer LearningOne of the most powerful applications of trained nets is to use the knowledge they have gained on one problem to improve the performance of learning algorithms on a different problem. This is known as transfer learning, and it can significantly improve performance when you are training on ‘small’ datasets (while not being relevant in the limit of infinite training set size).

It is particularly useful when training on structured input types, such as images, audio or text.Doing transfer learning in the Wolfram Language is incredibly simple. As an example, consider the problem of classifying images as being of either cats or dogs. ✕ ClassifierMeasurementsclassifier, catdogTest, 'Accuracy'Why has Classify failed to do any learning?

The reason is simple: distinguishing cats from dogs using only pixel values is extremely difficult. A much larger set of training examples are necessary for Classify to figure out the extremely complicated rules that distinguish cats from dogs using pixel values.Now let us choose a pre-trained net that is similar to the problem we are solving here.

In this case, a net trained on the dataset is a good choice. ✕ net = NetModel'ResNet-50 Trained on ImageNet Competition Data'A basic observation about neural nets is that the early layers perform more generic feature extraction, while the latter layers are specialized for the exact task on which the dataset is being trained. The last two layers of this net are completely specialized for the ImageNet task of classifying an image as one of 1,000 different classes. These layers can be removed using so that the net now outputs a 2,048-dimensional vector when applied to an image.

Tutorial

✕ ClassifierMeasurementsClassifycatdogTrain, catdogTest, 'Accuracy'There is another way of using pre-trained nets for transfer learning that gives the user much more control, and is more general than using Classify and Predict. This is to use pre-trained nets as building blocks from which to build new nets, which is what we’ll look at in the next section. Higher-Level Neural Net DevelopmentA key design principle behind the Wolfram neural net framework is to aim for a higher level of abstraction compared to most other neural net frameworks. We want to free users from worrying about, or how to before training.

Even implementation details like the ubiquitous “batch dimension” are hidden. Our philosophy is that the framework should take care of these details so that users can focus completely on their actual problems.Having an extensive repository of neural net models is an absolutely essential component to realizing this vision of using neural nets at the highest possible level, as it allows users to avoid one of the hardest and most frustrating parts of using neural nets: finding a good net architecture for a given problem. In addition, starting with pre-trained nets can dramatically improve neural net performance on smaller datasets via transfer learning.To see why defining your own net is hard, consider the problem of training a neural net on your own dataset using.

Mathematica Neural Net

To do this, you need to supply NetTrain with a net to use for training. As an example, define a simple net that can classify images of handwritten digits between 0 and 9. ✕ NetInformationNetModel'ResNet-101 Trained on ImageNet Competition Data', 'LayersCount'Finally, even if you are a neural net expert, and nod in agreement to statements like “,” you should still almost always avoid trying to discover your own net.

To see why, consider the, where participants are given over a million images of objects coming from over 1,000 classes. The winning performances over the last five years are the following (the lower the number, the better):It has taken half a decade of experimentation by some of the smartest machine learning researchers alive, with access to vast computational resources, to discover a net architecture able to obtain a.The current consensus in the neural net community is that building your own net architecture is unnecessary for the majority of neural net applications, and will usually hurt performance. Rather, adapting a pre-trained net to your own problem is almost always a better approach in terms of performance. Luckily, this approach has the added benefit of being much easier to work with!Having a large neural net repository is thus absolutely key to being productive with the neural net framework, as it allows you to look for a net close to the problem you are solving, do minimal amounts of “surgery” on the net to adapt it to your specific problem and then train it.Let us look at an example of this “high-level” development process to solve the cat-versus-dog classification problem in the previous section. First, obtain a net similar to our problem. ✕ UnitConvertQuantityQuantity20, 'Exa', 'floating point operations'/machineFLOPS, 'Years'To complete the training in reasonable amounts of time, special hardware is needed.

Neural Networks Software

The most common solution is to use (GPUs), which can efficiently exploit the massive parallelism in neural net computations. NetTrain supports many of these via -'GPU'. Importance of Using Existing Neural Net ArchitecturesAndrej Karpathy (Director of AI at Tesla):If you’re feeling a bit of a fatigue in thinking about the architectural decisions, you’ll be pleased to know that in 90% or more of applications you should not have to worry about these. I like to summarize this point as “ don’t be a hero”: Instead of rolling your own architecture for a problem, you should look at whatever architecture currently works best on ImageNet, download a pre-trained model and fine-tune it on your data.

You should rarely ever have to train a ConvNet from scratch or design one from scratch.Download this post as a.