Shortcuts

marsvision.pipeline.SlidingWindow module

class marsvision.pipeline.SlidingWindow.SlidingWindow(model: marsvision.pipeline.Model.Model, db_path: str = 'marsvision.db', window_length: int = 32, window_height: int = 32, stride_x: int = 32, stride_y: int = 32)

Bases: object

__init__(model: marsvision.pipeline.Model.Model, db_path: str = 'marsvision.db', window_length: int = 32, window_height: int = 32, stride_x: int = 32, stride_y: int = 32)

This class is responsible for running the sliding window pipeline, which will run through segments of an image with a window of user specified dimensions, and classify each one with a given machine learning model.

The results of the classification, as well as window and image information, is stored in a SQLite database.

——F

Parameters:

db_path (str): File path of SQLite .db file. window_length (int): Length of window on the horizontal axis in pixels. window_height (int): Height of window on the vertical axis in pixels. stride_x (int): Stride of window along the horizontal axis in pixels. stride_y (int): Stride of window along the vertical axis in pixels.

create_sql_table()

Helper that creates a global table if not present.

This is used because we need to create entries with auto incremented IDs to pass to write_window_to_sql.

sliding_window_predict(image_list: numpy.ndarray, filename_list: List[str])

Runs the sliding window algorithm and makes a prediction for each window.

Store the results in the SQLite database.

Parameters

image_list (numpy.ndarray): Image data represented as a numpy.ndarray. filename_list (List[str]): List of file names associated with the input image list.

write_global_to_sql(filename_list: List[str])

Write entries for every image in the current batch of images.

The global table holds all data that is shared by all windows when we run the sliding window algorithm over a particular image.

This data includes the stride, window dimensions, and metadata associated with the particular image.

Parameters

filename_list (List[str]): List of file names of the image batch. Can be used to derive the observation ID.

write_window_to_sql(prediction_list: List[int], window_coord_x: int, window_coord_y: int, global_id_list: numpy.ndarray)

Write a batch of inferences to the database. Include information about the window’s location in its parent image, as well as a reference key to the parent image in the global table.

Parameters prediction_list (np.ndarray): Batch of label inferrences from the model. window_coord_x (int): x coordinate of the window on the parent image. window_coord_y (int): y coordinate of the window on the parent image. gloal_id (int): ID of parent image in Global table (which holds information about the image).


© Copyright 2020 Michael Munje, Mariajose Corral, Iris Rafaela, Daniel Palencia.

Built with Sphinx using a theme provided by Read the Docs.

Docs

Lorem ipsum dolor sit amet, consectetur

View Docs

Tutorials

Lorem ipsum dolor sit amet, consectetur

View Tutorials

Resources

Lorem ipsum dolor sit amet, consectetur

View Resources