有 Java 编程相关的问题?

你可以在下面搜索框中键入要查询的问题!

如何在java项目中的gpu中加载tensorflow模型

我正在尝试运行一个java项目,加载tensorflow模型进行对象检测。如何在gpu中运行此项目

我的系统有NVIDIA图形卡,并且已经切换到相同的图形卡。此外,CUDA已成功安装。我已经在cpu上运行了这个。现在我想切换到gpu

要切换到GPU,添加了以下配置。但未能切换到GPU

ConfigProto configproto = ConfigProto.newBuilder()
            .setAllowSoftPlacement(true)                 
            .setGpuOptions(GPUOptions.newBuilder()
            .setPerProcessGpuMemoryFraction(0.01).build())
            .build();

SavedModelBundle model = SavedModelBundle.loader(modeldir).withTags("serve").withConfigProto(configproto.toByteArray()).load()

我希望该模型在GPU中运行。但得到的结果如下所示

2019-06-28 14:50:25.652043: I tensorflow/cc/saved_model/reader.cc:31] Reading SavedModel from: /saved_model

2019-06-28 14:50:25.686901: I tensorflow/cc/saved_model/reader.cc:54] Reading meta graph with tags { serve }

2019-06-28 14:50:25.699563: I tensorflow/core/platform/cpu_feature_guard.cc:141] Your CPU supports instructions that this TensorFlow binary was not compiled to use: SSE4.1 SSE4.2 AVX AVX2 FMA

2019-06-28 14:50:25.704712: I tensorflow/core/platform/profile_utils/cpu_utils.cc:94] CPU Frequency: 2712000000 Hz

2019-06-28 14:50:25.704847: I tensorflow/compiler/xla/service/service.cc:150] XLA service 0x7f6cf036be50 executing computations on platform Host. Devices:

2019-06-28 14:50:25.704862: I tensorflow/compiler/xla/service/service.cc:158] StreamExecutor device (0): ,

2019-06-28 14:50:25.759224: I tensorflow/cc/saved_model/loader.cc:182] Restoring SavedModel bundle.

2019-06-28 14:50:25.759280: I tensorflow/cc/saved_model/loader.cc:192] The specified SavedModel has no variables; no checkpoints were restored. File does not exist: /saved_model/variables/variables.index

2019-06-28 14:50:25.759291: I tensorflow/cc/saved_model/loader.cc:285] SavedModel load for tags { serve }; Status: success. Took 107259 microseconds.


共 (0) 个答案