serizba / cppflow

Run TensorFlow models in C++ without installation and without Bazel
https://serizba.github.io/cppflow/
MIT License
787 stars 178 forks source link

Documentation - HELP #55

Closed JosipNizetic closed 3 years ago

JosipNizetic commented 4 years ago

Hello,

I am sorry for bothering you but is there some more help documentation that you would suggest to use your code with following model. 033_Hand_Detection_and_Tracking

and especially palm detection model that can be find here.. saved_model_palm_detection_builtin

I would like to implement TF .pb version and see speed difference in regards to already imeplented tflite.

Thank you very much, Josip

serizba commented 4 years ago

Hi,

I would like to add a bit of documentation, but right now is in an early state.

You should be able to load the .pb model with the new changes of Cppflow2, you can take a look to the example on how to load a pb model and run it in the examples folder.

JosipNizetic commented 4 years ago

Ok thank you.

Tried that but had a bit trouble. Will try to dig deeper.

Best regards, Josip

serizba commented 4 years ago

What did you tried and what are you trying to implement?

ljn917 commented 4 years ago

Josip's models have multiple output tensors, which is not supported by v2 yet.

On Mon, Oct 12, 2020, 1:40 PM Sergio Izquierdo notifications@github.com wrote:

What did you tried and what are you trying to implement?

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/serizba/cppflow/issues/55#issuecomment-707256777, or unsubscribe https://github.com/notifications/unsubscribe-auth/AALDTHQRNRFQUZG6GUU5OBDSKM5PZANCNFSM4SMJ375Q .

JosipNizetic commented 4 years ago

Thank you very much for clarification.

Josip

ljn917 commented 4 years ago

@JosipNizetic One temporary workaround for this is using the v1 version in master branch and PR #27. However, the long term goal is to have SavedModel support in v2.

serizba commented 4 years ago

Hi @JosipNizetic,

I've created a function in model to work with multiple input/outpus, you can check an example on how it works on the multi_input_output example.

You can now call your model with a list of tuples ("input_name", input_tensor) and a list of the names of the outputs. You can inspect the names of the model with the CLI tool provided by tensorflow: saved_model_cli show --dir path/to/model --all

Then you can call your cppflow model like:

model({{"serving_default_input_1:0", input_1}, {"serving_default_input_2:0", input_2}}, {"StatefulPartitionedCall:0", "StatefulPartitionedCall:1"});

Note that you can specify the index of the operations after the colon :, as it is shown by saved_model_cli.

Hope it helps!

ljn917 commented 4 years ago

@serizba Maybe using std::unordered_map as both inputs and outputs is easier to work with, instead of a vector of tuple, although there is greater overhead of constructing a hash table.

JosipNizetic commented 4 years ago

Thank you very much. Been out few days. Will try by tomorrow and get back..

Thank you once more..

serizba commented 3 years ago

Hi @JosipNizetic,

Did you manage to make it work?

JosipNizetic commented 3 years ago

Sorry for this vey long Delay. I thought i answered it. Yes everything is working fine..

Thank you very much.