Predictor

public interface Predictor

Makes density map predictions from images.

Author:Kyle M. Douglass

Methods

close

public void close()

Closes resources associated with this predictor.

getCount

public double getCount()

Returns the most recent count.

Throws:
Returns:

The predicted count from the density map.

getDensityMap

public FloatProcessor getDensityMap()

Returns the most recently calculated density map prediction.

Throws:
Returns:

The predicted density map.

getLocalCountMap

public FloatProcessor getLocalCountMap()

Returns the most recently-calculated local count map.

Throws:
Returns:

The most recently calculated local count map.

getMaximumLocalCount

public double getMaximumLocalCount(int boxSize)

Returns the maximum local count value. This value is obtained by convolving the density map with a square kernel whose values are all 1 and then taking the maximum of the resulting map. It effectively produces the highest count value over length scales equal to the size of the kernel.

Parameters:
  • boxSize – The width of the square kernel.
Throws:
Returns:

The maximum local count from the density map.

predict

public void predict(ImageProcessor ip)

Makes a density map prediction from a 2D image.

Parameters:
  • ip – The image to perform a prediction on.

setup

public void setup(String pathToModel)

Initializes the predictor with a saved TensorFlow model bundle.

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