Beispiel #1
0
def test_heatmap_shape():
    gcam = GradCAM(paths[1], (224, 224),
                   model,
                   last_convolution_layer="conv2d_73")
    assert gcam.heatmap.shape == (14, 14)
Beispiel #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]
Beispiel #3
0
def test_heatmap_type():
    gcam = GradCAM(paths[1], (224, 224),
                   model,
                   last_convolution_layer="conv2d_73")
    assert type(gcam.heatmap) == np.ndarray
Beispiel #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
Beispiel #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
Beispiel #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
Beispiel #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)
Beispiel #8
0
def test_img_type():
    gcam = GradCAM(paths[0], (224, 224),
                   model,
                   last_convolution_layer="conv2d_73")
    assert type(gcam.img) == np.ndarray