Outils pour utilisateurs

Outils du site


keras_input_explanation

Différences

Ci-dessous, les différences entre deux révisions de la page.

Lien vers cette vue comparative

Les deux révisions précédentesRévision précédente
Prochaine révision
Révision précédente
keras_input_explanation [2020/10/03 12:00] – [Defining your image in Keras] sergekeras_input_explanation [2020/12/27 15:14] (Version actuelle) serge
Ligne 1: Ligne 1:
 ====== Keras input explanation: input_shape, units, batch_size, dim, etc ====== ====== Keras input explanation: input_shape, units, batch_size, dim, etc ======
 +<WRAP center round box 60% centeralign>
 +**{{tagpage>ia|Intelligence Artificielle}}**     **[[http://translate.google.com/translate?hl=&sl=auto&tl=en&u=https%3A%2F%2Fressources.labomedia.org%2Fkeras_input_explanation|English Version]]**
 +</WRAP>
 +<WRAP center round box 60% centeralign>
 +**[[les_pages_intelligence_artificielle_en_details|Les Pages Intelligence Artificielle en détails]]**
 +</WRAP>
 +
 Mise en forme d'un post de **stackoverflow.com** non traduit en français, car très technique ce qui ne se comprend qu'en anglais. Mise en forme d'un post de **stackoverflow.com** non traduit en français, car très technique ce qui ne se comprend qu'en anglais.
  
 **[[https://stackoverflow.com/questions/44747343/keras-input-explanation-input-shape-units-batch-size-dim-etc|Keras input explanation: input_shape, units, batch_size, dim, etc]]** **[[https://stackoverflow.com/questions/44747343/keras-input-explanation-input-shape-units-batch-size-dim-etc|Keras input explanation: input_shape, units, batch_size, dim, etc]]**
 +
 +=====Ressources=====
 +  * [[https://keras.io/guides/working_with_rnns/|Working with RNNs]]
 +  * [[https://keras.io/api/layers/|Keras layers API]]
 +  * [[https://keras.io/examples/|Code examples]]
  
 =====Question===== =====Question=====
Ligne 28: Ligne 40:
 ====The input shape==== ====The input shape====
 What flows between layers are tensors. Tensors can be seen as matrices, with shapes. \\ What flows between layers are tensors. Tensors can be seen as matrices, with shapes. \\
-In Keras, the input layer itself is not a layer, but a tensor. It's the starting tensor you send to the first hidden layer. This tensor must have the same shape as your training data. \\ +In Keras, the input layer itself is not a layer, but a tensor. It's the starting tensor you send to the first hidden layer. **This tensor must have the same shape as your training data**. \\ 
-Example: if you have 30 images of 50x50 pixels in RGB (3 channels), the shape of your input data is (30,50,50,3). Then your input layer tensor, must have this shape (see details in the "shapes in keras" section). \\+Example: if you have 30 images of 50x50 pixels in RGB (3 channels), the shape of your input data is (30,50,50,3). Then your input layer tensor, must have this shape (see [[keras_input_explanation#shapes_in_keras| Shapes in Keras]]). \\
 Each type of layer requires the input with a certain number of dimensions: Each type of layer requires the input with a certain number of dimensions:
   * Dense layers require inputs as (batch_size, input_size)    * Dense layers require inputs as (batch_size, input_size) 
Ligne 37: Ligne 49:
     *if using channels_first: (batch_size, channels, imageside1, imageside2)      *if using channels_first: (batch_size, channels, imageside1, imageside2) 
   * 1D convolutions and recurrent layers use (batch_size, sequence_length, features)    * 1D convolutions and recurrent layers use (batch_size, sequence_length, features) 
-    *Details on how to prepare data for recurrent layers +    *Details on [[https://stackoverflow.com/questions/38714959/understanding-keras-lstms/50235563#50235563|how to prepare data for recurrent layers ]] 
 Now, the input shape is the only one you must define, because your model cannot know it. Only you know that, based on your training data. \\ Now, the input shape is the only one you must define, because your model cannot know it. Only you know that, based on your training data. \\
 All the other shapes are calculated automatically based on the units and particularities of each layer.  All the other shapes are calculated automatically based on the units and particularities of each layer. 
Ligne 149: Ligne 162:
 It (the word dimension alone) can refer to: It (the word dimension alone) can refer to:
   - **The dimension of Input Data (or stream)** such as # N of sensor axes to beam the time series signal, or RGB color channel (3): suggested word=> "InputStream Dimension"   - **The dimension of Input Data (or stream)** such as # N of sensor axes to beam the time series signal, or RGB color channel (3): suggested word=> "InputStream Dimension"
-  - **The total number /length of Input Features** (or Input layer) (28 x 28 = 784 for the MINST color image) or 3000 in the FFT transformed Spectrum Values, or +  - **The total number /length of Input Features** (or Input layer) (28 x 28 = 784 for the MINST color image) or 3000 in the FFT transformed Spectrum Values, or "Input Layer / Input Feature Dimension"
-"Input Layer / Input Feature Dimension"+
   - **The dimensionality** (# of dimension) of the input (typically 3D as expected in Keras LSTM) or (#RowofSamples, #of Senors, #of Values..) 3 is the answer.   - **The dimensionality** (# of dimension) of the input (typically 3D as expected in Keras LSTM) or (#RowofSamples, #of Senors, #of Values..) 3 is the answer.
-"N Dimensionality of Input" +  - "N Dimensionality of Input" **The SPECIFIC Input Shape** (eg. (30,50,50,3) in this unwrapped input image data, or (30, 250, 3) if unwrapped Keras: 
-  - **The SPECIFIC Input Shape** (eg. (30,50,50,3) in this unwrapped input image data, or (30, 250, 3) if unwrapped Keras: +
-  +
 Keras has its input_dim refers to the Dimension of Input Layer / Number of Input Feature Keras has its input_dim refers to the Dimension of Input Layer / Number of Input Feature
 +
 <code python> <code python>
 model = Sequential() model = Sequential()
Ligne 169: Ligne 181:
  
  
-{{tag>sb ia}}+{{tag>sb ia keras}}
keras_input_explanation.1601726430.txt.gz · Dernière modification : 2020/10/03 12:00 de serge