This repository has been archived by the owner on Nov 17, 2023. It is now read-only.
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
1910932
commit 70cadec
Showing
3 changed files
with
59 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
50 changes: 50 additions & 0 deletions
50
...src/test/java/org/apache/mxnetexamples/javaapi/infer/predictor/PredictorExampleSuite.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
package org.apache.mxnetexamples.javaapi.infer.predictor; | ||
|
||
import org.junit.BeforeClass; | ||
import org.junit.Test; | ||
import org.apache.mxnetexamples.Util; | ||
import org.slf4j.Logger; | ||
import org.slf4j.LoggerFactory; | ||
|
||
import java.io.File; | ||
|
||
public class PredictorExampleSuite { | ||
|
||
final static Logger logger = LoggerFactory.getLogger(PredictorExampleSuite.class); | ||
private static String modelPathPrefix = ""; | ||
private static String inputImagePath = ""; | ||
|
||
@BeforeClass | ||
public static void downloadFile() { | ||
logger.info("Downloading resnet-18 model"); | ||
|
||
String tempDirPath = System.getProperty("java.io.tmpdir"); | ||
logger.info("tempDirPath: %s".format(tempDirPath)); | ||
|
||
String baseUrl = "https://s3.us-east-2.amazonaws.com/scala-infer-models"; | ||
|
||
Util.downloadUrl(baseUrl + "/resnet-18/resnet-18-symbol.json", | ||
tempDirPath + "/resnet18/resnet-18-symbol.json", 3); | ||
Util.downloadUrl(baseUrl + "/resnet-18/resnet-18-0000.params", | ||
tempDirPath + "/resnet18/resnet-18-0000.params", 3); | ||
Util.downloadUrl(baseUrl + "/resnet-18/synset.txt", | ||
tempDirPath + "/resnet18/synset.txt", 3); | ||
Util.downloadUrl("https://s3.amazonaws.com/model-server/inputs/Pug-Cookie.jpg", | ||
tempDirPath + "/inputImages/resnet18/Pug-Cookie.jpg", 3); | ||
|
||
modelPathPrefix = tempDirPath + File.separator + "resnet18/resnet-18"; | ||
inputImagePath = tempDirPath + File.separator + | ||
"inputImages/resnet18/Pug-Cookie.jpg"; | ||
} | ||
|
||
@Test | ||
public void testPredictor(){ | ||
PredictorExample example = new PredictorExample(); | ||
String[] args = new String[]{ | ||
"--model-path-prefix", modelPathPrefix, | ||
"--input-image", inputImagePath | ||
}; | ||
example.main(args); | ||
} | ||
|
||
} |