lanking520 commented on a change in pull request #10179: [MXNET-116] object 
detector class added
URL: https://github.com/apache/incubator-mxnet/pull/10179#discussion_r175977525
 
 

 ##########
 File path: 
scala-package/examples/src/main/scala/ml/dmlc/mxnetexamples/inferexample/SSDClassifierExample.scala
 ##########
 @@ -0,0 +1,96 @@
+package SSDClassifierExample
+
+import ml.dmlc.mxnet._
+import ml.dmlc.mxnet.infer._
+import org.kohsuke.args4j.{CmdLineParser, Option}
+import org.slf4j.LoggerFactory
+
+import scala.collection.JavaConverters._
+import java.nio.file.{Files, Paths}
+
+class SSDClassifierExample {
+  @Option(name = "--model-dir", usage = "the input model directory")
+  private val modelPath: String = "/model"
+  @Option(name = "--model-prefix", usage = "The prefix of the model")
+  private val modelPrefix: String = "/ssd_resnet50_512"
+  @Option(name = "--input-image", usage = "the input image")
+  private val inputImagePath: String = "/images/Cat-hd-wallpapers.jpg"
+  @Option(name = "--input-dir", usage = "the input batch of images directory")
+  private val inputImageDir: String = "/images/"
+}
+
+object SSDClassifierExample {
+
+  private val logger = LoggerFactory.getLogger(classOf[SSDClassifierExample])
+  private type SSDOut = (String, Array[Float])
+
+  def main(args: Array[String]): Unit = {
+    val inst = new SSDClassifierExample
+    val parser :CmdLineParser = new CmdLineParser(inst)
+    parser.parseArgument(args.toList.asJava)
+    val baseDir = System.getProperty("user.dir")
+    val mdDir = baseDir + inst.modelPath
+    val imgDir = baseDir + inst.inputImagePath
+    val imgPath = baseDir + inst.inputImageDir
+    if (!checkExist(Array(mdDir, imgDir, imgPath))) {
+      logger.error("Model or input image path does not exist")
+      sys.exit(1)
+    }
+
+    try {
+      println(mdDir)
+      val dType = DType.Float32
+      val inputShape = Shape(1, 3, 512, 512)
 
 Review comment:
   Will add this section on 03/21

----------------------------------------------------------------
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:
us...@infra.apache.org


With regards,
Apache Git Services

Reply via email to