You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mxnet.apache.org by ns...@apache.org on 2018/03/27 21:40:01 UTC

[incubator-mxnet] branch master updated: [MXNET-116] Fix OSX native package and make ImageClassifier/ObjectDetector member private (#10254)

This is an automated email from the ASF dual-hosted git repository.

nswamy pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-mxnet.git


The following commit(s) were added to refs/heads/master by this push:
     new 88f2bd0  [MXNET-116] Fix OSX native package and make ImageClassifier/ObjectDetector member private (#10254)
88f2bd0 is described below

commit 88f2bd04f688926ee76365cfb263e99cde97c2c3
Author: Lanking <la...@live.com>
AuthorDate: Tue Mar 27 14:39:55 2018 -0700

    [MXNET-116] Fix OSX native package and make ImageClassifier/ObjectDetector member private (#10254)
    
    * Solve the native package build failure
    
    * Add Docs change
    
    * Amend the issues to the previous codes, revert the OSX Docs
---
 docs/install/osx_setup.md                             | 12 +++++++++---
 .../scala/ml/dmlc/mxnet/infer/ImageClassifier.scala   |  3 ++-
 .../scala/ml/dmlc/mxnet/infer/ObjectDetector.scala    | 19 ++++++++++---------
 scala-package/native/osx-x86_64-cpu/pom.xml           |  2 +-
 4 files changed, 22 insertions(+), 14 deletions(-)

diff --git a/docs/install/osx_setup.md b/docs/install/osx_setup.md
index c1fa0fc..4d979b3 100644
--- a/docs/install/osx_setup.md
+++ b/docs/install/osx_setup.md
@@ -1,4 +1,4 @@
-# Installing MXNet froum source on OS X (Mac)
+# Installing MXNet from source on OS X (Mac)
 
 **NOTE:** For prebuild MXNet with Python installation, please refer to the [new install guide](http://mxnet.io/install/index.html).
 
@@ -65,8 +65,8 @@ Install the dependencies, required for MXNet, with the following commands:
 	brew install openblas
 	brew tap homebrew/core
 	brew install opencv
-	# For getting pip
-	brew install python
+	# Get pip
+	easy_install pip
 	# For visualization of network graphs
 	pip install graphviz
 	# Jupyter notebook
@@ -167,6 +167,12 @@ You might want to add this command to your ```~/.bashrc``` file. If you do, you
 For more details about installing and using MXNet with Julia, see the [MXNet Julia documentation](http://dmlc.ml/MXNet.jl/latest/user-guide/install/).
 
 ## Install the MXNet Package for Scala
+
+If you haven't installed maven yet, you need to install it now (required by the makefile):
+```bash
+    brew install maven
+```
+
 Before you build MXNet for Scala from source code, you must complete [building the shared library](#build-the-shared-library). After you build the shared library, run the following command from the MXNet source root directory to build the MXNet Scala package:
 
 ```bash
diff --git a/scala-package/infer/src/main/scala/ml/dmlc/mxnet/infer/ImageClassifier.scala b/scala-package/infer/src/main/scala/ml/dmlc/mxnet/infer/ImageClassifier.scala
index 070b0bf..f05b2e2 100644
--- a/scala-package/infer/src/main/scala/ml/dmlc/mxnet/infer/ImageClassifier.scala
+++ b/scala-package/infer/src/main/scala/ml/dmlc/mxnet/infer/ImageClassifier.scala
@@ -110,7 +110,8 @@ class ImageClassifier(modelPathPrefix: String,
     result
   }
 
-  def getClassifier(modelPathPrefix: String, inputDescriptors: IndexedSeq[DataDesc],
+  private[infer] def getClassifier(modelPathPrefix: String,
+                                     inputDescriptors: IndexedSeq[DataDesc],
                     contexts: Array[Context] = Context.cpu(),
                     epoch: Option[Int] = Some(0)): Classifier = {
     new Classifier(modelPathPrefix, inputDescriptors, contexts, epoch)
diff --git a/scala-package/infer/src/main/scala/ml/dmlc/mxnet/infer/ObjectDetector.scala b/scala-package/infer/src/main/scala/ml/dmlc/mxnet/infer/ObjectDetector.scala
index 30e1432..5af3fe9 100644
--- a/scala-package/infer/src/main/scala/ml/dmlc/mxnet/infer/ObjectDetector.scala
+++ b/scala-package/infer/src/main/scala/ml/dmlc/mxnet/infer/ObjectDetector.scala
@@ -42,20 +42,20 @@ class ObjectDetector(modelPathPrefix: String,
                      contexts: Array[Context] = Context.cpu(),
                      epoch: Option[Int] = Some(0)) {
 
-  val imgClassifier: ImageClassifier =
+  protected[infer]  val imgClassifier: ImageClassifier =
     getImageClassifier(modelPathPrefix, inputDescriptors, contexts, epoch)
 
-  val inputShape = imgClassifier.inputShape
+  protected[infer] val inputShape = imgClassifier.inputShape
 
-  val handler = imgClassifier.handler
+  protected[infer] val handler = imgClassifier.handler
 
-  val predictor = imgClassifier.predictor
+  protected[infer] val predictor = imgClassifier.predictor
 
-  val synset = imgClassifier.synset
+  protected[infer] val synset = imgClassifier.synset
 
-  val height = imgClassifier.height
+  protected[infer] val height = imgClassifier.height
 
-  val width = imgClassifier.width
+  protected[infer] val width = imgClassifier.width
 
   /**
     * To Detect bounding boxes and corresponding labels
@@ -98,7 +98,7 @@ class ObjectDetector(modelPathPrefix: String,
     batchResult.toIndexedSeq
   }
 
-  private def sortAndReformat(predictResultND: NDArray, topK: Option[Int])
+  private[infer] def sortAndReformat(predictResultND: NDArray, topK: Option[Int])
   : IndexedSeq[(String, Array[Float])] = {
     val predictResult: ListBuffer[Array[Float]] = ListBuffer[Array[Float]]()
     val accuracy: ListBuffer[Float] = ListBuffer[Float]()
@@ -157,7 +157,8 @@ class ObjectDetector(modelPathPrefix: String,
     result
   }
 
-  def getImageClassifier(modelPathPrefix: String, inputDescriptors: IndexedSeq[DataDesc],
+  private[infer] def getImageClassifier(modelPathPrefix: String,
+                                        inputDescriptors: IndexedSeq[DataDesc],
                          contexts: Array[Context] = Context.cpu(),
                          epoch: Option[Int] = Some(0)):
   ImageClassifier = {
diff --git a/scala-package/native/osx-x86_64-cpu/pom.xml b/scala-package/native/osx-x86_64-cpu/pom.xml
index fa0f5b6..529b126 100644
--- a/scala-package/native/osx-x86_64-cpu/pom.xml
+++ b/scala-package/native/osx-x86_64-cpu/pom.xml
@@ -67,7 +67,7 @@
             <linkerMiddleOption>-Wl,-x</linkerMiddleOption>
             <linkerMiddleOption>${lddeps}</linkerMiddleOption>
             <linkerMiddleOption>-force_load ../../../lib/libmxnet.a</linkerMiddleOption>
-            <linkerMiddleOption>-force_load ../../../nnvm/lib/libnnvm.a</linkerMiddleOption>
+            <linkerMiddleOption>-force_load ../../../3rdparty/nnvm/lib/libnnvm.a</linkerMiddleOption>
           </linkerMiddleOptions>
           <linkerEndOptions>
             <linkerEndOption>${ldflags}</linkerEndOption>

-- 
To stop receiving notification emails like this one, please contact
nswamy@apache.org.