Computer Vision News - January 2023
7 Feature Extraction Layers in ConvNets .prefetch(buffer_size=AUTOTUNE) ) Found 5117 files belonging to 2 classes. Found 5051 files belonging to 2 classes. Step 2 - Define Model Here is a diagram of the model we'll use: Nowwe'll define themodel. Seehowourmodel consistsof threeblocksof Conv2D and MaxPool2D layers (the base) followed by a head of Dense layers. We can translate this diagram more or less directly into a Keras Sequential model just by filling in the appropriate parameters. import tensorflow.keras as keras import tensorflow.keras.layers as layers model = keras.Sequential([ # First Convolutional Block layers.Conv2D(filters=32, kernel_size=5, activation="relu", padding='same', # give the input dimensions in the first layer # [height, width, color channels(RGB)] input_shape=[128, 128, 3]), layers.MaxPool2D(), # Second Convolutional Block layers.Conv2D(filters=64, kernel_size=3, activation="relu", padding='same'), layers.MaxPool2D(), # Third Convolutional Block layers.Conv2D(filters=128, kernel_size=3, activation="relu", padding='same'), layers.MaxPool2D(), # Classifier Head layers.Flatten(), layers.Dense(units=6, activation="relu"), layers.Dense(units=1, activation="sigmoid"), ]) model.summary() Model: "sequential"
Made with FlippingBook
RkJQdWJsaXNoZXIy NTc3NzU=