Coder Social home page Coder Social logo

Comments (8)

MatthewARM avatar MatthewARM commented on August 21, 2024

Hi @solderzzc the current tensorflow parser cannot guarantee the correct operation of control inputs (which is tensorflow's way of guaranteeing a particular order of execution).

You can try removing the code block at TfParser.cpp:489 to get past this parse error, but if the control inputs are guaranteeing execution of some variable assignment or something, you will probably just hit another parse error. The full list of supported TensorFlow ops is at: src/armnnTfParser/TensorFlowSupport.md

It seems to me that maybe it's not a frozen inference-only model? If you try following the steps at https://www.tensorflow.org/mobile/prepare_models it will remove all training-only nodes and you will have a much smaller, cleaner graph that is more likely to work with ArmNN.

All the best,
Matthew

from armnn.

solderzzc avatar solderzzc commented on August 21, 2024

Hi @MatthewARM

Thank for your reply. I removed the code block at TfParser.cpp to bypass parser error. The model has phase_train (ref: davidsandberg/facenet#357 (comment)) to control graph inference flow, so it might has issue during runtime.

I also called optimize_for_inference API of tensorflow to have training-only nodes removed(same behavior as mentioned in https://www.tensorflow.org/mobile/prepare_models), then hit another error log:

terminate called after throwing an instance of 'armnn::ParseException'
  what():  Currently only FLOAT is supported for tensorflow nodes (apart from Const)
Aborted

I think this is because that FLOAT variables were converted to CONST during Freeze Graph phase.

Reference:
https://github.com/davidsandberg/facenet/blob/master/src/freeze_graph.py#L88

graph_util.convert_variables_to_constants(
        sess, input_graph_def, output_node_names.split(","),
        variable_names_whitelist=whitelist_names)

Thanks
Simba

from armnn.

MatthewARM avatar MatthewARM commented on August 21, 2024

Hi @solderzzc "Currently only FLOAT is supported for tensorflow nodes (apart from Const)" indicates that there is an integer operation in your network, do you know if that is the case? Currently we only support float operations.

If you can find out which operation, and what data type, it would help us prioritise the support work internally. Or we can find a workaround.

All the best,
Matthew

from armnn.

solderzzc avatar solderzzc commented on August 21, 2024

Hi, @MatthewARM
I just go through the network design of facenet, the non float ops should come from dropout layer of tensorflow.slim.

Network define with dropout

screen shot 2018-06-08 at 10 41 19 am

Slim dropout API

screen shot 2018-06-08 at 10 36 03 am

Best Regards
Simba

from armnn.

MatthewARM avatar MatthewARM commented on August 21, 2024

Hi @solderzzc, dropout should definitely get removed by the 'strip unused nodes' transform. Maybe you could try the mobile inference preparation steps again?

from armnn.

solderzzc avatar solderzzc commented on August 21, 2024

Hi @MatthewARM, I loaded the graph into tensorboard, the 'Dropout' layer is not included in the freezed graph. The issue should be introduced by DT_BOOL phase_train.
screen shot 2018-06-11 at 12 01 37 pm
screen shot 2018-06-11 at 12 02 25 pm
screen shot 2018-06-11 at 12 02 55 pm

Added more information in TfPhaser.cpp line 1951:

type: 10 op: Placeholder name: phase_train

After replace phase_train into bool constant:

terminate called after throwing an instance of 'armnn::ParseException'
  what():  Unknown DataType DT_BOOL for node
Aborted

After convert phase_train into FLOAT32(Just for bypass this exception):

terminate called after throwing an instance of 'armnn::ParseException'
  what():  Unsupported operation Switch in tensorflow::GraphDef
Aborted

Thanks
Simba

from armnn.

MatthewARM avatar MatthewARM commented on August 21, 2024

Thanks for the detailed analysis, @solderzzc.

We can try to get a proper fix done in a future release, but I think you can work around the issue by removing all connections to 'phase_train' from your graph. In the ArmNN TensorFlow parser we will always assume that 'phase_train' is FALSE.

from armnn.

solderzzc avatar solderzzc commented on August 21, 2024

@MatthewARM I will try it and look forward for the next release.

Thanks

from armnn.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.