Performs similarity search on images.
The API expects a TFLite model with optional, but strongly recommended, TFLite Model Metadata..
- Input image tensor (
kTfLiteUInt8
/kTfLiteFloat32
)
- image input of size
[batch x height x width x channels]
.
- batch inference is not supported (
batch
is required to be 1).
- only RGB inputs are supported (
channels
is required to be 3).
- if type is
kTfLiteFloat32
, NormalizationOptions are required to be attached
to the metadata for input normalization.
Output tensor (kTfLiteUInt8
/kTfLiteFloat32
)
N
components corresponding to the N
dimensions of the returned
feature vector for this output layer.
- Either 2 or 4 dimensions, i.e.
[1 x N]
or [1 x 1 x 1 x N]
.
TODO(b/180502532): add pointer to example model.
TODO(b/222671076): add factory create methods without options, such as `createFromFile`, once
the single file format (index file packed in the model) is supported.
Inherited Methods
From class
java.lang.Object
boolean
|
|
final
Class<?>
|
getClass()
|
int
|
hashCode()
|
final
void
|
notify()
|
final
void
|
notifyAll()
|
String
|
toString()
|
final
void
|
wait(long arg0, int arg1)
|
final
void
|
wait(long arg0)
|
final
void
|
wait()
|
From interface
java.io.Closeable
From interface
java.lang.AutoCloseable
Public Methods
Parameters
modelBuffer |
|
options |
|
indexFd |
|
Parameters
context |
|
modelPath |
path of the search model with metadata in the assets |
options |
|
Parameters
modelFile |
the search model File instance |
options |
|
Parameters
image |
a UINT8 TensorImage object that represents an RGB or YUV image |
options |
|
Performs embedding extraction on the provided MlImage
, followed by nearest-neighbor
search in the index.
Parameters
image |
an MlImage object that represents an image |
Performs embedding extraction on the provided MlImage
with ImageProcessingOptions
, followed by nearest-neighbor search in the index.
ImageSearcher
supports the following options:
Parameters
image |
a MlImage object that represents an image |
options |
configures options including ROI and rotation |
Performs embedding extraction on the provided TensorImage
, followed by nearest-neighbor
search in the index.
ImageSearcher
supports the following TensorImage
color space types:
Parameters
image |
a UINT8 TensorImage object that represents an RGB or YUV image |