This repository has been archived by the owner on Nov 17, 2023. It is now read-only.
Replies: 1 comment 2 replies
-
Are you loading parameters that were saved on your PC? In MXNet 1.x, the parameter format does not handle endianness and parameters will be loaded incorrectly when switching endianness between save and load. As workaround, please save the parameters as numpy arrays with |
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
OS: Ubuntu 18.04 64bit LTS
Anaconda3-2019.03-Linux-x86_64
conda env used, Python: 3.6.8
pip install docker, pip install docker-compose
git clone --recursive https://github.com/apache/incubator-mxnet.git
cd incubator-mxnet
git checkout 1.5.1
git submodule update --init --recursive
export CC=armv7a-linux-androideabi23-clang
export CXX=armv7a-linux-androideabi23-clang++
2.Then i build openblas, everything is ok
3. and then i build my libmxnet_predict.so, many issues come out, i solved them one by one
need to modify the 'makefile' in amalgamation, besides modify OpenBLAS path, need to change your export PATH to the android-ndk-r21d/toolchains/llvm/prebuilt/linux-x86_64/bin and exportCC=armv7a-linux-androideabi23-clang, and export XX=armv7a-linux-androideabi23-clang++, and add more include path in the CFLAGS:
-I../include -I${TPARTYDIR}/dmlc-core/include -I${TPARTYDIR}/tvm/nnvm/include -I${TPARTYDIR}/mshadow
-I${TPARTYDIR}/dlpack/include -I${TPARTYDIR}/tvm/nnvm -I${TPARTYDIR}/ps-lite/include,
also need to add c++11 support in the CFLAGS, "LDFLAGS+= -Wl,--no-warn-mismatch -lm_hard" => LDFLAGS+= -Wl,--no-warn-mismatch -lm ....
after 'amalgamation.py' in amalgamation add blacklist = [ 'x86intrin.h'] , successfully build
then i push the libmxnet_predict.so and the test program to the deviece it will run and failed .
Could you please help verify and fix this issue?
Use Android Studio.
Android.mk,
include $(CLEAR_VARS)
LOCAL_MODULE := mxnet_inference
LOCAL_SRC_FILES := $(LOCAL_PATH)/libs/libmxnet_predict.so
LOCAL_EXPORT_C_INCLUDES := $(LOCAL_PATH)/include/mxnet
include $(PREBUILT_SHARED_LIBRARY)
...
LOCAL_SHARED_LIBRARIES += mxnet_inference
include $(BUILD_SHARED_LIBRARY)
Application.mk
APP_ABI := armeabi-v7a
APP_PLATFORM := android-23
APP_STL := c++_static
NDK_TOOLCHAIN_VERSION := clang
APP_BUILD_SCRIPT := Android.mk
build.gradle
android {
compileSdkVersion 29
buildToolsVersion "29.0.2"
defaultConfig {
applicationId "com.tistory.webnautes.useopencvwithndk_build"
minSdkVersion 21
targetSdkVersion 25
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
// ndk {
// abiFilters "armeabi-v7a"
// }
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
externalNativeBuild {
ndkBuild {
path 'src/main/jni/Android.mk'
}
}
packagingOptions {
// pickFirst 'lib/arm64-v8a/'
pickFirst 'lib/armeabi-v7a/'
// pickFirst 'lib/x86/'
// pickFirst 'lib/x86_64/'
}
}
my error log is : E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.tistory.webnautes.useopencvwithndk_build, PID: 17645
java.lang.UnsatisfiedLinkError: dlopen failed: library "E:/2020/WorkSpace/AndroidStudioProjects_backup/UseOpenCVwithndkbuild/app/build/intermediates/ndkBuild/debug/obj/local/armeabi-v7a/libmxnet_predict.so" not found
at java.lang.Runtime.loadLibrary(Runtime.java:372)
at java.lang.System.loadLibrary(System.java:1076)
at com.tistory.webnautes.useopencvwithndk_build.MainActivity.(MainActivity.java:48)
at java.lang.Class.newInstance(Native Method)
at android.app.Instrumentation.newActivity(Instrumentation.java:1095)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:3083)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:3349)
at android.app.ActivityThread.access$1100(ActivityThread.java:221)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1794)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:158)
at android.app.ActivityThread.main(ActivityThread.java:7224)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1230)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1120)
I changed ndk version and api version... but error is same...
Beta Was this translation helpful? Give feedback.
All reactions