PyCDA Submodules¶
Detectors¶
-
class
pycda.detectors.
DetectorBaseClass
[source]¶ Bases:
object
This is the base class for a detector object. Attributes in the __init__ method should be specified by child detectors.
-
class
pycda.detectors.
DummyDetector
(input_dims=(256, 256), output_dims=(172, 172), n_channels=1, batch_size=5)[source]¶ Bases:
pycda.detectors.DetectorBaseClass
The dummy detector is used for testing. It returns predictions when called; the predictions contain random values between 0 and 1, in the dimensions specified at initialization.
-
class
pycda.detectors.
TinyDetector
[source]¶ Bases:
pycda.detectors.DetectorBaseClass
A tiny version of U-Net downsized for speed. Its output is a per-pixel likelihood that a given pixel is a part of a crater surface feature. Single color channel (grayscale).
-
class
pycda.detectors.
UnetDetector
[source]¶ Bases:
pycda.detectors.DetectorBaseClass
U-net convolutional model to generate pixel-wise prediction. Its output is a per-pixel likelihood that a given pixel is a part of a crater surface feature. Single color channel (grayscale).
Extractors¶
-
class
pycda.extractors.
CircleExtractor
(sensitivity=0.5)[source]¶ Bases:
pycda.extractors.ExtractorBaseClass
Circle Extractor assumes all objects in detection map are circles. It identifies groups of pixels, computes their mean location (centroid), and diameter based on the number of pixels in the group.
-
get_crater_pixels
(label_matrix, idx)[source]¶ Takes a label matrix and a number and gets all the pixel locations from that crater object.
-
get_crater_proposals
(detection_map)[source]¶ Takes a pixel-wise prediction map and returns a list of crater proposals as x, y, d.
-
-
class
pycda.extractors.
DummyExtractor
[source]¶ Bases:
pycda.extractors.ExtractorBaseClass
Dummy Extractor takes an input image and returns a list of random predictions for testing. Proposals are a list of tuples. Each tuple in the list has the crater proposal as (in pixels): (x position, y position, diameter).
Classifiers¶
-
class
pycda.classifiers.
ClassifierBaseClass
[source]¶ Bases:
object
Base object for crater classifier. Classifiers make a binary prediction on a crater proposal and return a value between zero and one; one represents a true crater and zero represents a false proposal.
-
class
pycda.classifiers.
ConvolutionalClassifier
[source]¶ Bases:
pycda.classifiers.ClassifierBaseClass
12x12 pixel classifier using 2D convolution implimented with Keras on tensorflow backend. Built for nice performance and speed.
-
class
pycda.classifiers.
DummyClassifier
(input_dims=(20, 20), n_channels=1)[source]¶ Bases:
pycda.classifiers.ClassifierBaseClass
Dummy classifier for testing.
-
class
pycda.classifiers.
NullClassifier
(input_dims=(1, 1))[source]¶ Bases:
pycda.classifiers.ClassifierBaseClass
For use when classifier is not wanted. Returns a likelihood of 1 for every proposal.
Predictions¶
-
class
pycda.predictions.
Prediction
(image, id_no, cda)[source]¶ Bases:
object
A prediction object is a specialized data handler for pycda. It tracks the progress of predictions on an input image, helps the pipeline track information, and can perform auxiliary functions that help the user inspect the prediction, save the results, export csv files, and modify hyperparameters.
-
get_proposals
(threshold=0.5)[source]¶ Returns a dataframe of detected craters. Threshold determines a cutoff for proposal likelihood.
-
record_detection
(detection, index)[source]¶ Records a detection in the prediction map. Uses index to determine location of detection.
-
set_scale
(scale)[source]¶ User can set scale for statistics in meters. scale should be meters per pixel.
-
Error Stats¶
-
class
pycda.error_stats.
ErrorAnalyzer
[source]¶ Bases:
object
Error Analyzer is used to measure predictive performance of cda. It is intended for use on images where all craters have been hand labeled and so are “known”. The PyCDA prediction object accepts known craters as a pandas dataframe under the attribute .known_craters; the columns ‘x’, ‘y’, and ‘diameter’ should be populated with approprate values for known crater objects for use with ErrorAnalyzer.
-
analyze
(prediction)[source]¶ Takes a prediction object and performs analysis on it. Raises an exception if no known crater labels are attributed to the input prediction object.
-