kleinyuan / caffe2-ios Goto Github PK
View Code? Open in Web Editor NEWCaffe2 on iOS Real-time Demo. Test with Your Own Model and Photos.
License: MIT License
Caffe2 on iOS Real-time Demo. Test with Your Own Model and Photos.
License: MIT License
@KleinYuan Hi, thanks for the great job, it helps a lot . I am very curious about the time consumption of this demo , for instance , if the input image is 128*128 on width and height, and the device is iphone6 ,then how long will a single predict step costs? Looking forward to your reply.
I have successfully built Caffe2, but am not sure how to use my own dataset of training images in the Xcode project (building for iOS). I've looked here, but that seems to only refer to Python, and not Objective-C/Swift. How can I build a dataset of my own training images for use in a Caffe2 iOS application?
Debug build is ok.
But trying to build Release produses link errors:
Undefined symbols for architecture arm64:
"cv::_InputArray::_InputArray(cv::Mat const&)", referenced from:
caffe2::ImageInputOpcaffe2::CPUContext::DecodeAndTransposeOnly(std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator >, unsigned char*, int, int, std::__1::mersenne_twister_engine<unsigned int, 32ul, 624ul, 397ul, 31ul, 2567483615u, 11ul, 4294967295u, 7ul, 2636928640u, 15ul, 4022730752u, 18ul, 1812433253u>, std::__1::bernoulli_distribution) in libCaffe2_CPU.a(image_input_op.cc.o)
... other
"cv::_OutputArray::_OutputArray(cv::Mat&)", referenced from:
... other
I have MobileNetInit.pb and MobileNetPredict.pb in the models directory, but when I build this project, I got the error
'try!' expression unexpectedly raised an error: Error Domain=Caffe2 Code=1 "File named "mobileNetPredict.pb" not found in main bundle"
So how to use my model other than YOLO and Squeezenet
Hey!
Awesome job loading LeNet on the fly! On first run it seems to be loading fine but the output is something I'm not able to comprehend. If you can give me some idea about the issue itself I would love to fix it and submit a PR. :)
Thanks!
HI, I am working on some development for ios11. Would Caffe2-iOS work on that platform?
caffe2::Demangle(char const*),referenced from
Char const* caffe2::TypeMeta::Name()in caffe2.o
and so on
Symbols not found for architecture x86_64
linker command failed with exit code 1
There's a know issue that processing each image will not release memory correctly. Thus, the live classification feature may crash after a while. Working on it now.
I'm building for iOS, and ran into this error in Xcode when building the app:
Undefined symbols for architecture x86_64:
"caffe2::Demangle(char const*)", referenced from:
char const* caffe2::TypeMeta::Name<float>() in Caffe2.o
"long caffe2::TypeMeta::Id<float>()", referenced from:
std::__1::enable_if<std::is_fundamental<float>::value, caffe2::TypeMeta>::type caffe2::TypeMeta::Make<float>() in Caffe2.o
bool caffe2::TypeMeta::Match<float>() const in Caffe2.o
"caffe2::gTypeNames()", referenced from:
caffe2::TypeMeta::name() const in Caffe2.o
"caffe2::FLAGS_caffe2_print_blob_sizes_at_exit", referenced from:
caffe2::Workspace::~Workspace() in Caffe2.o
"caffe2::Workspace::PrintBlobSizes()", referenced from:
caffe2::Workspace::~Workspace() in Caffe2.o
"caffe2::ThreadPool::~ThreadPool()", referenced from:
caffe2::Workspace::~Workspace() in Caffe2.o
"caffe2::ReadProtoFromBinaryFile(char const*, google::protobuf::MessageLite*)", referenced from:
caffe2::ReadProtoFromFile(char const*, google::protobuf::Message*) in Caffe2.o
"typeinfo for caffe2::EnforceNotMet", referenced from:
caffe2::run(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) in Caffe2.o
float const* caffe2::Tensor<caffe2::CPUContext>::data<float>() const in Caffe2.o
caffe2::LoadPBFile(NSString*, caffe2::NetDef*) in Caffe2.o
void caffe2::Tensor<caffe2::CPUContext>::ShareExternalPointer<void caffe2::Tensor<caffe2::CPUContext>::ShareExternalPointer<float>(float*, unsigned long)::'lambda'(void*)>(void*, caffe2::TypeMeta const&, unsigned long, float&&) in Caffe2.o
"caffe2::FLAGS_caffe2_keep_on_shrink", referenced from:
void caffe2::Tensor<caffe2::CPUContext>::Resize<std::__1::vector<int, std::__1::allocator<int> > >(std::__1::vector<int, std::__1::allocator<int> >) in Caffe2.o
"caffe2::MessageLogger::MessageLogger(char const*, int, int)", referenced from:
caffe2::run(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) in Caffe2.o
"caffe2::Predictor::Predictor(caffe2::NetDef const&, caffe2::NetDef const&, caffe2::Workspace*)", referenced from:
std::__1::enable_if<!(std::is_array<caffe2::Predictor>::value), std::__1::unique_ptr<caffe2::Predictor, std::__1::default_delete<caffe2::Predictor> > >::type caffe2::make_unique<caffe2::Predictor, caffe2::NetDef&, caffe2::NetDef&>(caffe2::NetDef&&&, caffe2::NetDef&&&) in Caffe2.o
caffe2::getPredictor(NSString*, NSString*) in Caffe2.o
"caffe2::ReadProtoFromTextFile(char const*, google::protobuf::Message*)", referenced from:
caffe2::ReadProtoFromFile(char const*, google::protobuf::Message*) in Caffe2.o
"vtable for caffe2::EnforceNotMet", referenced from:
caffe2::EnforceNotMet::~EnforceNotMet() in Caffe2.o
NOTE: a missing vtable usually means the first non-inline virtual member function has no definition.
"caffe2::EnforceNotMet::EnforceNotMet(char const*, int, char const*, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, void const*)", referenced from:
caffe2::run(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) in Caffe2.o
float const* caffe2::Tensor<caffe2::CPUContext>::data<float>() const in Caffe2.o
caffe2::LoadPBFile(NSString*, caffe2::NetDef*) in Caffe2.o
void caffe2::Tensor<caffe2::CPUContext>::ShareExternalPointer<void caffe2::Tensor<caffe2::CPUContext>::ShareExternalPointer<float>(float*, unsigned long)::'lambda'(void*)>(void*, caffe2::TypeMeta const&, unsigned long, float&&) in Caffe2.o
"caffe2::Predictor::run(std::__1::vector<caffe2::Tensor<caffe2::CPUContext>*, std::__1::allocator<caffe2::Tensor<caffe2::CPUContext>*> > const&, std::__1::vector<caffe2::Tensor<caffe2::CPUContext>*, std::__1::allocator<caffe2::Tensor<caffe2::CPUContext>*> >*)", referenced from:
caffe2::run(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) in Caffe2.o
-[Caffe2 predictWithImage:predictor:] in Caffe2.o
"caffe2::NetDef::NetDef()", referenced from:
caffe2::run(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) in Caffe2.o
caffe2::getPredictor(NSString*, NSString*) in Caffe2.o
"caffe2::MessageLogger::~MessageLogger()", referenced from:
caffe2::run(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) in Caffe2.o
"caffe2::NetDef::~NetDef()", referenced from:
caffe2::run(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) in Caffe2.o
caffe2::getPredictor(NSString*, NSString*) in Caffe2.o
caffe2::Predictor::~Predictor() in Caffe2.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
What's the issue here? I already took a look at this issue, but the answer there doesn't seem to solve my problem.
not found in logging.h
I manually checked the cafe2 proto folder and the file is not there.
Am I missing something?
I git clone your project .And click the setup.sh. But some wrong happened.
That's the error :-- Could NOT find NNPACK (missing: NNPACK_INCLUDE_DIR NNPACK_LIBRARY)
CMake Warning at cmake/External/nnpack.cmake:58 (message):
NNPACK for mobile cmake support is wip
Call Stack (most recent call first):
cmake/Dependencies.cmake:52 (include)
CMakeLists.txt:85 (include)
-- Could NOT find GFlags (missing: GFLAGS_INCLUDE_DIR GFLAGS_LIBRARY)
CMake Warning at cmake/External/gflags.cmake:10 (message):
gflags is not found. Caffe2 will build without gflags support but it is
strongly recommended that you install gflags.
Call Stack (most recent call first):
cmake/External/glog.cmake:2 (include)
cmake/Dependencies.cmake:64 (include)
CMakeLists.txt:85 (include)
-- Could NOT find Glog (missing: GLOG_INCLUDE_DIR GLOG_LIBRARY)
CMake Warning at cmake/External/glog.cmake:13 (message):
glog is not found. Caffe2 will build without glog support but it is
strongly recommended that you install glog.
Call Stack (most recent call first):
cmake/Dependencies.cmake:64 (include)
CMakeLists.txt:85 (include)
CMake Warning at cmake/Dependencies.cmake:70 (message):
Not compiling with glog. Suppress this warning with -DUSE_GLOG=OFF
Call Stack (most recent call first):
CMakeLists.txt:85 (include)
CMake Warning at cmake/Dependencies.cmake:83 (message):
Not compiling with gflags. Suppress this warning with -DUSE_GFLAGS=OFF
Call Stack (most recent call first):
CMakeLists.txt:85 (include)
-- Could NOT find RocksDB (missing: RocksDB_INCLUDE_DIR RocksDB_LIBRARIES)
CMake Warning at cmake/Dependencies.cmake:131 (message):
Not compiling with RocksDB. Suppress this warning with -DUSE_ROCKSDB=OFF
Call Stack (most recent call first):
CMakeLists.txt:85 (include)
CMake Warning at cmake/Dependencies.cmake:174 (message):
Not compiling with OpenCV. Suppress this warning with -DUSE_OPENCV=OFF
Call Stack (most recent call first):
CMakeLists.txt:85 (include)
-- Could NOT find OpenMP_C (missing: OpenMP_C_FLAGS OpenMP_C_LIB_NAMES)
-- Could NOT find OpenMP_CXX (missing: OpenMP_CXX_FLAGS OpenMP_CXX_LIB_NAMES)
-- Could NOT find OpenMP (missing: OpenMP_C_FOUND OpenMP_CXX_FOUND)
CMake Warning at cmake/Dependencies.cmake:241 (message):
Not compiling with OpenMP. Suppress this warning with -DUSE_OPENMP=OFF
Call Stack (most recent call first):
CMakeLists.txt:85 (include)
CMake Warning at cmake/Dependencies.cmake:283 (message):
If not using cuda, one should not use NCCL either.
Call Stack (most recent call first):
CMakeLists.txt:85 (include)
CMake Warning at cmake/Dependencies.cmake:316 (message):
Gloo can only be used on Linux.
Call Stack (most recent call first):
CMakeLists.txt:85 (include)
-- BUILD_SHARED_LIBS : OFF
-- BUILD_PYTHON : OFF
-- Python version :
-- Python library :
-- USE_CUDA : OFF
-- USE_NERVANA_GPU : OFF
-- USE_GLOG : OFF
-- USE_GFLAGS : OFF
-- USE_LMDB : OFF
-- USE_LEVELDB : OFF
-- USE_OPENCV : OFF
-- 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
CMake Error at cmake/External/nnpack.cmake:102 (add_library):
Cannot find source file:
/Users/licas/tmp/caffe2/third_party/NNPACK/src/psimd/fft-block-mac.c
Tried extensions .c .C .c++ .cc .cpp .cxx .m .M .mm .h .hh .h++ .hm .hpp
.hxx .in .txx
Call Stack (most recent call first):
cmake/Dependencies.cmake:52 (include)
CMakeLists.txt:85 (include)
CMake Error at cmake/External/nnpack.cmake:64 (add_library):
Cannot find source file:
/Users/licas/tmp/caffe2/third_party/NNPACK_deps/pthreadpool/src/threadpool-pthreads.c
Tried extensions .c .C .c++ .cc .cpp .cxx .m .M .mm .h .hh .h++ .hm .hpp
.hxx .in .txx
Call Stack (most recent call first):
cmake/Dependencies.cmake:52 (include)
CMakeLists.txt:85 (include)
CMake Error: Cannot determine link language for target "CAFFE2_PTHREADPOOL".
CMake Error: CMake can not determine linker language for target: CAFFE2_PTHREADPOOL
CMake Error: Cannot determine link language for target "CAFFE2_NNPACK".
CMake Error: CMake can not determine linker language for target: CAFFE2_NNPACK
WARNING: Target "libprotoc" has EXCLUDE_FROM_ALL set and will not be built by default but an install rule has been provided for it. CMake does not define behavior for this case.
WARNING: Target "protoc" has EXCLUDE_FROM_ALL set and will not be built by default but an install rule has been provided for it. CMake does not define behavior for this case.
-- Generating done
-- Build files have been written to: /Users/licas/tmp/caffe2/build_ios
Can you help me ? :(
Hello, when I built this Xcode Project, two errors occured:
How can I fix these errors? Thanks
I use the profiling tool to analyze the time consumption of each function. Be surprised to find that there is no nnpack function and the eigen function has been used. So i guess that i have not 'open' the nnpack mode. Do you have any idea?
Since caffe2's development has moved to pytorch, wouldn't it be better to use this instead ?
I tried to follow these instructions to try to compile pytorch's version of caffe2 but I got sunk into many import issues and not working caffe code.
Would anyone be interested in helping with that?
While trying to load googLeNet downloaded from caffe2/models, got this issue:
[libprotobuf WARNING ${path}/caffe2/third_party/protobuf/src/google/protobuf/io/coded_stream.cc:605] Reading dangerously large protocol message. If the message turns out to be larger than 67108864 bytes, parsing will be halted for security reasons. To increase the limit (or to disable these warnings), see CodedInputStream::SetTotalBytesLimit() in google/protobuf/io/coded_stream.h.
[libprotobuf WARNING ${path}/caffe2/third_party/protobuf/src/google/protobuf/io/coded_stream.cc:82] The total number of bytes read was 35001128
libc++abi.dylib: terminating with uncaught exception of type caffe2::EnforceNotMet: [enforce fail at fully_connected_op.h:32] W.ndim() == 2. 4 Error from operator:
input: "pool5/7x7_s1" input: "loss3/classifier_w" input: "loss3/classifier_b" output: "loss3/classifier" type: "FC"
I kinda doubt whether it's because of the model is not correctly translated from Caffe (issue) and therefore, I am gonna translate it again locally and see what's going on.
I am trying to run Caffe2-iOS (the 2-0-stable version), and have followed the installation tutorial. When I build for the first time (without connecting a device), I'm getting the error described in the title:
'caffe2/core/predictor.h' file not found
What is the problem?
Thanks for the good work. However, I am getting linking error while compiling as below. Any suggestions would be appreciated.
Showing All Issues
Ld /Users/mahdi/Library/Developer/Xcode/DerivedData/caffe2-ios-fpqtinitbynmvhatqlrigymcrazv/Build/Products/Debug-iphonesimulator/caffe2-ios.app/caffe2-ios normal x86_64
cd /Users/mahdi/project/Caffe2-iOS/src/caffe2-ios
export IPHONEOS_DEPLOYMENT_TARGET=10.2
export PATH="/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin:/Applications/Xcode.app/Contents/Developer/usr/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin"
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++ -arch x86_64 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator10.3.sdk -L/Users/mahdi/Library/Developer/Xcode/DerivedData/caffe2-ios-fpqtinitbynmvhatqlrigymcrazv/Build/Products/Debug-iphonesimulator -L/Users/mahdi/project/Caffe2-iOS/src/caffe2-ios/caffe2-ios -F/Users/mahdi/Library/Developer/Xcode/DerivedData/caffe2-ios-fpqtinitbynmvhatqlrigymcrazv/Build/Products/Debug-iphonesimulator -F/Users/mahdi/project/Caffe2-iOS/src/caffe2-ios/caffe2-ios -filelist /Users/mahdi/Library/Developer/Xcode/DerivedData/caffe2-ios-fpqtinitbynmvhatqlrigymcrazv/Build/Intermediates/caffe2-ios.build/Debug-iphonesimulator/caffe2-ios.build/Objects-normal/x86_64/caffe2-ios.LinkFileList -Xlinker -rpath -Xlinker @executable_path/Frameworks -mios-simulator-version-min=10.2 -dead_strip -Xlinker -object_path_lto -Xlinker /Users/mahdi/Library/Developer/Xcode/DerivedData/caffe2-ios-fpqtinitbynmvhatqlrigymcrazv/Build/Intermediates/caffe2-ios.build/Debug-iphonesimulator/caffe2-ios.build/Objects-normal/x86_64/caffe2-ios_lto.o -Xlinker -export_dynamic -Xlinker -no_deduplicate -Xlinker -objc_abi_version -Xlinker 2 -stdlib=libc++ -fobjc-arc -fobjc-link-runtime -L/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator -Xlinker -add_ast_path -Xlinker /Users/mahdi/Library/Developer/Xcode/DerivedData/caffe2-ios-fpqtinitbynmvhatqlrigymcrazv/Build/Intermediates/caffe2-ios.build/Debug-iphonesimulator/caffe2-ios.build/Objects-normal/x86_64/caffe2_ios.swiftmodule -force_load caffe2-ios/libCaffe2_CPU.a -Xlinker -sectcreate -Xlinker __TEXT -Xlinker __entitlements -Xlinker /Users/mahdi/Library/Developer/Xcode/DerivedData/caffe2-ios-fpqtinitbynmvhatqlrigymcrazv/Build/Intermediates/caffe2-ios.build/Debug-iphonesimulator/caffe2-ios.build/caffe2-ios.app.xcent -framework AVFoundation -framework UIKit -framework Foundation -framework Accelerate -lprotobuf -lCaffe2_CPU -lstdc++ -framework opencv2 -lCAFFE2_PTHREADPOOL -lCAFFE2_NNPACK -lprotobuf-lite -Xlinker -dependency_info -Xlinker /Users/mahdi/Library/Developer/Xcode/DerivedData/caffe2-ios-fpqtinitbynmvhatqlrigymcrazv/Build/Intermediates/caffe2-ios.build/Debug-iphonesimulator/caffe2-ios.build/Objects-normal/x86_64/caffe2-ios_dependency_info.dat -o /Users/mahdi/Library/Developer/Xcode/DerivedData/caffe2-ios-fpqtinitbynmvhatqlrigymcrazv/Build/Products/Debug-iphonesimulator/caffe2-ios.app/caffe2-ios
ld: warning: ignoring file caffe2-ios/libCaffe2_CPU.a, missing required architecture x86_64 in file caffe2-ios/libCaffe2_CPU.a (3 slices)
ld: warning: ignoring file /Users/mahdi/project/Caffe2-iOS/src/caffe2-ios/caffe2-ios/libprotobuf.a, missing required architecture x86_64 in file /Users/mahdi/project/Caffe2-iOS/src/caffe2-ios/caffe2-ios/libprotobuf.a (3 slices)
ld: warning: ignoring file /Users/mahdi/project/Caffe2-iOS/src/caffe2-ios/caffe2-ios/libCaffe2_CPU.a, missing required architecture x86_64 in file /Users/mahdi/project/Caffe2-iOS/src/caffe2-ios/caffe2-ios/libCaffe2_CPU.a (3 slices)
ld: warning: ignoring file /Users/mahdi/project/Caffe2-iOS/src/caffe2-ios/caffe2-ios/libCAFFE2_PTHREADPOOL.a, missing required architecture x86_64 in file /Users/mahdi/project/Caffe2-iOS/src/caffe2-ios/caffe2-ios/libCAFFE2_PTHREADPOOL.a (3 slices)
ld: warning: ignoring file /Users/mahdi/project/Caffe2-iOS/src/caffe2-ios/caffe2-ios/libCAFFE2_NNPACK.a, missing required architecture x86_64 in file /Users/mahdi/project/Caffe2-iOS/src/caffe2-ios/caffe2-ios/libCAFFE2_NNPACK.a (3 slices)
ld: warning: ignoring file /Users/mahdi/project/Caffe2-iOS/src/caffe2-ios/caffe2-ios/libprotobuf-lite.a, missing required architecture x86_64 in file /Users/mahdi/project/Caffe2-iOS/src/caffe2-ios/caffe2-ios/libprotobuf-lite.a (3 slices)
Undefined symbols for architecture x86_64:
"caffe2::Demangle(char const*)", referenced from:
char const* caffe2::TypeMeta::Name() in Caffe2.o
"long caffe2::TypeMeta::Id()", referenced from:
std::__1::enable_if<std::is_fundamental::value, caffe2::TypeMeta>::type caffe2::TypeMeta::Make() in Caffe2.o
bool caffe2::TypeMeta::Match() const in Caffe2.o
"caffe2::gTypeNames()", referenced from:
caffe2::TypeMeta::name() const in Caffe2.o
"caffe2::FLAGS_caffe2_print_blob_sizes_at_exit", referenced from:
caffe2::Workspace::~Workspace() in Caffe2.o
"caffe2::Workspace::PrintBlobSizes()", referenced from:
caffe2::Workspace::~Workspace() in Caffe2.o
"caffe2::ThreadPool::~ThreadPool()", referenced from:
caffe2::Workspace::~Workspace() in Caffe2.o
"caffe2::NetDef::NetDef()", referenced from:
-[Caffe2 .cxx_construct] in Caffe2.o
"caffe2::EnforceNotMet::EnforceNotMet(char const*, int, char const*, std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator > const&, void const*)", referenced from:
ReadProtoIntoNet(std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator >, caffe2::NetDef*) in Caffe2.o
float const* caffe2::Tensorcaffe2::CPUContext::data() const in Caffe2.o
void caffe2::Tensorcaffe2::CPUContext::ShareExternalPointer<void caffe2::Tensorcaffe2::CPUContext::ShareExternalPointer(float*, unsigned long)::'lambda'(void*)>(void*, caffe2::TypeMeta const&, unsigned long, float&&) in Caffe2.o
"vtable for caffe2::EnforceNotMet", referenced from:
caffe2::EnforceNotMet::~EnforceNotMet() in Caffe2.o
NOTE: a missing vtable usually means the first non-inline virtual member function has no definition.
"caffe2::NetDef::~NetDef()", referenced from:
-[Caffe2 .cxx_destruct] in Caffe2.o
caffe2::Predictor::~Predictor() in Caffe2.o
"caffe2::FLAGS_caffe2_max_keep_on_shrink_memory", referenced from:
void caffe2::Tensorcaffe2::CPUContext::Resize<std::__1::vector<int, std::__1::allocator > >(std::__1::vector<int, std::__1::allocator >) in Caffe2.o
"google::protobuf::ShutdownProtobufLibrary()", referenced from:
-[Caffe2 dealloc] in Caffe2.o
"typeinfo for caffe2::EnforceNotMet", referenced from:
ReadProtoIntoNet(std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator >, caffe2::NetDef*) in Caffe2.o
float const* caffe2::Tensorcaffe2::CPUContext::data() const in Caffe2.o
void caffe2::Tensorcaffe2::CPUContext::ShareExternalPointer<void caffe2::Tensorcaffe2::CPUContext::ShareExternalPointer(float*, unsigned long)::'lambda'(void*)>(void*, caffe2::TypeMeta const&, unsigned long, float&&) in Caffe2.o
"caffe2::FLAGS_caffe2_keep_on_shrink", referenced from:
void caffe2::Tensorcaffe2::CPUContext::Resize<std::__1::vector<int, std::__1::allocator > >(std::__1::vector<int, std::__1::allocator >) in Caffe2.o
"caffe2::Predictor::Predictor(caffe2::NetDef const&, caffe2::NetDef const&, caffe2::Workspace*)", referenced from:
-[Caffe2 init:predict:error:] in Caffe2.o
-[Caffe2 reloadModel:predict:error:] in Caffe2.o
-[Caffe2 loadDownloadedModel:predict:error:] in Caffe2.o
"google::protobuf::internal::fixed_address_empty_string", referenced from:
google::protobuf::internal::GetEmptyStringAlreadyInited() in Caffe2.o
"google::protobuf::Message::ParseFromFileDescriptor(int)", referenced from:
ReadProtoIntoNet(std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator >, caffe2::NetDef*) in Caffe2.o
"caffe2::Predictor::run(std::__1::vector<caffe2::Tensorcaffe2::CPUContext, std::__1::allocator<caffe2::Tensorcaffe2::CPUContext> > const&, std::__1::vector<caffe2::Tensorcaffe2::CPUContext, std::__1::allocator<caffe2::Tensorcaffe2::CPUContext> >*)", referenced from:
-[Caffe2 predict:] in Caffe2.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Showing All Issues
"caffe2::Demangle(char const*)", referenced from:
char const* caffe2::TypeMeta::Name<float>() in Caffe2.o
"long caffe2::TypeMeta::Id()", referenced from:
std::__1::enable_if<std::is_fundamental<float>::value, caffe2::TypeMeta>::type caffe2::TypeMeta::Make<float>() in Caffe2.o
bool caffe2::TypeMeta::Match<float>() const in Caffe2.o
"caffe2::gTypeNames()", referenced from:
caffe2::TypeMeta::name() const in Caffe2.o
"caffe2::FLAGS_caffe2_print_blob_sizes_at_exit", referenced from:
caffe2::Workspace::~Workspace() in Caffe2.o
"caffe2::Workspace::PrintBlobSizes()", referenced from:
caffe2::Workspace::~Workspace() in Caffe2.o
"caffe2::ThreadPool::~ThreadPool()", referenced from:
caffe2::Workspace::~Workspace() in Caffe2.o
"caffe2::NetDef::NetDef()", referenced from:
-[Caffe2 .cxx_construct] in Caffe2.o
"caffe2::EnforceNotMet::EnforceNotMet(char const*, int, char const*, std::__1::basic_string<char, std::__1::char_traits, std::__1::allocator > const&, void const*)", referenced from:
ReadProtoIntoNet(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, caffe2::NetDef*) in Caffe2.o
float const* caffe2::Tensor<caffe2::CPUContext>::data<float>() const in Caffe2.o
void caffe2::Tensor<caffe2::CPUContext>::ShareExternalPointer<void caffe2::Tensor<caffe2::CPUContext>::ShareExternalPointer<float>(float*, unsigned long)::'lambda'(void*)>(void*, caffe2::TypeMeta const&, unsigned long, float&&) in Caffe2.o
"vtable for caffe2::EnforceNotMet", referenced from:
caffe2::EnforceNotMet::~EnforceNotMet() in Caffe2.o
NOTE: a missing vtable usually means the first non-inline virtual member function has no definition.
"caffe2::NetDef::~NetDef()", referenced from:
-[Caffe2 .cxx_destruct] in Caffe2.o
caffe2::Predictor::~Predictor() in Caffe2.o
"caffe2::FLAGS_caffe2_max_keep_on_shrink_memory", referenced from:
void caffe2::Tensor<caffe2::CPUContext>::Resize<std::__1::vector<int, std::__1::allocator<int> > >(std::__1::vector<int, std::__1::allocator<int> >) in Caffe2.o
"google::protobuf::ShutdownProtobufLibrary()", referenced from:
-[Caffe2 dealloc] in Caffe2.o
"typeinfo for caffe2::EnforceNotMet", referenced from:
ReadProtoIntoNet(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, caffe2::NetDef*) in Caffe2.o
float const* caffe2::Tensor<caffe2::CPUContext>::data<float>() const in Caffe2.o
void caffe2::Tensor<caffe2::CPUContext>::ShareExternalPointer<void caffe2::Tensor<caffe2::CPUContext>::ShareExternalPointer<float>(float*, unsigned long)::'lambda'(void*)>(void*, caffe2::TypeMeta const&, unsigned long, float&&) in Caffe2.o
"caffe2::FLAGS_caffe2_keep_on_shrink", referenced from:
void caffe2::Tensor<caffe2::CPUContext>::Resize<std::__1::vector<int, std::__1::allocator<int> > >(std::__1::vector<int, std::__1::allocator<int> >) in Caffe2.o
"caffe2::Predictor::Predictor(caffe2::NetDef const&, caffe2::NetDef const&, caffe2::Workspace*)", referenced from:
-[Caffe2 init:predict:error:] in Caffe2.o
-[Caffe2 reloadModel:predict:error:] in Caffe2.o
-[Caffe2 loadDownloadedModel:predict:error:] in Caffe2.o
"google::protobuf::internal::fixed_address_empty_string", referenced from:
google::protobuf::internal::GetEmptyStringAlreadyInited() in Caffe2.o
"google::protobuf::Message::ParseFromFileDescriptor(int)", referenced from:
ReadProtoIntoNet(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, caffe2::NetDef*) in Caffe2.o
"caffe2::Predictor::run(std::__1::vector<caffe2::Tensorcaffe2::CPUContext, std::__1::allocator<caffe2::Tensorcaffe2::CPUContext> > const&, std::__1::vector<caffe2::Tensorcaffe2::CPUContext, std::__1::allocator<caffe2::Tensorcaffe2::CPUContext> >*)", referenced from:
-[Caffe2 predict:] in Caffe2.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Hey @KleinYuan
Great job on breaking ground here with caffe2. Your example worked perfectly well for me. I was dissecting your code and comparing it with the android version on their site and was trying to understand why did you use opencv here? Was it to preprocess the image? And was it really required?
Also, will i need to make changes to the open cv code if I'm going to say drop style transfer models instead of squeezenet?
Thanks!
I know this issue has been encountered before, but the solutions provided there did not help me solve this problem. The error is occurring in the logging.h. file. I have a feeling the problem comes from when I ran setup.sh. I encountered numerous warnings and errors in Terminal when running setup.sh (This Imgur album has three images that show all of the errors and warnings. They are in chronological order from first image to third image.) For convenience, the three images are below as well.
Click on the third image to enlarge it.
@KleinYuan Please let me know if you find a solution to this error.
Mac OS Sierra version 10.12.6
Xcode Version 8.3.3
IOS Version 10.3.3
MacBook Air 2011
[Step1] Installing dependencies
./setup.sh: line 2: brew: command not found
[Step2] git cloning Caffe2
Cloning into 'caffe2'...
.....
[Step3] build ios
Caffe2 codebase root is: /Users/mba1/caffe2/caffe2-ios/src/caffe2
Build Caffe2 ios into: /Users/mba1/caffe2/caffe2-ios/src/caffe2/build_ios
Building protoc
Other flags passed to cmake: -DCMAKE_C_FLAGS=-fembed-bitcode -DCMAKE_CXX_FLAGS=-fembed-bitcode
-- The C compiler identification is AppleClang 8.1.0.8020042
-- The CXX compiler identification is AppleClang 8.1.0.8020042
-- Check for working C compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/cc
-- Check for working C compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Checking if C linker supports --verbose
-- Checking if C linker supports --verbose - no
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++
-- Check for working CXX compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Checking if CXX linker supports --verbose
-- Checking if CXX linker supports --verbose - no
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Looking for pthread.h
-- Looking for pthread.h - found
-- Looking for pthread_create
-- Looking for pthread_create - found
-- Found Threads: TRUE
-- Found ZLIB: /usr/lib/libz.dylib (found version "1.2.8")
-- Configuring done
-- Generating done
-- Build files have been written to: /Users/mba1/caffe2/caffe2-ios/src/caffe2/build_host_protoc/build
.....
-- 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 : ON
-- OpenCV version : 2.4.11
-- 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
WARNING: Target "libprotoc" has EXCLUDE_FROM_ALL set and will not be built by default but an install rule has been provided for it. CMake does not define behavior for this case.
WARNING: Target "protoc" has EXCLUDE_FROM_ALL set and will not be built by default but an install rule has been provided for it. CMake does not define behavior for this case.
-- Generating done
-- Build files have been written to: /Users/mba1/caffe2/caffe2-ios/src/caffe2/build_ios
......
ranlib libCaffe2_CPU.a
[100%] Built target Caffe2_CPU
/Users/mba1/anaconda/bin/cmake -E cmake_progress_start /Users/mba1/caffe2/caffe2-ios/src/caffe2/build_ios/CMakeFiles 0
[Tada!] Done
When I trying to build the target, I got many warning and errors like this:
ld: warning: ignoring file /Users/Church/Caffe2-iOS/src/caffe2-ios/caffe2-ios/opencv2.framework/opencv2, file was built for unsupported file format ( 0x76 0x65 0x72 0x73 0x69 0x6F 0x6E 0x20 0x68 0x74 0x74 0x70 0x73 0x3A 0x2F 0x2F ) which is not the architecture being linked (armv7): /Users/Church/Caffe2-iOS/src/caffe2-ios/caffe2-ios/opencv2.framework/opencv2
The opencv framework was ignored, it seems two kind of architectures were not matched, but I'm not sure what the real problem is, did I do something wrong?
Thanks for your help anyway.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.