我在运行Dl4j时遇到错误示例

时间:2017-06-18 06:27:42

标签: java deeplearning4j

我尝试为java" main"运行deeplearning java.lang.UnsatisfiedLinkError:java.library.path中没有jniopenblas

 Class Test{
    protected static final String[] allowedExtensions = 
    BaseImageLoader.ALLOWED_FORMATS;
    protected static int height = 20;
    protected static int width = 20;
    protected static int channels = 1;
    protected static int outputNum = 2;
    protected static final long seed = 123;
    protected static double rate = 0.006;





    protected static int epochs = 10;
    public static final Random randNumGen = new Random();
    private static Logger log = LoggerFactory.getLogger(Text2Saved.class);

    public static void main(String[] args) {

        File parentDir = new File("./data/text2_test");
        String modelfile = "./data/text2-goodmodel.model";
        System.out.println(modelfile);
            ParentPathLabelGenerator labelMaker = new ParentPathLabelGenerator();
        BalancedPathFilter pathFilter = new BalancedPathFilter(randNumGen, allowedExtensions, labelMaker);
        FileSplit filesInDir = new FileSplit(parentDir, allowedExtensions, randNumGen);

    // Split the image files into train and test.
        InputSplit[] filesInDirSplit = filesInDir.sample(pathFilter);
        InputSplit testData = filesInDirSplit[0];
        ImageRecordReader testReader = new ImageRecordReader(height, width, channels, labelMaker);
        System.out.println("Number of records in Test: " + testData.length());
        try {
            testReader.initialize(testData);

            MultiLayerNetwork model = ModelSerializer.restoreMultiLayerNetwork(new File(modelfile));

            DataSetIterator testIter = new RecordReaderDataSetIterator(testReader, 20, 1, outputNum);
            Evaluation eval = new Evaluation(outputNum);
            while (testIter.hasNext()) {
                DataSet next = testIter.next();
                INDArray output = model.output(next.getFeatureMatrix(), false);
                eval.eval(next.getLabels(), output);
            }
            System.out.println(eval.stats());
            log.info(eval.stats());

        } catch (IOException e) {
            e.printStackTrace();
        }
    }

异常详情

  

线程中的异常" main" java.lang.UnsatisfiedLinkError:java.library.path中没有jniopenblas

at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1867)
    at java.lang.Runtime.loadLibrary0(Runtime.java:870)
    at java.lang.System.loadLibrary(System.java:1122)
    at org.bytedeco.javacpp.Loader.loadLibrary(Loader.java:945)
    at org.bytedeco.javacpp.Loader.load(Loader.java:750)
    at org.bytedeco.javacpp.Loader.load(Loader.java:657)
    at org.bytedeco.javacpp.openblas.<clinit>(openblas.java:10)
    at org.nd4j.linalg.cpu.nativecpu.blas.CpuBlas.setMaxThreads(CpuBlas.java:87)
    at org.nd4j.nativeblas.Nd4jBlas.<init>(Nd4jBlas.java:36)
    at org.nd4j.linalg.cpu.nativecpu.blas.CpuBlas.<init>(CpuBlas.java:11)
    at org.nd4j.linalg.cpu.nativecpu.CpuNDArrayFactory.createBlas(CpuNDArrayFactory.java:79)
    at org.nd4j.linalg.factory.BaseNDArrayFactory.blas(BaseNDArrayFactory.java:71)
    at org.nd4j.linalg.cpu.nativecpu.blas.CpuLevel3.<init>(CpuLevel3.java:26)
    at org.nd4j.linalg.cpu.nativecpu.CpuNDArrayFactory.createLevel3(CpuNDArrayFactory.java:94)
    at org.nd4j.linalg.factory.BaseNDArrayFactory.level3(BaseNDArrayFactory.java:92)
    at org.nd4j.linalg.factory.BaseBlasWrapper.level3(BaseBlasWrapper.java:42)
    at org.nd4j.linalg.api.ndarray.BaseNDArray.mmuli(BaseNDArray.java:2849)
    at org.nd4j.linalg.api.ndarray.BaseNDArray.mmul(BaseNDArray.java:2643)
    at org.deeplearning4j.nn.layers.BaseLayer.preOutput(BaseLayer.java:373)
    at org.deeplearning4j.nn.layers.BaseLayer.activate(BaseLayer.java:384)
    at org.deeplearning4j.nn.layers.BaseLayer.activate(BaseLayer.java:405)
    at org.deeplearning4j.nn.multilayer.MultiLayerNetwork.activationFromPrevLayer(MultiLayerNetwork.java:590)
    at org.deeplearning4j.nn.multilayer.MultiLayerNetwork.feedForwardToLayer(MultiLayerNetwork.java:713)
    at org.deeplearning4j.nn.multilayer.MultiLayerNetwork.feedForward(MultiLayerNetwork.java:667)
    at org.deeplearning4j.nn.multilayer.MultiLayerNetwork.feedForward(MultiLayerNetwork.java:658)
    at org.deeplearning4j.nn.multilayer.MultiLayerNetwork.output(MultiLayerNetwork.java:1541)
    at org.woolfel.robottag.Text2Saved.main(Text2Saved.java:60)

0 个答案:

没有答案