title: Exotic keras / tesorflow model
body: <p>I am trying to develop deep model with following properties:</p>
  <ul>
  <li>Input - Matrix 1024x10</li>
  <li>Output - Regression of 1024 values (each value corresponds logically to row from input) in range [0.0, 1.0]</li>
  <li>model aims to determine if certain row belongs to target class (0.0 for no, 1.0 for yes). We can call the predicted values &quot;probabilities&quot;.</li>
  </ul>
  <p>Below I present test architecture prepared so far:</p>
  <pre><code>  from keras.models import Sequential
    from keras.layers import Conv2D, Conv1D
    from keras.layers import Dropout
    from tensorflow.keras.optimizers import Adam
  
    def define_model_2D_CNN():
       model = Sequential()
       model.add( Conv2D(64, (1,10), activation='relu', padding='valid', input_shape=(1024, 10, 1)))
       model.add( Conv2D(128, (3,1), activation='relu', padding='same', ))
       model.add( Conv2D(1, (3,1), activation='sigmoid', padding='same', ))
       opt = Adam(learning_rate=0.0005)
       model.compile(optimizer=opt, loss='binary_crossentropy', metrics=['accuracy'])
       return model
  </code></pre>
  <p>Below model summary:</p>
  <pre><code>Model: &quot;sequential_36&quot;
  Layer (type)                 Output Shape              Param #   
  conv2d_40 (Conv2D)           (None, 1024, 1, 64)       704       
  conv2d_41 (Conv2D)           (None, 1024, 1, 128)      24704     
  conv2d_42 (Conv2D)           (None, 1024, 1, 1)        385       
  Total params: 25,793
  Trainable params: 25,793
  Non-trainable params: 0
  </code></pre>
  <p>Difficulties of this model are following:</p>
  <ul>
  <li>convolution over different axis</li>
  <li>regression with very multiple values</li>
  <li>number of filters decreasing in the last layer (output layer)</li>
  <li>the output layer is conv2D rather than Dense</li>
  </ul>
  <p>Basically, the model compiles and trains, but the predicted vectors (on train data) are far away from expectations, namely those have almost constant values.</p>
  <p>Fully connected layer is not really an option in this model because the relative information between rows from matrix would be lost in such a way.</p>
  <p>I suspect that some problem occurs at the reduction of number of filters, but I am only guessing.
  Is there more optimal approach to this formulation of the problem?
  Or maybe some obvious error with the architecture?</p>
  <p>EDIT:
  After switching to &quot;binary_crossentropy&quot; loss it started to work.</p>