Answers.Body: <p>Keras Functional APIs can help you define complex models.</p>
  
  <p>You can find the documentation here :
  <a href="https://keras.io/getting-started/functional-api-guide/" rel="nofollow noreferrer">https://keras.io/getting-started/functional-api-guide/</a>.</p>
  
  <p>For example:</p>
  
  <pre><code># prev_layer is the layer you want to be forked
  fork1 = Dense(32, activation='relu')(prev_layer)
  fork2 = Dense(32, activation='relu')(prev_layer)
  
  # you do some operations on fork1 to get output1
  # and on fork2 to get output2
  
  model = Model(inputs=input_layer, outputs=[output1, output2])
  </code></pre>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-04-10T19:21:09.883Z
Answers.LastActivityDate: 2019-04-11T05:17:19.863Z
Answers.LastEditDate: 2019-04-11T05:17:19.863Z
Answers.UserDisplayName: Sooryakiran Pallikulathil
Body: <p>I want to make a network, specifically a CNN for image recognition, that takes an input, processes it the same way for several layers, and then at some point splits before coming to two different outputs. Is it possible to create a network such as this? It would look something like this:</p>
  
  <p>Input -> Conv -> Pool -> Conv -> Pool ---------> Dense -> Output 1 </p>
  
  <pre><code>                                  ||
  
                                       ----&gt; Dense -&gt; Output 2
  </code></pre>
  
  <p>I.E. it splits off after the second pooling layer into separate fully connected layers. Of course, it has to train to both outputs, so that it is producing minimal error on both separate outputs using these common convolutional layers. Also, I am using Python Keras, and it would help if there was some way to do this using Keras in some way. Thank you!  </p>
  
Tags: <neural-networks><machine-learning><convolutional-neural-networks><image-recognition>
Title: Is it possible to make a 'forked path' neural network?
UserDisplayName: Fred E
ThreadText: # Is it possible to make a 'forked path' neural network?
  
  (Asked by: username_0 on 2019-04-10)
  
  I want to make a network, specifically a CNN for image recognition, that takes an input, processes it the same way for several layers, and then at some point splits before coming to two different outputs. Is it possible to create a network such as this? It would look something like this:
  
  Input -> Conv -> Pool -> Conv -> Pool ---------> Dense -> Output 1
  
  ```
                                    ||
  
                                       ----> Dense -> Output 2
  
  ```
  
  I.E. it splits off after the second pooling layer into separate fully connected layers. Of course, it has to train to both outputs, so that it is producing minimal error on both separate outputs using these common convolutional layers. Also, I am using Python Keras, and it would help if there was some way to do this using Keras in some way. Thank you!
  
  **Tags:** neural-networks, machine-learning, convolutional-neural-networks, image-recognition
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2019-04-10. Score: 5 | Accepted answer
  
  Keras Functional APIs can help you define complex models.
  
  You can find the documentation here :
  <https://keras.io/getting-started/functional-api-guide/>.
  
  For example:
  
  ```
  # prev_layer is the layer you want to be forked
  fork1 = Dense(32, activation='relu')(prev_layer)
  fork2 = Dense(32, activation='relu')(prev_layer)
  
  # you do some operations on fork1 to get output1
  # and on fork2 to get output2
  
  model = Model(inputs=input_layer, outputs=[output1, output2])
  
  ```
  
  
  ---
  
  