TfELM
Loading...
Searching...
No Matches
Public Member Functions | Public Attributes | Protected Member Functions | List of all members
ReceptiveFieldGenerator.ReceptiveFieldGenerator Class Reference

Public Member Functions

 __init__ (self, input_size, exclusion_distance=3, q_threshold=10, num_classes=None)
 
 to_dict (self)
 
 load (cls, attributes)
 
 generate_receptive_fields (self, W)
 

Public Attributes

 L
 
 input_size
 
 exclusion_distance
 
 q_threshold
 
 num_classes
 

Protected Member Functions

 _apply_rectangle_mask (self, image, top_left, bottom_right)
 

Detailed Description

    Receptive Field Generator.

    This class implements a generator for receptive fields used in the Deep Extreme Learning Machine (Deep ELM) model.
    Receptive fields are rectangular regions applied to feature maps in convolutional layers.

    Parameters:
    -----------
        input_size (tuple): The size of the input images (height, width, channels).
        exclusion_distance (int, optional): The minimum distance from the image border to exclude when generating
            receptive fields. Defaults to 3.
        q_threshold (int, optional): The minimum area of the generated receptive fields. Defaults to 10.
        num_classes (int, optional): Number of classes. Defaults to None.

    Attributes:
    -----------
        L (int): Number of neurons.
        input_size (tuple): The size of the input images (height, width, channels).
        exclusion_distance (int): The minimum distance from the image border to exclude when generating
            receptive fields.
        q_threshold (int): The minimum area of the generated receptive fields.
        num_classes (int): Number of classes.

    Methods:
    -----------
        to_dict(): Convert the generator to a dictionary of attributes.
        load(attributes): Load a generator instance from a dictionary of attributes.
        generate_receptive_fields(W): Generate receptive fields from weight matrices.
        __generate_double_pairs(): Generate pairs of coordinates for receptive field corners.
        _apply_rectangle_mask(image, top_left, bottom_right): Apply a rectangle mask to an image.
        __reshape_image(image_flat): Reshape a flattened image to its original shape.

Member Function Documentation

◆ _apply_rectangle_mask()

ReceptiveFieldGenerator.ReceptiveFieldGenerator._apply_rectangle_mask ( self,
image,
top_left,
bottom_right )
protected
   Apply a rectangle mask to an image.

   Parameters:
   -----------
       image (Tensor): The input image.
       top_left (Tensor): Coordinates of the top-left corner of the rectangle.
       bottom_right (Tensor): Coordinates of the bottom-right corner of the rectangle.

   Returns:
   -----------
       Tensor: The masked image.

◆ generate_receptive_fields()

ReceptiveFieldGenerator.ReceptiveFieldGenerator.generate_receptive_fields ( self,
W )
    Generate receptive fields from weight matrices.

    Parameters:
    -----------
        W (Tensor): The weight matrix.

    Returns:
    -----------
        Tensor: The processed weight matrix with receptive fields.

◆ load()

ReceptiveFieldGenerator.ReceptiveFieldGenerator.load ( cls,
attributes )
    Load a generator instance from a dictionary of attributes.

    Parameters:
    -----------
        attributes (dict): A dictionary containing the attributes of the generator.

    Returns:
    -----------
        ReceptiveFieldGenerator: An instance of the ReceptiveFieldGenerator class loaded from the attributes.

◆ to_dict()

ReceptiveFieldGenerator.ReceptiveFieldGenerator.to_dict ( self)
    Convert the generator to a dictionary of attributes.

    Returns:
    -----------
        dict: A dictionary containing the attributes of the generator.

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