Closed iwst121 closed 7 years ago
Hi @iwst121,
yes you can definitely use other models, we successfully converted some from old caffe to the new caffe2 format. The lore ipsum text is only a placeholder in the storyboard of the demo app. If you see that, it means the predict (inference) step has not been executed or the results are not being displayed.
Do you get an error in catch {
?
Hello @RobertBiehl ,
Yes,I get an error in catch{: "Error Domain=Caffe2 Code=1 "File named "predict_net" not found in main bundle" UserInfo={NSLocalizedDescription=File named "predict_net" not found in main bundle}
But, there are two files named exec_net.pb and predict_net.pb under Caffe2Test folder.Is it because the file of format is not right?
That should be an easy fix: Make sure the files are in your Xcode project and you selected "Add to Target" for both files.
Hi @RobertBiehl ,
I selected "Add to Target" for both files.It is OK when I use squeeze_init_net.But it is wrong when I use bvlc_googlenet model.I catch the exception below.It looks like the RGB and BGR reason.But I can get the code in function "- (nullable NSArray<NSNumber>) predict:(nonnull UIImage*) image{". Thanks.
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"
@iwst121 resize the input image to the size of 224*224, then try again.
@raininglixinyu actually,the image is size of 224*224
The models format is not suitable.It must be transfered.
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.