Skip to content

Commit

Permalink
[MXNET-116] Fix OSX native package and make ImageClassifier/ObjectDet…
Browse files Browse the repository at this point in the history
…ector member private (apache#10254)

* Solve the native package build failure

* Add Docs change

* Amend the issues to the previous codes, revert the OSX Docs
  • Loading branch information
lanking520 authored and zheng-da committed Jun 28, 2018
1 parent c2221e6 commit ef103e6
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 14 deletions.
12 changes: 9 additions & 3 deletions docs/install/osx_setup.md
Original file line number Diff line number Diff line change
@@ -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).

Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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]()
Expand Down Expand Up @@ -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 = {
Expand Down
2 changes: 1 addition & 1 deletion scala-package/native/osx-x86_64-cpu/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down

0 comments on commit ef103e6

Please sign in to comment.