Skip to content

Commit

Permalink
Tested gradcam demo
Browse files Browse the repository at this point in the history
  • Loading branch information
oarriaga committed Jul 14, 2017
1 parent 4d1681e commit df19dd7
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions src/image_gradcam_demo.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,13 @@

# parameters
image_path = sys.argv[1]
task = sys.argv[2]

# task = sys.argv[2]
task = 'emotion'
if task == 'emotion':
labels = get_labels('fer2013')
offsets = (0, 0)
model_filename = '../trained_models/fer2013_big_XCEPTION.54-0.66.hdf5'
# model_filename = '../trained_models/fer2013_big_XCEPTION.54-0.66.hdf5'
model_filename = '../trained_models/emotion_models/fer2013_mini_XCEPTION.102-0.66.hdf5'
elif task == 'gender':
labels = get_labels('imdb')
offsets = (30, 60)
Expand Down Expand Up @@ -69,10 +70,10 @@
label_text = labels[predicted_class]

gradient_function = compile_gradient_function(model,
predicted_class, 'conv2d_5')
predicted_class, 'conv2d_7')
register_gradient()
guided_model = modify_backprop(model, 'GuidedBackProp', task)
saliency_function = compile_saliency_function(guided_model, 'conv2d_5')
saliency_function = compile_saliency_function(guided_model, 'conv2d_7')

guided_gradCAM = calculate_guided_gradient_CAM(gray_face,
gradient_function, saliency_function)
Expand Down

0 comments on commit df19dd7

Please sign in to comment.