Example #1
0
def test_heatmap_shape():
    gcam = GradCAM(paths[1], (224, 224),
                   model,
                   last_convolution_layer="conv2d_73")
    assert gcam.heatmap.shape == (14, 14)
Example #2
0
def test_pred_output_shape():
    gcam = GradCAM(paths[0], (224, 224),
                   model,
                   last_convolution_layer="conv2d_73")
    assert gcam.pred_model(gcam.conv_model(gcam.img)).shape == [1, 1]
Example #3
0
def test_heatmap_type():
    gcam = GradCAM(paths[1], (224, 224),
                   model,
                   last_convolution_layer="conv2d_73")
    assert type(gcam.heatmap) == np.ndarray
Example #4
0
def test_pred_model_output_type():
    gcam = GradCAM(paths[0], (224, 224),
                   model,
                   last_convolution_layer="conv2d_73")
    assert type(gcam.pred_model(gcam.conv_model(
        gcam.img))) == tf.python.framework.ops.EagerTensor
Example #5
0
def test_pred_model_type():
    gcam = GradCAM(paths[0], (224, 224),
                   model,
                   last_convolution_layer="conv2d_73")
    assert type(
        gcam.conv_model) == tf.python.keras.engine.functional.Functional
Example #6
0
def test_image_size():
    gcam = GradCAM(paths[0], (224, 224),
                   model,
                   last_convolution_layer="conv2d_73")
    assert gcam.img.shape[1] == 224
    assert gcam.img.shape[2] == 224
Example #7
0
def test_image_shape():
    gcam = GradCAM(paths[0], (224, 224),
                   model,
                   last_convolution_layer="conv2d_73")
    assert gcam.img.shape == (1, 224, 224, 3)
Example #8
0
def test_img_type():
    gcam = GradCAM(paths[0], (224, 224),
                   model,
                   last_convolution_layer="conv2d_73")
    assert type(gcam.img) == np.ndarray