ImageSearcher
Stay organized with collections
Save and categorize content based on your preferences.
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 |
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2022-04-22 UTC.
[{
"type": "thumb-down",
"id": "missingTheInformationINeed",
"label":"Missing the information I need"
},{
"type": "thumb-down",
"id": "tooComplicatedTooManySteps",
"label":"Too complicated / too many steps"
},{
"type": "thumb-down",
"id": "outOfDate",
"label":"Out of date"
},{
"type": "thumb-down",
"id": "samplesCodeIssue",
"label":"Samples / code issue"
},{
"type": "thumb-down",
"id": "otherDown",
"label":"Other"
}]
[{
"type": "thumb-up",
"id": "easyToUnderstand",
"label":"Easy to understand"
},{
"type": "thumb-up",
"id": "solvedMyProblem",
"label":"Solved my problem"
},{
"type": "thumb-up",
"id": "otherUp",
"label":"Other"
}]