Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

def identity_block(X, f, filters, training=True, initializer=random_uniform):

def convolutional_block(X, f, filters, s = 2, training=True, initializer=glorot_uniform):
    
    # Retrieve Filters
    F1, F2, F3 = filters
    
    # Save the input value
    X_shortcut = X


    ##### MAIN PATH #####
    
    # First component of main path glorot_uniform(seed=0)
    X = Conv2D(filters = F1, kernel_size = 1, strides = (s, s), padding='valid', kernel_initializer = initializer(seed=0))(X)
    X = BatchNormalization(axis = 3)(X, training=training)
    X = Activation('relu')(X)

    ### START CODE HERE
    
    ## Second component of main path (≈3 lines)
    X = Conv2D(filters = F2, kernel_size = f, strides = (1, 1), padding='same', kernel_initializer = initializer(seed=0))(X) 
    X = BatchNormalization(axis = 3)(X, training=training)
    X = Activation('relu')(X)

    ## Third component of main path (≈2 lines)
    X = Conv2D(filters = F3, kernel_size = 1, strides = (1, 1), padding='valid', kernel_initializer = initializer(seed=0))(X)
    X = BatchNormalization(axis = 3)(X, training=training)
    
    ##### SHORTCUT PATH ##### (≈2 lines)
    X_shortcut = Conv2D(filters = F3, kernel_size = 1, strides = (s, s), padding='valid', kernel_initializer = initializer(seed=0))(X_shortcut)
    X_shortcut = BatchNormalization(axis = 3)(X_shortcut, training=training)
    
    ### END CODE HERE

    # Final step: Add shortcut value to main path (Use this order [X, X_shortcut]), and pass it through a RELU activation
    X = Add()([X, X_shortcut])
    X = Activation('relu')(X)
    
    return X
Comment

PREVIOUS NEXT
Code Example
Python :: how to send variable to python using xlwings 
Python :: cant access a dataframe imported using pickle 
Python :: [Solved] Pandas TypeError: no numeric data to plot 
Python :: fast guess for divisible numbers between two numbers 
Python :: how to use rbind() to combine dataframes 
Python :: os.system ignore output 
Python :: python urlopen parameters 
Python :: convert .tiff image stack to unit8 format 
Python :: Python Key Gen 
Python :: delete row by index pandas 
Python :: python quick sort 
Python :: can only concatenate str (not "ImageFieldFile") to str 
Python :: run all jupyter notebooks in project folder 
Python :: multi hot encode pandas column 
Python :: Matplotlib giving error "OverflowError: In draw_path: Exceeded cell block limit" 
Python :: python regex replace point with underscore 
Python :: how to remove no data times plotly 
Python :: Sorted iteration 
Python :: __pycache__ 
Python :: python discover methods of object/module 
Python :: Reason: "broken data stream when reading image file" in jupyter notebook 
Python :: pd assign index from different df 
Python :: Hewwo wowwd 
Python :: pandas 3d set camara cords 
Python :: python attributes from string 
Python :: python boolean ungleich 
Python :: python heroku 
Python :: print next line 
Python :: re.split 
Python :: login view django 
ADD CONTENT
Topic
Content
Source link
Name
1+4 =