简体   繁体   中英

How to merge two sub-networks into a model in tensorflow

I need to design a deep network with two sub networks.

1- The first network: (sub_net_1)
input_1 size: 128x128x1
output_1 size: 512x512x1

from elsewhere:
input_2 size: 512x512x4


concatenate(output_1, input_2)

2- The second network: (sub_net_2)
input_3 size: 512x512x5

I need to concatenate the output_1 with input_2 of the same size and feed it to the network

I know the simple way of defining a model in tensorflow is Model(inputs=input, outputs=x) How can I define the model for my problem where I have two inputs of different sizes and need to train both sub-networks together?

here is the architecture of the network: https://imgur.com/OQFhlPW

Maybe you could use the concatenate() function and pass the result as an input to subnet_2:

concat = concatenate([output_1, input_2])
input_3()(concat)

See here for an example: https://www.depends-on-the-definition.com/lstm-with-char-embeddings-for-ner/

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM