You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mxnet.apache.org by GitBox <gi...@apache.org> on 2018/04/11 20:50:44 UTC

[GitHub] nswamy closed pull request #10474: [MXNET-298] Scala Infer API docs landing page

nswamy closed pull request #10474: [MXNET-298] Scala Infer API docs landing page
URL: https://github.com/apache/incubator-mxnet/pull/10474
 
 
   

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

diff --git a/docs/api/scala/index.md b/docs/api/scala/index.md
index 67e1f247ae5..e96892b5800 100644
--- a/docs/api/scala/index.md
+++ b/docs/api/scala/index.md
@@ -1,11 +1,20 @@
 # MXNet - Scala API
+MXNet supports the Scala programming language. The MXNet Scala package brings flexible and efficient GPU
+computing and state-of-art deep learning to Scala. It enables you to write seamless tensor/matrix computation with multiple GPUs in Scala. It also lets you construct and customize the state-of-art deep learning models in Scala, and apply them to tasks, such as image classification and data science challenges.
 
-See the [MXNet Scala API Documentation](http://mxnet.incubator.apache.org/api/scala/docs/index.html).
+See the [MXNet Scala API Documentation](docs/index.html#org.apache.mxnet.package) for detailed API information.
 
-MXNet supports the Scala programming language. The MXNet Scala package brings flexible and efficient GPU
-computing and state-of-art deep learning to Scala. It enables you to write seamless tensor/matrix computation with multiple GPUs in Scala. It also lets you construct and customize the state-of-art deep learning models in Scala,
-  and apply them to tasks, such as image classification and data science challenges.
 
+## Image Classification with the Scala Infer API
+The Infer API can be used for single and batch image classification. More information can be found at the following locations:
+
+* [Infer API Overview](infer.html)
+* [Infer API Scaladocs](docs/index.html#org.apache.mxnet.infer.package)
+* [Single Shot Detector Inference Example](https://github.com/apache/incubator-mxnet/tree/master/scala-package/examples/src/main/scala/org/apache/mxnetexamples/infer/objectdetector)
+* [Image Classification Example](https://github.com/apache/incubator-mxnet/tree/master/scala-package/examples/src/main/scala/org/apache/mxnetexamples/infer/imageclassifier)
+
+
+## Tensor and Matrix Computations
 You can perform tensor or matrix computation in pure Scala:
 
 ```scala
@@ -25,18 +34,18 @@ You can perform tensor or matrix computation in pure Scala:
    res3: org.apache.mxnet.Shape = (2,3)
 ```
 
- ## Scala API Reference
- * [Module API is a flexible high-level interface for training neural networks.](module.md)
- * [Model API is an alternate simple high-level interface for training neural networks.](model.md)
- * [Symbolic API performs operations on NDArrays to assemble neural networks from layers.](symbol.md)
- * [IO Data Loading API performs parsing and data loading.](io.md)
- * [NDArray API performs vector/matrix/tensor operations.](ndarray.md)
- * [KVStore API performs multi-GPU and multi-host distributed training.](kvstore.md)
-
 
-## Resources
+## Scala API Tutorials
+* [Module API is a flexible high-level interface for training neural networks.](module.html)
+* [Symbolic API performs operations on NDArrays to assemble neural networks from layers.](symbol.html)
+* [IO Data Loading API performs parsing and data loading.](io.html)
+* [NDArray API performs vector/matrix/tensor operations.](ndarray.html)
+* [KVStore API performs multi-GPU and multi-host distributed training.](kvstore.html)
+* [Model API is an alternate simple high-level interface for training neural networks.](model.html) **DEPRECATED**
 
-* [MXNet Scala API Documentation](http://mxnet.incubator.apache.org/api/scala/docs/index.html)
-* [Handwritten Digit Classification in Scala](http://mxnet.incubator.apache.org/tutorials/scala/mnist.html)
+## Related Resources
+* [MXNet Scala API Documentation](docs/index.html#org.apache.mxnet.package)
+* [Handwritten Digit Classification in Scala](../../tutorials/scala/mnist.html)
+* [Developing a Character-level Language Model in Scala](../../tutorials/scala/char_lstm.html)
 * [Neural Style in Scala on MXNet](https://github.com/apache/incubator-mxnet/blob/master/scala-package/examples/src/main/scala/org/apache/mxnetexamples/neuralstyle/NeuralStyle.scala)
 * [More Scala Examples](https://github.com/apache/incubator-mxnet/tree/master/scala-package/examples/src/main/scala/org/apache/mxnetexamples)
diff --git a/docs/api/scala/infer.md b/docs/api/scala/infer.md
new file mode 100644
index 00000000000..dfa21c17841
--- /dev/null
+++ b/docs/api/scala/infer.md
@@ -0,0 +1,42 @@
+# Infer API
+The MXNet Scala Infer API provides you with model loading and inference functionality using the MXNet Scala package.
+
+
+## Prerequisites
+To use the Infer API you must first install the MXNet Scala package. Instructions for this are provided in the following variations:
+* [Tutorial for setting up a project in the IntelliJ IDE](../../tutorials/scala/mxnet_scala_on_intellij.html)
+* [Installing the MXNet Scala Package for macOS](../../install/ubuntu_setup.html#install-the-mxnet-package-for-scala)
+* [Installing the MXNet Scala for Linux](../../install/ubuntu_setup.html#install-the-mxnet-package-for-scala)
+
+
+## Inference
+The Scala Infer API includes both single image and batch modes. Here is an example of running inference on a single image by using the `ImageClassifier` class. A complete [image classification example](https://github.com/apache/incubator-mxnet/blob/master/scala-package/examples/src/main/scala/org/apache/mxnetexamples/infer/imageclassifier/ImageClassifierExample.scala) using ResNet-152 is provided in the [Scala package's example folder](https://github.com/apache/incubator-mxnet/tree/master/scala-package/examples/src/main/scala/org/apache/mxnetexamples). This example also demonstrates inference with batches of images.
+
+```scala
+def runInferenceOnSingleImage(modelPathPrefix: String, inputImagePath: String,
+                              context: Array[Context]):
+IndexedSeq[IndexedSeq[(String, Float)]] = {
+  val dType = DType.Float32
+  val inputShape = Shape(1, 3, 224, 224)
+
+  val inputDescriptor = IndexedSeq(DataDesc("data", inputShape, dType, "NCHW"))
+
+  // Create object of ImageClassifier class
+  val imgClassifier: ImageClassifier = new
+      ImageClassifier(modelPathPrefix, inputDescriptor, context)
+
+  // Loading single image from file and getting BufferedImage
+  val img = ImageClassifier.loadImageFromFile(inputImagePath)
+
+  // Running inference on single image
+  val output = imgClassifier.classifyImage(img, Some(5))
+
+  output
+}
+```
+
+
+## Related Resources
+* [Infer API Scaladocs](docs/index.html#org.apache.mxnet.infer.package)
+* [Single Shot Detector Inference Example](https://github.com/apache/incubator-mxnet/tree/master/scala-package/examples/src/main/scala/org/apache/mxnetexamples/infer/objectdetector)
+* [Image Classification Example](https://github.com/apache/incubator-mxnet/tree/master/scala-package/examples/src/main/scala/org/apache/mxnetexamples/infer/imageclassifier)
diff --git a/docs/tutorials/scala/README.md b/docs/tutorials/scala/README.md
new file mode 100644
index 00000000000..0081f9c8216
--- /dev/null
+++ b/docs/tutorials/scala/README.md
@@ -0,0 +1,7 @@
+# MXNet-Scala Tutorials
+
+* [Setup Scala with MXNet and Create a MXNet-Scala Project with IntelliJ](mxnet_scala_on_intellij.md)
+* [MNIST with MXNet-Scala](mnist.md)
+* [Character-level Language Model with MXNet-Scala](char_lstm.md)
+
+See the [tutorials](http://mxnet.incubator.apache.org/tutorials/index.html#other-languages-api-tutorials) page on MXNet.io for more.


 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services