How to use the torchcam.saliency.saliency.SaliencyImage function in torchcam

To help you get started, we’ve selected a few torchcam examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github Tramac / pytorch-cam / torchcam / saliency / saliency.py View on Github external
def get_image_saliency_result(model, raw_image, input, label,
                              methods=['smooth_grad', 'gradcam', 'vanilla_grad', 'grad_x_input'],
                              layer_path=None):
    result = list()
    for method in methods:
        sal = get_saliency(model, raw_image, input, label, method=method, layer_path=layer_path)
        if sal is not None:
            result.append(SaliencyImage(raw_image, sal, method))

    return result

torchcam

Class activation maps for your PyTorch CNN models

Apache-2.0
Latest version published 1 year ago

Package Health Score

65 / 100
Full package analysis

Similar packages