Git Product home page Git Product logo

sc_classifier's Introduction

sc_classifier

A package to compute an image segmentation map via the spatial-spectral pixel clustering algorithm of Hebert & Macaire (https://ieeexplore.ieee.org/document/4529995), developed for use in astronomical image processing.

The basic algorithm is run via the SpatialColorClassifier object. For example, given a data array d with shape (n_color_dimensions, n_x, n_y), you can get a new image with shape (n_x, n_y) and values [-1, n_clusters) via:

>>> scc = sc_classifier.SpatialColorClassifier(d)
>>> image_segments = scc.get_clusters()

You can add additional keyword arguments that control how the segments are determined.

Additionally, the package contains two algorithms to denoise the resulting maps. grow() fills in pixel values of -1 (unknown segment) with the mode of the surrounding pixels. maxpool() runs a 3x3 maxpool algorithm that prioritizes densely clustered segments over more diffuse segments, and is useful if a large area has been divided into two interlaced color segments, at the expense of growing or shrinking contiguous regions by a few pixels.

The algorithm relies on an internal matrix that is size (n_color_pixels)**(n_color_dimensions), where n_color_pixels is the number of pixels used in the internal color pixelization scheme. Therefore, high-dimensional color spaces are demanding in both computation time and memory usage. sc_classifier.pca_reduce applies the scikit-learn PCA routine to a data cube to reduce its color dimensionality.

Two example scripts can be found in the examples/ directory. get_clusters_from_file.py runs the algorithm on a user-defined FITS file. get_clusters_from_array.py runs the algorithm on a user-defined data cube. Both can be run with the --help option to see available command-line arguments.

sc_classifier's People

Contributors

msimet avatar

Stargazers

You Wan avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.