Ecto-Trigger 1.0
Loading...
Searching...
No Matches
SaliencyMapGenerator Class Reference

Public Member Functions

 __init__ (self, weights_file)
 
 generate_saliency_map (self, input_image_path, output_path)
 

Public Attributes

 weights_file = weights_file
 
 model = self._load_model()
 
 input_shape = self.model.input_shape[1:]
 

Protected Member Functions

 _load_model (self)
 

Static Protected Member Functions

 _preprocess_image (image_path, input_shape)
 

Detailed Description

A class to generate a saliency map for an input image using a trained model.

Constructor & Destructor Documentation

◆ __init__()

__init__ ( self,
weights_file )
Initialize the SaliencyMapGenerator.

Args:
    weights_file (str): Path to the trained model weights file.

Member Function Documentation

◆ _load_model()

_load_model ( self)
protected
Load the model using the provided weights file.

Returns:
    tf.keras.Model: Loaded Keras model.

◆ _preprocess_image()

_preprocess_image ( image_path,
input_shape )
staticprotected
Preprocess the input image.

Args:
    image_path (str): Path to the input image.
    input_shape (tuple): Shape to resize the image to.

Returns:
    tuple: Preprocessed image array and the original image.

◆ generate_saliency_map()

generate_saliency_map ( self,
input_image_path,
output_path )
Generate and save a saliency map for the input image.

Args:
    input_image_path (str): Path to the input image.
    output_path (str): Path to save the saliency map.

Member Data Documentation

◆ input_shape

input_shape = self.model.input_shape[1:]

◆ model

model = self._load_model()

◆ weights_file

weights_file = weights_file

The documentation for this class was generated from the following file: