Q
- Type of pixelT
- Type of Image
public abstract class PatchClassificationModel<Q,T extends Image<Q,T>> extends Object implements ImageClassificationModel<T>
ImageClassificationModel
based on the idea of determining the
probability of a class of a pixel given the local patch of pixels surrounding
the pixel in question. A sliding window of a given size is moved across the
image (with overlap), and the contents of the window are analysed to
determine the probability belonging to the pixel at the centre of the window.Modifier and Type | Field and Description |
---|---|
protected int |
patchHeight |
protected int |
patchWidth |
Constructor and Description |
---|
PatchClassificationModel(int patchWidth,
int patchHeight)
Construct with the given dimensions for the sampling patch.
|
Modifier and Type | Method and Description |
---|---|
FImage |
classifyImage(T im)
Classify the given image and return the corresponding probability map
|
abstract float |
classifyPatch(T patch)
Classify a patch, returning the probability of the central pixel
belonging to the class.
|
abstract PatchClassificationModel<Q,T> |
clone()
Clone the model
|
boolean |
estimate(List<? extends IndependentPair<T,FImage>> data)
Estimates the model from the observations in the list of data.
|
protected abstract T[] |
getArray(int length) |
int |
numItemsToEstimate() |
FImage |
predict(T data)
Uses the model to predict dependent data from an independent value.
|
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
learnModel
protected int patchHeight
protected int patchWidth
public PatchClassificationModel(int patchWidth, int patchHeight)
patchWidth
- the width of the sampling patchpatchHeight
- the height of the sampling patchpublic abstract float classifyPatch(T patch)
patch
- the patch.public FImage classifyImage(T im)
ImageClassificationModel
classifyImage
in interface ImageClassificationModel<T extends Image<Q,T>>
im
- the image to classifypublic abstract PatchClassificationModel<Q,T> clone()
EstimatableModel
public boolean estimate(List<? extends IndependentPair<T,FImage>> data)
EstimatableModel
EstimatableModel.numItemsToEstimate()
pairs of dependent
and independent data. It may contain more, in which case the estimate
method may choose to make use of this data for validation, or obtaining a
better model by a least squares method for example.estimate
in interface EstimatableModel<T extends Image<Q,T>,FImage>
data
- Data with which to estimate the modelEstimatableModel.numItemsToEstimate()
public int numItemsToEstimate()
numItemsToEstimate
in interface EstimatableModel<T extends Image<Q,T>,FImage>