xmartlabs / Bender

Easily craft fast Neural Networks on iOS! Use TensorFlow models. Metal under the hood.

Home Page:https://xmartlabs.github.io/Bender/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Assertion error with Mobilenet on iOS 10 device

haoxi911 opened this issue · comments

I am using latest master branch code and testing the new added Mobilenet sample code in our own project.

  • Environment:
    Xcode 9.2, iOS 11.2 SDK, iPhone 7 running iOS 10.3.3.

  • Assertion error:
    Number of network inputs xx and input sizes xx are not equal. Line 109, Network.swift.

We also tested in iOS 11 without meeting the assertion error, since this framework is supposed to be working on iOS 10+, I treat this issue as a defect.

Hi @haoxi911 . Sorry for the inconvenience. We have recently added a few layers that are only supported in iOS 11 (like the Depthwise which is used in MobileNet). We should add a warning in that example

We might try to implement that layer so that it works in iOS 10 but for now it doesn't.

Hi @mats-claassen I wanted to ask you some follow-up questions on this topic. I have been working with @haoxi911 on an iOS project that uses image recognition. We are using CoreML for iOS 11, but we also need to support iOS 10, and are still seeking an optimal solution. We have tried using TensorFlow, but the speed is a little slower than what we would like.

Can you clarify if there is a way to use this library for image recognition in iOS 10, or is this no longer supported? If this is no longer supported, do you know if this is something that will be worked on in the near future? This is a somewhat time sensitive issue for us, and we are willing to compensate for your time to get these changes if necessary.

Thanks!

Hey, it is not that image recognition does not work for iOS 10. The problem is that the Depthwise Conv layer (used in MobileNet) is not implemented for iOS 10, only for iOS 11. Other models for image recognition work on iOS 10, such as Inception or VGG.

For the Depthwise Conv with don't have an ETA currently, but it is on the roadmap. I'll get in touch with you in case you want to sponsor this or other feature.

@smoore6 I don't find your email on GitHub 😄 Please, write to the email that appears on my GitHub profile so we can discuss further.

@bryant1410 Thank you for the explanation! We are planning to use MobileNet, so we may need some help from you. I've sent an email to the address in your GitHub profile.

Hello @bryant1410

As for Depthwise CNN for iOS 10, @smoore6 actually tried another MPS+Mobilenet approach weeks ago and it did work with iOS 10+, the library comes with an implementation to Depthwise CNN which we may want to take a look, related swift code is at here.

The major reason that we'd like to switch to Bender is, Bender will provide an abstraction layer upon TensorFlow protocol buffer file, so that we can import and use frozen .pb file in iOS project directly. Regarding this topic, we only have success on using the unchanged mobilenet_frozen.pb file, we did have a re-trained mobilenet.pb which has an output layer named final_result, and we didn't find a way to use with Bender yet, this could be another topic that we may discuss.

Thanks!