# Tag Info

98

Here is one example using a convolutional neural network (CNN) to crack the CAPTCHA. We will use a CAPTCHA library to generate sample CAPTCHA images and then train a neural network to decode these images. The trained network can be downloaded from crack_CAPTCHA.wlnet. In the following, we will describe how to prepare the training data, construct and train ...

57

Introduction An object detection problem can be approached as either a classification problem or a regression problem. As a classification problem, the image is divided into small patches, each of which will be run through a classifier to determine whether there are objects in the patch. Then the bounding boxes will be assigned to locate around patches that ...

41

The most basic neural nets are just a DotCross layer and some layer that provides nonlinearity. I recommend starting with that. This is essentially what you see in textbooks. You can see examples like this in the documentation for NetTrain. Let's make some data for your example of a function that converts from RGBValues to Hues: rndExample := With[{...

38

Indeed, this functionality still exists, but it has been moved into its own package. Load the package: Needs["aBetterProgrammer"] You will have access to such functions as GimmeDaCodez (answers any nebulous MMA.SE question by guessing the unspoken needs of the asker) WizardForm (an output wrapper; produces perfectly terse code; all function calls are ...

37

This is actually a useful question, because it gives an opportunity for us to communicate with the community about what is coming, so we can get feedback. So here is some preliminary information about our plans (subject to change, of course). First, we'll have the concept of a sequence of things (e.g. sequence of vectors, sequence of matrices, sequence of ...

37

Thank you for your summary. I would like to clarify and correct a few of your points. however, Mathematica - being proprietary - does not make it clear as to which algorithms they choose to use to implement their network layers. Therefore I honestly am not sure of the some of these layers' underpinnings. We use the same definitions as all the other ...

32

Mathematica's neural network functionality is based on MXNET. So you can use pre-trained models for MXNET or create and train state-of-the-art models with NetGraph. For example, pre-trained Inception-V3: https://github.com/dmlc/mxnet-model-gallery/blob/master/imagenet-1k-inception-v3.md URLDownload[ "http://data.dmlc.ml/mxnet/models/imagenet/inception-...

29

I wrestled with this for a while and got some kind of results, but nowhere near the great performance for which GANs are famous. Ultimately, they're absurdly sensitive to hyperparameters and initialization, and if you don't exactly imitate the published settings, you are unlikely to get good results. I figure I should post my attempt -- maybe the community ...

27

From A comprhensive overview of network layers and functions Motivation As Mathematica v.11 was released earlier this month with a host of new [[experimental]] functions and a limited number of examples on curated data that do not cover all layers, options, etc. I am posting this with the intent of augmenting Mathematica's documentation via the cummulative ...

27

It seems the model file in MXNet (checkpoint) is defined by two files: a ".json" file and a ".params" file. The json file contains the definition of the network, and the params file contains the actual weight and bias of each neuron. The params file is in the binary format of MXNet's NDArray representation. Thus, to export a network in Mathematica to MXNet, ...

26

Sebastian mentioned in his answer that deepdream can be possible using NetDerivative. Here are my attempts following his outlines. Instead of using the inception model, I'm using VGG-16 here for simplicity. Inception model allows arbitrary image size, but may need some extra normalization steps. The MXNet version of the VGG model can be downloaded from ...

25

It's on our list of things to do, but there are many other areas we want to cover, such as custom feature functions, customizable feature selection, boosting, NLP, deep learning of neural networks, convolutional nets, GPU acceleration, and so on. Until then, your only real solution is to deploy your trained classifier as an API function. Some simpler ...

22

Bring in pre-trained models is sometimes very useful. Alexey's answer is somewhat brief, here I'm trying to add some examples hopefully will be helpful. We can load the trained network by net = NeuralNetworksImportMXNetModel[ "model/Inception-7-symbol.json", "model/Inception-7-0001.params" ] and attach the final softmax layer to calculate the ...

22

Since version 11 most commands finally support the Interpretation option: Interpretation -> "Literal" being the classical (default) way of operation, and Interpretation -> "Guess" using advanced machine learning to get much better results than ReadProgrammerIntentions ever achieved. Makes programming a lot easier. You can emulate the old behavior with ...

22

I tend to use a pattern matching approach: myCode/.{x_?BugQ:>BugStrip[x],x_?TypoQ:>Detypo[x],x_?WrongSignQ:>-x,x_?OffBy2PiQ:>x*2\[Pi]} With the usual caveat that pattern matching can be slower than other methods, but conceptually easier to understand. Hopefully someone will aggregate the answers to compare performance. Good luck!

21

You can pass the undocumented option "ShowTrainingProgress" -> False to turn off the training progress blob thing. As for monitoring the progress yourself, there is a feature coming in 11.1 called Checkpointing that lets you specify a callback to every so often that gets access to the partially trained net. You WOULD use it like so: NetTrain[ ..., ...

21

If you have an inception model, its mostly possible using hidden functionality (but without GPU training). The steps would look like this: Cut the inception model at some level using Take. Then add a Ramp (or other) positive activation and SummationLayer: DeepDream simply wants to maximize the total amount of neuronal firing at the last layer (the original ...

19

Here's the code. What I mentioned in the Q&A session is using ReshapeLayer to turn the input vector into a 1-channel, flat tensor that ConvolutionLayer can operate on, not to actually use images, per se. I've limited things here just to the original industries, but you can try more if you want. Downloading takes a while, so I have an Export there you ...

19

Layers BatchNormalizationLayer There are several layers introduced in v.11 that can not be used uninitialized, this is one of them. Input must be either a rank 1 or rank 3 tensor. To be honest, I do not think we can see its true effect on one input as demonstrated by these two examples below. I believe the effect of Batch normalization is only implemented ...

19

Below is given a function definition that can be used to make a neural network plot with formulae and activation functions graphics. The code/plot can be garnished some more, but at this point I find it good enough... Clear[FormulaNeuralNetworkGraph] FormulaNeuralNetworkGraph[layerCounts : {_Integer, _Integer, _Integer}] := Block[{gr1, gr2, gr3, gr4, ...

19

This function was deprecated in V4.2, being succeeded by CellularAutomaton. Since your answer is hidden somewhere in rules like 110, why reinvent the wheel with ReadProgrammerIntentions?

18

The key is GraphLayout -> "MultipartiteEmbedding". layerCounts = {5, 3, 3, 8, 2}; graph = GraphUnion @@ MapThread[ IndexGraph, {CompleteGraph /@ Partition[layerCounts, 2, 1], FoldList[Plus, 0, layerCounts[[;; -3]]]} ]; vstyle = Catenate[ Thread /@ Thread[ TakeList[VertexList[graph], layerCounts] -> ColorData[97] /@ Range@...

18

1 - Summary of a simple solution In this particular DIGIT case there is a very simple solution based on neural nets (NNs)trained on MNIST Data. It is just a few lines of code: i=Import["https://i.stack.imgur.com/LC2c2.png"]; imageGRID = ImagePartition[i, Scaled[1/22]]; lenet = NetModel["LeNet Trained on MNIST Data"]; test[x_] := If[ImageDistance[imageGRID[[...

17

I think it would be simpler to construct the simple neural network rather than setting the properties in Classify. Here is an example using a three-layer net to classify the MNIST handwritten digits. We first load the data, and we will take 5000 examples as training data and 1000 examples as test data resource = ResourceObject["MNIST"]; trainingDataImg = ...

17

... however in Mathematica the net always performs a linear fit, no matter how many layers und neurons I use. I'm guessing you're using only DotPlusLayers. These are linear - so no matter how many you use, you will always get a linear mapping. To get a nonlinear mapping, you either have to add nonlinear input (e.g. giving the network x, x^2, x^3 as input ...

16

Supporting custom layers is on our to-do list, and should be ready for either 11.2 or 11.3. For interest: what applications do you want custom layers for? And how performant do you need your custom layer to be? (for example, do you want to be able to write your own CUDA implementation? Or are you happy with writing your own CPU layer?)

16

There are two parts to your question: 1. How to use out-of-core classification and 2. Why is the result bad. For the first part, you can use a generator to solve the problem. And for the second part, the reason for a bad result is because the data is not randomized. fileName = "/Users/xslittlegrass/Downloads/test_data_SE.dat"; data = RandomSample@Flatten@...

16

Okay here's how you do out-of-core training with HDF5: input = RandomReal[1, {1000, 2}]; output = RandomReal[1, {1000, 2}]; Get["GeneralUtilities`"]; ExportStructuredHDF5["test.h5", <|"Input" -> input, "Output" -> output|>] NetTrain[LinearLayer["Input" -> 2, "Output" -> 2], File["test.h5"]] The use of ExportStructuredHDF5 is just for ...

16

Here is a simple example that may help you get started. In this example, we are going to a predict a simple time series of a sinusoid wave. data = Table[Sin[x], {x, 0, 100, 0.04}]; We will cut the data into windows of 51 data points. The first 50 points as a whole is our X, and the last data point is our Y. training = RandomSample[ List /@ Most[#] -&...

16

Update: So after adding the missing features I decided to give your actual problem a go. This is what I have: You'll note a little "Add Layer" ActionMenu on the right. That's really the only actual extension to the basic BlockBuilder[] interface I needed. Wasn't hard to get in. The Run function turned out to be something of a tough problem. I had ...

Only top voted, non community-wiki answers of a minimum length are eligible