AbstractPredictor

public abstract class AbstractPredictor

A base implementation for DEFCoN predictors. A predictor is a class that takes an image(s) as input and estimates a density map of object locations from it.

Author:Kyle M. Douglass

Fields

isClosed

protected boolean isClosed

Has the TensorFlow session been closed?

tfSession

protected Session tfSession

A copy of the current TensorFlow session.

Methods

close

public void close()

Closes resources associated with this predictor.

finalize

protected void finalize()

Failsafe in case the TensorFlow session has not been closed.

Throws:

imageToTensor

protected static Tensor<Float> imageToTensor(ImagePlus imp)

Converts an ImageJ image to a TensorFlow tensor. The original image is preserved.

Parameters:
  • imp – The image to convert.
Returns:

A tensor representing the data in the original image.

setup

public void setup(String pathToModel)

Initializes the predictor.

Parameters:
  • pathToModel – The path to a saved TensorFlow model bundle.