Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

saliency is NaN for VGG16 like model with BatchNorm #19

Closed
sverneka opened this issue May 3, 2018 · 1 comment
Closed

saliency is NaN for VGG16 like model with BatchNorm #19

sverneka opened this issue May 3, 2018 · 1 comment

Comments

@sverneka
Copy link

sverneka commented May 3, 2018

saliency = saliency_fn([preprocessed_input, 0]) this gives me NaN for valid inputs. Below is my modified VGG16 network with BatchNorm.

def VGG16(input_shape=(224,224,3),classes=10):
input_img = Input(shape=input_shape)
# Block 1
x=Conv2D(64, (3, 3), activation='relu', padding='same', input_shape= input_shape, name='block1_conv1', kernel_initializer='glorot_normal')(input_img)
x=Conv2D(64, (3, 3), activation='relu', padding='same', name='block1_conv2', kernel_initializer='glorot_normal')(x)
x=MaxPooling2D((2, 2), strides=(2, 2), name='block1_pool')(x)
x=BatchNormalization()(x)
# Block 2
x=Conv2D(128, (3, 3), activation='relu', padding='same', name='block2_conv1', kernel_initializer='glorot_normal')(x)
x=Conv2D(128, (3, 3), activation='relu', padding='same', name='block2_conv2', kernel_initializer='glorot_normal')(x)
x=MaxPooling2D((2, 2), strides=(2, 2), name='block2_pool')(x)
x=BatchNormalization()(x)
# Block 3
x=Conv2D(256, (3, 3), activation='relu', padding='same', name='block3_conv1', kernel_initializer='glorot_normal')(x)
x=Conv2D(256, (3, 3), activation='relu', padding='same', name='block3_conv2', kernel_initializer='glorot_normal')(x)
x=Conv2D(256, (3, 3), activation='relu', padding='same', name='block3_conv3', kernel_initializer='glorot_normal')(x)
x=MaxPooling2D((2, 2), strides=(2, 2), name='block3_pool')(x)
x=BatchNormalization()(x)
# Block 4
x=Conv2D(512, (3, 3), activation='relu', padding='same', name='block4_conv1', kernel_initializer='glorot_normal')(x)
x=Conv2D(512, (3, 3), activation='relu', padding='same', name='block4_conv2', kernel_initializer='glorot_normal')(x)
x=Conv2D(512, (3, 3), activation='relu', padding='same', name='block4_conv3', kernel_initializer='glorot_normal')(x)
x=MaxPooling2D((2, 2), strides=(2, 2), name='block4_pool')(x)
x=BatchNormalization()(x)
# Block 5
x=Conv2D(512, (3, 3), activation='relu', padding='same', name='block5_conv1', kernel_initializer='glorot_normal')(x)
x=Conv2D(512, (3, 3), activation='relu', padding='same', name='block5_conv2', kernel_initializer='glorot_normal')(x)
x=Conv2D(512, (3, 3), activation='relu', padding='same', name='block5_conv3', kernel_initializer='glorot_normal')(x)
x=MaxPooling2D((2, 2), strides=(2, 2), name='block5_pool')(x)
# Classification block
x=Flatten(name='flatten')(x)
x=Dense(256, activation='relu', name='fc1', kernel_initializer='glorot_normal')(x)
#model.add(Dropout(0.5))
x=Dense(128, activation='relu', name='fc2', kernel_initializer='glorot_normal')(x)
#model.add(Dropout(0.5))
x=Dense(classes, activation='softmax', name='predictions', kernel_initializer='glorot_normal')(x)
model = Model(input_img, x)
model.summary()
#model = Model(inputs, x, name='vgg16')
return model

@sverneka sverneka changed the title saliency is NaN for VGG16 like model with dropout saliency is NaN for VGG16 like model with BatchNorm May 3, 2018
@sverneka
Copy link
Author

sverneka commented May 5, 2018

There was an issue with the model itself, probably some weights were NaN. The issue is now resolved.

@sverneka sverneka closed this as completed May 5, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant