public class VLADIndexerData extends Object
Constructor and Description |
---|
VLADIndexerData(VLAD<float[]> vlad,
FeatureVectorPCA pca,
FloatProductQuantiser pq,
LocalFeatureExtractor<LocalFeature<?,?>,MBFImage> extractor,
Function<List<? extends LocalFeature<?,?>>,List<FloatLocalFeatureAdaptor<?>>> postProcess)
Construct with the given data
|
Modifier and Type | Method and Description |
---|---|
IncrementalFloatADCNearestNeighbours |
createIncrementalIndex()
Create an
IncrementalFloatADCNearestNeighbours pre-prepared to
index data |
float[] |
extractPcaVlad(List<? extends LocalFeature<?,?>> features)
Extract the PCA-projected VLAD feature from the given raw local features.
|
float[] |
extractPcaVlad(MBFImage image)
Extract the PCA-projected VLAD feature from the given image.
|
byte[] |
extractPQPcaVlad(List<? extends LocalFeature<?,?>> features)
Extract the product-quantised PCA-projected VLAD feature from the given
raw local features.
|
byte[] |
extractPQPcaVlad(MBFImage image)
Extract the product-quantisedPCA-projected VLAD feature from the given
image.
|
LocalFeatureExtractor<LocalFeature<?,?>,MBFImage> |
getExtractor() |
FeatureVectorPCA |
getPCA() |
Function<List<? extends LocalFeature<?,?>>,List<FloatLocalFeatureAdaptor<?>>> |
getPostProcess() |
FloatProductQuantiser |
getProductQuantiser()
Get the product quantiser
|
VLAD<float[]> |
getVLAD()
Get the
VLAD aggregator instance |
int |
index(List<? extends LocalFeature<?,?>> features,
IncrementalFloatADCNearestNeighbours nn)
Index the given features into the given nearest neighbours object by
converting them to the PCA-VLAD representation and then
product-quantising.
|
int |
index(MBFImage image,
IncrementalFloatADCNearestNeighbours nn)
Index the given image into the given nearest neighbours object by
extracting the PCA-VLAD representation and then product-quantising.
|
int |
numDimensions()
Get the dimensionality of the float vectors extracted from the pca-vlad
process.
|
static VLADIndexerData |
read(File file)
Read a
VLADIndexerData object to the given file created with the
write(File) method. |
static VLADIndexerData |
read(InputStream is)
Read a
VLADIndexerData object to the given stream created with
the write(OutputStream) method. |
void |
write(File file)
Write this
VLADIndexerData object to the given file. |
void |
write(OutputStream os)
Write this
VLADIndexerData object to the given stream. |
public VLADIndexerData(VLAD<float[]> vlad, FeatureVectorPCA pca, FloatProductQuantiser pq, LocalFeatureExtractor<LocalFeature<?,?>,MBFImage> extractor, Function<List<? extends LocalFeature<?,?>>,List<FloatLocalFeatureAdaptor<?>>> postProcess)
vlad
- the VLAD extractorpca
- the PCA basispq
- the product quantiserextractor
- the raw local feature extractorpostProcess
- the process to apply to the raw features before VLAD
aggregationpublic float[] extractPcaVlad(List<? extends LocalFeature<?,?>> features)
VLAD
and projected by the PCA basis.features
- the raw local featurespublic float[] extractPcaVlad(MBFImage image)
VLAD
and projected by the PCA basis.image
- the image to extract frompublic byte[] extractPQPcaVlad(List<? extends LocalFeature<?,?>> features)
VLAD
and projected by the PCA basis.features
- the raw local featurespublic byte[] extractPQPcaVlad(MBFImage image)
VLAD
and projected by the PCA basis.image
- the image to extract frompublic FloatProductQuantiser getProductQuantiser()
public IncrementalFloatADCNearestNeighbours createIncrementalIndex()
IncrementalFloatADCNearestNeighbours
pre-prepared to
index dataIncrementalFloatADCNearestNeighbours
public int index(List<? extends LocalFeature<?,?>> features, IncrementalFloatADCNearestNeighbours nn)
features
- the features to indexnn
- the nearest neighbours objectpublic int index(MBFImage image, IncrementalFloatADCNearestNeighbours nn)
image
- the image to indexnn
- the nearest neighbours objectpublic void write(File file) throws IOException
VLADIndexerData
object to the given file. The file can
be re-read using the read(File)
method.file
- the file to write toIOException
- if an error occurspublic void write(OutputStream os) throws IOException
VLADIndexerData
object to the given stream. The
read(InputStream)
can read from a stream to reconstruct the
VLADIndexerData
.os
- the streamIOException
- if an error occurspublic static VLADIndexerData read(File file) throws IOException
VLADIndexerData
object to the given file created with the
write(File)
method.file
- the file to read fromVLADIndexerData
object.IOException
- if an error occurspublic static VLADIndexerData read(InputStream is) throws IOException
VLADIndexerData
object to the given stream created with
the write(OutputStream)
method.is
- the stream to read fromVLADIndexerData
object.IOException
- if an error occurspublic VLAD<float[]> getVLAD()
VLAD
aggregator instanceVLAD
aggregatorpublic int numDimensions()
public FeatureVectorPCA getPCA()
public LocalFeatureExtractor<LocalFeature<?,?>,MBFImage> getExtractor()
public Function<List<? extends LocalFeature<?,?>>,List<FloatLocalFeatureAdaptor<?>>> getPostProcess()