AICamera icon indicating copy to clipboard operation
AICamera copied to clipboard

Very slow, use new version caffe2

Open northeastsquare opened this issue 7 years ago • 5 comments

  1. I clone new caffe2, compile a cpu version, and have: libCaffe2_CPU.a libCAFFE2_NNPACK.a libCAFFE2_PTHREADPOOL.a libcpufeatures.a
  2. create script.ar: CREATE libcaffe2.a ADDLIB libCAFFE2_NNPACK.a ADDLIB libCAFFE2_PTHREADPOOL.a ADDLIB libcpufeatures.a ADDLIB libCaffe2_CPU.a SAVE END
  3. ar -M < script.ar 4.replace AICamera libcaffe2.a with the generated libcaffe2.a 5.in AICamera2/app/src/main/cpp, make a soft link to the new caffe2 source code, copy some proto.pb.h files 7.run with android studio

the result, speed very slow, Can you give me help? Where am I wrong? @bwasti

northeastsquare avatar Jul 25 '17 12:07 northeastsquare

By the way , recogition result not correct

northeastsquare avatar Jul 25 '17 13:07 northeastsquare

the size libcaffe2 which I use build_android.sh: 302257934 while you provide is : 31855028 nearly 10 times, why?

northeastsquare avatar Jul 26 '17 03:07 northeastsquare

below is the cmake summary:

Summary -- General: -- Git version : -- System : Android -- C++ compiler : /usr/android-ndk-r10e/toolchains/arm-linux-androideabi-4.9/prebuilt/linux-x86_64/bin/arm-linux-androideabi-g++ -- C++ compiler version : 4.9 -- Protobuf compiler : /home/xchen/src/caffe2/build_host_protoc/bin/protoc -- CXX flags : -fexceptions -frtti -Wno-psabi --sysroot=/usr/android-ndk-r10e/platforms/android-21/arch-arm -funwind-tables -finline-limit=64 -fsigned-char -no-canonical-prefixes -march=armv7-a -mfloat-abi=softfp -mfpu=neon -fdata-sections -ffunction-sections -Wa,--noexecstack -Wno-deprecated -std=c++11 -fPIC -Wno-narrowing -- Build type : Release -- Compile definitions : ;ANDROID;CAFFE2_USE_EIGEN_FOR_BLAS;EIGEN_MPL2_ONLY;CAFFE2_UNIQUE_LONG_TYPEMETA;CAFFE2_NO_BUILTIN_CPU_SUPPORTS

-- BUILD_SHARED_LIBS : OFF -- BUILD_PYTHON : OFF -- Python version : -- Python library : -- BUILD_TEST : OFF -- USE_CUDA : OFF -- USE_NERVANA_GPU : OFF -- USE_GLOG : OFF -- USE_GFLAGS : OFF -- USE_LMDB : OFF -- USE_LEVELDB : OFF -- USE_OPENCV : OFF -- USE_FFMPEG : -- USE_ZMQ : OFF -- USE_ROCKSDB : OFF -- USE_MPI : OFF -- USE_NCCL : OFF -- USE_NNPACK : ON -- USE_OPENMP : OFF -- USE_REDIS : OFF -- USE_GLOO : OFF -- Configuring done

northeastsquare avatar Jul 26 '17 03:07 northeastsquare

I got the same problem @northeastsquare

lhCheung1991 avatar Aug 01 '17 11:08 lhCheung1991

You're going to want to compile with -O3, let me add that to the CMakeLists in caffe2 :)

To do so yourself right now, edit this line to say

  set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -O3 -fPIC")

edit: waiting on tests to pass here https://github.com/caffe2/caffe2/pull/1000

bwasti avatar Aug 01 '17 17:08 bwasti