Answer the question
In order to leave comments, you need to log in
What is the structure of this neural network?
I read an article on machine learning, I write the code as in the article.
The article describes an application that recognizes cats and dogs in images. I realized that the images are reduced to a size of 128X128, then a neural network is trained on a huge dataset and after that it can recognize cats and dogs in the images.
There is such a code describing the neural network model:
model = Sequential()
model.add(Conv2D(32, (3, 3), input_shape=(128, 128, 3), activation='relu'))
model.add(MaxPooling2D(pool_size=(2, 2)))
model.add(Conv2D(32, (3, 3), activation='relu'))
model.add(MaxPooling2D(pool_size=(2, 2)))
model.add(Flatten())
model.add(Dense(units=128, activation='relu'))
model.add(Dense(units=1, activation='sigmoid'))
model.compile(optimizer=Adam(),
loss='binary_crossentropy',
metrics=['accuracy'])
Answer the question
In order to leave comments, you need to log in
Conv2D is a convolutional layer that runs through a stack of convolutions over the entire image, calculating a new value at each of its points. MaxPooling2D splits the entire image into a grid with a 2x2 pixel cell and selects the maximum value from each cell (the lightest pixel), their totality becomes a new image 2 times smaller in size. Flatten simply "flattens" a multi-dimensional tensor into a one-dimensional vector. Dense is a classic (as in all the pictures) fully connected layer of neurons, where each of the neurons is connected to all the neurons of the previous layer.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question