我无法找出如何消除/解决以下错误,这些错误是在使用DL4J方法 restoreMultiLayerNetwork 加载神经网络模型时发生的 使用Android API> = 24:
调用方法 restoreMultiLayerNetwork 中的以下行时会发生错误:
params = Nd4j.read(ins2);
使用
InputStream ins2 = getResources().openRawResource(getResources().getIdentifier("coefficients", "raw", getPackageName()));
和
“ coefficients.bin”是在导出DL4J神经网络时通过以下方法从DL4J创建的系数文件:
ModelSerializer.writeModel(model, locationToSave, saveUpdater);
错误:“ classloader-命名空间”无法访问库
E /链接器:“ / data / app / com.arai.arai-1 / lib /”需要或添加的库“ /vendor/lib64/libcutils.so”(“/vendor/lib64/libcutils.so”)无法为名称空间访问arm64 / libjnind4jcpu.so“:[name =” classloader-namespace“,ld_library_paths =”“,default_library_paths =” / data / app / com.arai.arai-1 / lib / arm64:/ system / fake-libs64:/data/app/com.arai.arai-1/base.apk!/ lib / arm64-v8a:/data/app/com.arai.arai-1/split_lib_dependencies_apk.apk!/ lib / arm64- v8a:/data/app/com.arai.arai-1/split_lib_slice_0_apk.apk!/ lib / arm64-v8a:/data/app/com.arai.arai-1/split_lib_slice_1_apk.apk!/ lib / arm64-v8a: /data/app/com.arai.arai-1/split_lib_slice_2_apk.apk!/lib/arm64-v8a:/data/app/com.arai.arai-1/split_lib_slice_3_apk.apk!/lib/arm64-v8a:/data /app/com.arai.arai-1/split_lib_slice_4_apk.apk!/lib/arm64-v8a:/data/app/com.arai.arai-1/split_lib_slice_5_apk.apk!/lib/arm64-v8a:/data/app /com.arai.arai-1/split_lib_slice_6_apk.apk!/lib/arm64-v8a:/data/app/com.arai.arai-1/split_lib_slice_7_apk.apk!/lib/arm64-v8a:/data/app/com .ar ai.arai-1 / split_lib_slice_8_apk.apk!
需要或倾斜的库“ /vendor/lib64/libutils.so”(“/vendor/lib64/libutils.so”) “ /data/app/com.arai.arai-1/lib/arm64/libjnind4jcpu.so”不是 可用于名称空间:[name =“ classloader-namespace”, ld_library_paths =“”, default_library_paths =“ / data / app / com.arai.arai-1 / lib / arm64:/ system / fake-libs64:/data/app/com.arai.arai-1/base.apk!/ lib / arm64-v8a :/data/app/com.arai.arai-1/split_lib_dependencies_apk.apk!/ lib / arm64-v8a:/data/app/com.arai.arai-1/split_lib_slice_0_apk.apk!/ lib / arm64-v8a:/数据/app/com.arai.arai-1/split_lib_slice_1_apk.apk!/lib/arm64-v8a:/data/app/com.arai.arai-1/split_lib_slice_2_apk.apk!/lib/arm64-v8a:/data/ app / com.arai.arai-1 / split_lib_slice_3_apk.apk!/ lib / arm64-v8a:/data/app/com.arai.arai-1/split_lib_slice_4_apk.apk!/ lib / arm64-v8a:/ data / app / com.arai.arai-1 / split_lib_slice_5_apk.apk!/ lib / arm64-v8a:/data/app/com.arai.arai-1/split_lib_slice_6_apk.apk!/ lib / arm64-v8a:/ data / app / com。 arai.arai-1 / split_lib_slice_7_apk.apk!/ lib / arm64-v8a:/data/app/com.arai.arai-1/split_lib_slice_8_apk.apk!/ l
W /链接器:库“ /system/lib64/libbinder.so” (“ /system/lib64/libbinder.so”)需要或被 “ /data/app/com.arai.arai-1/lib/arm64/libjnind4jcpu.so”不是 可访问名称空间“ classloader-namespace”-访问为 暂时被授予http://b/26394120的解决方法,请注意 该访问权限将在以后的Android版本中删除。
E /链接器: 库“ /vendor/lib64/libnativeloader.so” (“ /vendor/lib64/libnativeloader.so”)需要或倾斜 “ /data/app/com.arai.arai-1/lib/arm64/libjnind4jcpu.so”不是 可用于名称空间:[name =“ classloader-namespace”, ld_library_paths =“”, default_library_paths =“ / data / app / com.arai.arai-1 / lib / arm64:/ system / fake-libs64:/data/app/com.arai.arai-1/base.apk!/ lib / arm64-v8a :/data/app/com.arai.arai-1/split_lib_dependencies_apk.apk!/ lib / arm64-v8a:/data/app/com.arai.arai-1/split_lib_slice_0_apk.apk!/ lib / arm64-v8a:/数据/app/com.arai.arai-1/split_lib_slice_1_apk.apk!/lib/arm64-v8a:/data/app/com.arai.arai-1/split_lib_slice_2_apk.apk!/lib/arm64-v8a:/data/ app / com.arai.arai-1 / split_lib_slice_3_apk.apk!/ lib / arm64-v8a:/data/app/com.arai.arai-1/split_lib_slice_4_apk.apk!/ lib / arm64-v8a:/ data / app / com.arai.arai-1 / split_lib_slice_5_apk.apk!/ lib / arm64-v8a:/data/app/com.arai.arai-1/split_lib_slice_6_apk.apk!/ lib / arm64-v8a:/ data / app / com。 arai.arai-1 / split_lib_slice_7_apk.apk!/ lib / arm64-v8a:/data/app/com.arai.arai-1/split_lib_slic
W /链接器:库“ /system/lib64/libandroid_runtime.so” (“ /system/lib64/libandroid_runtime.so”)需要或倾斜 “ /data/app/com.arai.arai-1/lib/arm64/libjnind4jcpu.so”不是 可访问名称空间“ classloader-namespace”-访问为 暂时被授予http://b/26394120的解决方法,请注意 该访问权限将在以后的Android版本中删除。
Android版本:API> = 24
从build.gradle中提取,其中设置了ND4J依赖项:
android {
compileSdkVersion 26
buildToolsVersion "26.0.1"
defaultConfig {
applicationId "com.arai.arai"
minSdkVersion 15
targetSdkVersion 23
versionCode 1
versionName "1.0"
multiDexEnabled true
javaCompileOptions {
annotationProcessorOptions {
includeCompileClasspath false
}
}
buildTypes {
release {
minifyEnabled true
shrinkResources true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
buildscript {
configurations.all {
resolutionStrategy {
force 'net.sf.proguard:proguard-gradle:5.3.2'
}
}
}
packagingOptions {
exclude 'META-INF/DEPENDENCIES'
exclude 'META-INF/DEPENDENCIES.txt'
exclude 'META-INF/LICENSE'
exclude 'META-INF/LICENSE.txt'
exclude 'META-INF/license.txt'
exclude 'META-INF/NOTICE'
exclude 'META-INF/NOTICE.txt'
exclude 'META-INF/notice.txt'
exclude 'META-INF/INDEX.LIST'
}
}
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:27.1.0'
compile 'com.mcxiaoke.volley:library-aar:1.0.0'
compile 'com.android.support:design:27.1.0'
compile (group: 'org.deeplearning4j', name: 'deeplearning4j-core', version: '1.0.0-beta2') {
exclude group: 'org.bytedeco.javacpp-presets', module: 'opencv-platform'
exclude group: 'org.bytedeco.javacpp-presets', module: 'leptonica-platform'
exclude group: 'org.bytedeco.javacpp-presets', module: 'hdf5-platform'
}
compile group: 'org.nd4j', name: 'nd4j-native', version: '1.0.0-beta2'
compile group: 'org.nd4j', name: 'nd4j-native', version: '1.0.0-beta2', classifier: "android-arm"
compile group: 'org.nd4j', name: 'nd4j-native', version: '1.0.0-beta2', classifier: "android-arm64"
compile group: 'org.nd4j', name: 'nd4j-native', version: '1.0.0-beta2', classifier: "android-x86"
compile group: 'org.nd4j', name: 'nd4j-native', version: '1.0.0-beta2', classifier: "android-x86_64"
compile group: 'org.bytedeco.javacpp-presets', name: 'openblas', version: '0.3.0-1.4.2'
compile group: 'org.bytedeco.javacpp-presets', name: 'openblas', version: '0.3.0-1.4.2', classifier: "android-arm"
compile group: 'org.bytedeco.javacpp-presets', name: 'openblas', version: '0.3.0-1.4.2', classifier: "android-arm64"
compile group: 'org.bytedeco.javacpp-presets', name: 'openblas', version: '0.3.0-1.4.2', classifier: "android-x86"
compile group: 'org.bytedeco.javacpp-presets', name: 'openblas', version: '0.3.0-1.4.2', classifier: "android-x86_64"
compile group: 'org.bytedeco.javacpp-presets', name: 'opencv', version: '3.4.2-1.4.2'
compile group: 'org.bytedeco.javacpp-presets', name: 'opencv', version: '3.4.2-1.4.2', classifier: "android-arm"
compile group: 'org.bytedeco.javacpp-presets', name: 'opencv', version: '3.4.2-1.4.2', classifier: "android-arm64"
compile group: 'org.bytedeco.javacpp-presets', name: 'opencv', version: '3.4.2-1.4.2', classifier: "android-x86"
compile group: 'org.bytedeco.javacpp-presets', name: 'opencv', version: '3.4.2-1.4.2', classifier: "android-x86_64"
compile group: 'org.bytedeco.javacpp-presets', name: 'leptonica', version: '1.76.0-1.4.2'
compile group: 'org.bytedeco.javacpp-presets', name: 'leptonica', version: '1.76.0-1.4.2', classifier: "android-arm"
compile group: 'org.bytedeco.javacpp-presets', name: 'leptonica', version: '1.76.0-1.4.2', classifier: "android-arm64"
compile group: 'org.bytedeco.javacpp-presets', name: 'leptonica', version: '1.76.0-1.4.2', classifier: "android-x86"
compile group: 'org.bytedeco.javacpp-presets', name: 'leptonica', version: '1.76.0-1.4.2', classifier: "android-x86_64"
implementation 'com.google.code.gson:gson:2.8.2'
annotationProcessor 'org.projectlombok:lombok:1.16.16'
implementation 'com.google.code.findbugs:annotations:3.0.1', {
exclude module: 'jsr305'
exclude module: 'jcip-annotations'
}
//This corrects for a junit version conflict.
configurations.all {
resolutionStrategy.force 'junit:junit:4.12'
}
}}