10

I have two models trained with Tensorflow Python, exported to binary files named export1.meta and export2.meta. Both files will generate only one output when feeding with input, say output1 and output2.

My question is if it is possible to merge two graphs into one big graph so that it will generate output1 and output2 together in one execution.

Any comment will be helpful. Thanks in advance!

2
  • I think you should construct a new graph with multi heads instead so that you can co-train the two models. Commented Dec 28, 2016 at 23:39
  • 2
    import_meta_graph appends to current graph, so maybe call import_meta_graph twice and use import_scope to place graphs in separate namespaces Commented Dec 29, 2016 at 4:36

1 Answer 1

7

I kicked this around with my local TF expert, and the brief answer is "no"; TF doesn't have a built-in facility for this. However, you could write custom endpoint layers (input and output) with synch operations from Python's process management, so that they'd maintain parallel processing of each input, and concatenate the outputs.

Rationale

I like the way this could be used to get greater accuracy with multiple features, where the features have little or no correlation. For instance, you could train two character recognition models: one to identify the digit, the other to discriminate between left- and right-handed writers.

This would also allow you to examine the internal kernels that evolved for each individual feature, without interdependence with other features: the double-loop of an '8' vs the general slant of right-handed writing.

I also expect that the models for individual features will converge measurably faster than one over-arching training session.

Finally, it's quite possible that the individual models could be used in mix-and-match feature sets. For instance, train another model to differentiate letters, while letting your previously-trained left/right flagger would still have a pretty good guess at the writer's moiety.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.