robertbiehl / caffe2-ios Goto Github PK
View Code? Open in Web Editor NEW☕️ Caffe2Kit. A simple one step integration of Caffe2 for iOS.
License: Apache License 2.0
☕️ Caffe2Kit. A simple one step integration of Caffe2 for iOS.
License: Apache License 2.0
ℹ Please fill out this template when filing an issue.
All lines beginning with an ℹ symbol instruct you with
what info we expect.
Please remove this line and all above before submitting.
ℹ Please replace this with what you did.
ℹ Please replace this with what you expected to happen.
ℹ Please replace this with of what happened instead.
ℹ Please link to a project we can download that reproduces the issue.
You can delete this section if your issue is unrelated to build problems,
From the profiling tool of xcode ,i found that no nnpack function has been used. And the eigen function has been used. So how can i change the compute mode from eigen to nnpack?
Hi RobertBiehl,
I want to use other models instead of squeeze_net,I clone(git clone) the models from https://github.com/caffe2/models.I use bvlc_googlenet model,and the image is 224*224.But it is Incorrect.
My code below:
do{
// caffe = try Caffe2(initNetNamed: "squeeze_init_net", predictNetNamed:"squeeze_predict_net")
caffe = try Caffe2(initNetNamed: "exec_net", predictNetNamed:"predict_net")
}catch {
...
and my result:
Results:
Lorem ipsum dolor sit er elit lamet, consectetaur cillium adipisicing pecu, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum. Nam liber te conscient to factor tum poen legum odioque civiuda.
I've tried to install pod as described in repository readme (just adding one string to Podfile), but project fails to get built:
In build settings i see Header Search Paths:
"$(PODS_TARGET_SRCROOT)/lib/caffe2/install/include/"
"$(PODS_TARGET_SRCROOT)/lib/caffe2/third_party/eigen/"
which is resolved by Xcode8.3.1 as /lib/caffe2/install/include
and /lib/caffe2/third_party/eigen
, which I obviously don't have.
Neither project hierarchy Pods/Caffe2Kit/lib/caffe2
do have such subfolders:
Are not these .h files supposed to be copied together with .a files?
Or I've missed something?
I tried to update my build phases with: libstc++.tdb
I expected to find that item in the prompt to add a build phase.
I could not find that item. I think you meant libstdc++.tdb
Maybe update the README?
Added Podfile:
` Uncomment the next line to define a global platform for your project
platform :ios, '10.3'
target 'meh' do
/# Comment the next line if you're not using Swift and don't want to use dynamic frameworks
use_frameworks!
/# Pods for meh
pod 'Caffe2Kit', :git => 'git://github.com/RobertBiehl/caffe2-ios'
post_install do |installer|
installer.pods_project.targets.each do |target|
target.build_configurations.each do |config|
config.build_settings['ENABLE_BITCODE'] = 'NO'
end
end
end
target 'mehTests' do
inherit! :search_paths
/# Pods for testing
end
target 'mehUITests' do
inherit! :search_paths
/# Pods for testing
end
end
`
installed pod.
changed bitcode to no
added libstdc++
added other linker flags of:
-force_load
"$(PODS_ROOT)/Caffe2Kit/install/lib/libCaffe2_CPU.a"
My view controller is same as yours:
`
class ViewController: UIViewController {
@IBOutlet var textView : UITextView!
@IBOutlet var imageView : UIImageView!
var caffe : Caffe2?
override func viewDidLoad() {
super.viewDidLoad()
do{
try self.caffe = Caffe2(initNetNamed: "squeeze_init_net", predictNetNamed:"squeeze_predict_net")
}
catch{
}
let 🌅 = #imageLiteral(resourceName: "lion.png")
if let res = caffe?.prediction(regarding: 🌅) {
// find top 5 classes
let sorted = res
.map{$0.floatValue}
.enumerated()
.sorted(by: {$0.element > $1.element})[0...5]
// generate output
let text = sorted
.map{"\($0.offset): \(classes[$0.offset]) \($0.element*100)%"}
.joined(separator: "\n")
print("Result\n\(text)")
textView.text = text
imageView.image = 🌅
}
}
override func viewWillAppear(_ animated: Bool) {
super.viewWillAppear(animated)
}
override func viewDidDisappear(_ animated: Bool) {
super.viewDidDisappear(animated)
}
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
// Dispose of any resources that can be recreated.
}
let classes = [ has all classes trust me :D ]
}
`
I copied all the sources like lion.png etc from your git.
The project should run. Giving me the output just like in tutorial
Instead I ended up with
[libprotobuf ERROR /Users/Robert/Documents/Workspace/caffe2-swift/lib/caffe2/third_party/protobuf/src/google/protobuf/descriptor_database.cc:57] File already exists in database: caffe/proto/caffe.proto [libprotobuf FATAL /Users/Robert/Documents/Workspace/caffe2-swift/lib/caffe2/third_party/protobuf/src/google/protobuf/descriptor.cc:1272] CHECK failed: generated_database_->Add(encoded_file_descriptor, size): libc++abi.dylib: terminating with uncaught exception of type google::protobuf::FatalException: CHECK failed: generated_database_->Add(encoded_file_descriptor, size):
libsystem_kernel.dylib
__pthread_kill:
0x185709330 <+0>: mov x16, #0x148
0x185709334 <+4>: svc #0x80
-> 0x185709338 <+8>: b.lo 0x185709350 ; <+32>
0x18570933c <+12>: stp x29, x30, [sp, #-0x10]!
0x185709340 <+16>: mov x29, sp
0x185709344 <+20>: bl 0x1856ea098 ; cerror_nocancel
0x185709348 <+24>: mov sp, x29
0x18570934c <+28>: ldp x29, x30, [sp], #0x10
0x185709350 <+32>: ret
`
It happens before the UI even loads.
I have used both simulator and device along with xcode 8 and 9. Although I do realize it is not a problem related to that but still for sanity purposes did that.
ℹ Please link to a project we can download that reproduces the issue.
https://github.com/Quisher/caffe2-ios-exp
I'm a bit new to this, but I'm confused on how to actually import the pod into my project. CocoaPods is installed, but how do I create a podfile and where do I create it?
When build the project always has a issue: Linker command failed with exit code 1. I really do not know how to figure out it. Thanks a lot!!!
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.