Entry class for Firebase machine learning vision services.
To use this class, get an instance via getInstance()
or
getInstance(FirebaseApp)
, and then get an instance of a detector. The code below
is an example of getting an instance of a face detector:
FirebaseVisionFaceDetector faceDetector = FirebaseVision.getInstance().getVisionFaceDetector();
See individual detector classes for details.
Public Method Summary
FirebaseVisionDocumentTextRecognizer |
getCloudDocumentTextRecognizer(FirebaseVisionCloudDocumentRecognizerOptions
options)
Gets a
FirebaseVisionDocumentTextRecognizer that can detect document text
in a supplied image.
|
FirebaseVisionDocumentTextRecognizer |
getCloudDocumentTextRecognizer()
Gets a
FirebaseVisionDocumentTextRecognizer that can detect document text
in a supplied image with default options.
|
FirebaseVisionImageLabeler |
getCloudImageLabeler(FirebaseVisionCloudImageLabelerOptions
options)
Gets a cloud version of
FirebaseVisionImageLabeler that can detect labels in a supplied
image.
|
FirebaseVisionImageLabeler |
getCloudImageLabeler()
Gets a cloud version of
FirebaseVisionImageLabeler that can detect labels in a supplied
image with default options.
|
FirebaseVisionTextRecognizer |
getCloudTextRecognizer()
Gets a
FirebaseVisionTextRecognizer to perform optical character
recognition with cloud model and default options.
|
FirebaseVisionTextRecognizer |
getCloudTextRecognizer(FirebaseVisionCloudTextRecognizerOptions
options)
Gets a
FirebaseVisionTextRecognizer to perform optical character
recognition with cloud model and provided options.
|
static FirebaseVision |
getInstance()
Gets an instance of
FirebaseVision
associated with the default FirebaseApp .
|
static FirebaseVision |
getInstance(FirebaseApp
app)
Gets an instance of
FirebaseVision
associated with the supplied FirebaseApp .
|
FirebaseVisionImageLabeler |
getOnDeviceAutoMLImageLabeler(FirebaseVisionOnDeviceAutoMLImageLabelerOptions
options)
This method is deprecated. The standalone ML Kit SDK replaces this API. For
more information, refer to the migration guide.
|
FirebaseVisionImageLabeler |
getOnDeviceImageLabeler()
This method is deprecated. The standalone ML Kit SDK replaces this API. For
more information, refer to the migration guide.
|
FirebaseVisionImageLabeler |
getOnDeviceImageLabeler(FirebaseVisionOnDeviceImageLabelerOptions
options)
This method is deprecated. The standalone ML Kit SDK replaces this API. For
more information, refer to the migration guide.
|
FirebaseVisionObjectDetector |
getOnDeviceObjectDetector()
This method is deprecated. The standalone ML Kit SDK replaces this API. For
more information, refer to the migration guide.
|
FirebaseVisionObjectDetector |
getOnDeviceObjectDetector(FirebaseVisionObjectDetectorOptions
options)
This method is deprecated. The standalone ML Kit SDK replaces this API. For
more information, refer to the migration guide.
|
FirebaseVisionTextRecognizer |
getOnDeviceTextRecognizer()
This method is deprecated. The standalone ML Kit SDK replaces this API. For
more information, refer to the migration guide.
|
FirebaseVisionBarcodeDetector |
getVisionBarcodeDetector(FirebaseVisionBarcodeDetectorOptions
options)
This method is deprecated. The standalone ML Kit SDK replaces this API. For
more information, refer to the migration guide.
|
FirebaseVisionBarcodeDetector |
getVisionBarcodeDetector()
This method is deprecated. The standalone ML Kit SDK replaces this API. For
more information, refer to the migration guide.
|
FirebaseVisionCloudLandmarkDetector |
getVisionCloudLandmarkDetector()
Gets a
FirebaseVisionCloudLandmarkDetector that can detect landmark in a
supplied image with default options.
|
FirebaseVisionCloudLandmarkDetector |
getVisionCloudLandmarkDetector(FirebaseVisionCloudDetectorOptions
options)
Gets a
FirebaseVisionCloudLandmarkDetector that can detect landmark in a
supplied image.
|
FirebaseVisionFaceDetector |
getVisionFaceDetector()
This method is deprecated. The standalone ML Kit SDK replaces this API. For
more information, refer to the migration guide.
|
FirebaseVisionFaceDetector |
getVisionFaceDetector(FirebaseVisionFaceDetectorOptions
options)
This method is deprecated. The standalone ML Kit SDK replaces this API. For
more information, refer to the migration guide.
|
boolean |
isStatsCollectionEnabled()
Determines whether stats collection in
FirebaseVision
is enabled or disabled
|
void |
setStatsCollectionEnabled(boolean enable)
Enables stats collection in ML Kit vision.
|
Inherited Method Summary
Public Methods
public FirebaseVisionDocumentTextRecognizer getCloudDocumentTextRecognizer (FirebaseVisionCloudDocumentRecognizerOptions options)
Gets a
FirebaseVisionDocumentTextRecognizer
that can detect document text in a
supplied image.
Parameters
options | the options for the cloud text detector. |
---|
Returns
- an instance of
FirebaseVisionDocumentTextRecognizer
. Note that text detector instance will be the same instance if the supplied options are the same and under the sameFirebaseVision
.
public FirebaseVisionDocumentTextRecognizer getCloudDocumentTextRecognizer ()
Gets a
FirebaseVisionDocumentTextRecognizer
that can detect document text in a
supplied image with default options.
Returns
- an instance of
FirebaseVisionDocumentTextRecognizer
. Note that multiple calls of this API would always return the same cloud document text instance and under the sameFirebaseVision
.
public FirebaseVisionImageLabeler getCloudImageLabeler (FirebaseVisionCloudImageLabelerOptions options)
Gets a cloud version of
FirebaseVisionImageLabeler
that can detect labels in a supplied image.
Parameters
options | the options for the cloud image labeler. |
---|
Returns
- an instance of
FirebaseVisionImageLabeler
. Note that image labeler instance will be the same instance if the supplied options are the same and under the sameFirebaseVision
.
public FirebaseVisionImageLabeler getCloudImageLabeler ()
Gets a cloud version of
FirebaseVisionImageLabeler
that can detect labels in a supplied image with
default options.
Returns
- an instance of
FirebaseVisionImageLabeler
. Note that multiple calls of this API would always return the same cloud label instance and under the sameFirebaseVision
.
public FirebaseVisionTextRecognizer getCloudTextRecognizer ()
Gets a
FirebaseVisionTextRecognizer
to perform optical character recognition with
cloud model and default options.
Returns
- an instance of
FirebaseVisionTextRecognizer
. Note there is only one instance of cloudFirebaseVisionTextRecognizer
and under the sameFirebaseVision
.
public FirebaseVisionTextRecognizer getCloudTextRecognizer (FirebaseVisionCloudTextRecognizerOptions options)
Gets a
FirebaseVisionTextRecognizer
to perform optical character recognition with
cloud model and provided options.
Returns
- an instance of
FirebaseVisionTextRecognizer
. Note that the returned instance will be the same if the supplied options are the same and under the sameFirebaseVision
.
public static FirebaseVision getInstance ()
Gets an instance of FirebaseVision
associated with the default FirebaseApp
.
public static FirebaseVision getInstance (FirebaseApp app)
Gets an instance of FirebaseVision
associated with the supplied FirebaseApp
.
Parameters
app | the FirebaseApp
to associate this FirebaseVision
with. |
---|
public FirebaseVisionImageLabeler getOnDeviceAutoMLImageLabeler (FirebaseVisionOnDeviceAutoMLImageLabelerOptions options)
This method is deprecated.
The standalone ML Kit SDK replaces this API. For more information, refer to the migration guide.
Gets an on device version of
FirebaseVisionImageLabeler
that labels a supplied image, using a model
trained from Firebase AutoML.
Parameters
options | the options for the on device automl image labeler. |
---|
Returns
- an instance of
FirebaseVisionImageLabeler
. Note that multiple calls of this API would always return the same image labeler instance and under the sameFirebaseVision
.
Throws
FirebaseMLException | if failed to instantiate a
FirebaseVisionImageLabeler . |
---|
public FirebaseVisionImageLabeler getOnDeviceImageLabeler ()
This method is deprecated.
The standalone ML Kit SDK replaces this API. For more information, refer to the migration guide.
Gets an on device version of
FirebaseVisionImageLabeler
that labels a supplied image with a default
FirebaseVisionOnDeviceImageLabelerOptions
.
Returns
- an instance of
FirebaseVisionImageLabeler
. Note that multiple calls of this API would always return the same image label detector instance and under the sameFirebaseVision
.
public FirebaseVisionImageLabeler getOnDeviceImageLabeler (FirebaseVisionOnDeviceImageLabelerOptions options)
This method is deprecated.
The standalone ML Kit SDK replaces this API. For more information, refer to the migration guide.
Gets an on device version of
FirebaseVisionImageLabeler
that labels a supplied image.
Parameters
options | the options for the on device image labeler. |
---|
Returns
- an instance of
FirebaseVisionImageLabeler
. Note that image labeler instance will be the same instance if the supplied options are the same and under the sameFirebaseVision
.
public FirebaseVisionObjectDetector getOnDeviceObjectDetector ()
This method is deprecated.
The standalone ML Kit SDK replaces this API. For more information, refer to the migration guide.
Gets a
FirebaseVisionObjectDetector
that can detect objects in a supplied image
with default options.
Returns
- an instance of
FirebaseVisionObjectDetector
. Note that multiple calls of this API would always return the same object detector instance and under the sameFirebaseVision
.
public FirebaseVisionObjectDetector getOnDeviceObjectDetector (FirebaseVisionObjectDetectorOptions options)
This method is deprecated.
The standalone ML Kit SDK replaces this API. For more information, refer to the migration guide.
Gets a
FirebaseVisionObjectDetector
that can detect objects in a supplied image
with given options.
Returns
- an instance of
FirebaseVisionObjectDetector
. Note that multiple calls of this API would always return the same object detector instance if the supplied options are the same and under the sameFirebaseVision
.
public FirebaseVisionTextRecognizer getOnDeviceTextRecognizer ()
This method is deprecated.
The standalone ML Kit SDK replaces this API. For more information, refer to the migration guide.
Gets a
FirebaseVisionTextRecognizer
to perform optical character recognition with
on-device model.
Returns
- an instance of
FirebaseVisionTextRecognizer
. Note there is only one instance of on-deviceFirebaseVisionTextRecognizer
and under the sameFirebaseVision
.
public FirebaseVisionBarcodeDetector getVisionBarcodeDetector (FirebaseVisionBarcodeDetectorOptions options)
This method is deprecated.
The standalone ML Kit SDK replaces this API. For more information, refer to the migration guide.
Gets a
FirebaseVisionBarcodeDetector
that can detect barcodes in a supplied
image.
Parameters
options | the options for the barcode detector. |
---|
Returns
- an instance of
FirebaseVisionBarcodeDetector
. Note that barcode detector instance will be the same instance if the supplied options are the same and under the sameFirebaseVision
.
public FirebaseVisionBarcodeDetector getVisionBarcodeDetector ()
This method is deprecated.
The standalone ML Kit SDK replaces this API. For more information, refer to the migration guide.
Gets a
FirebaseVisionBarcodeDetector
that can detect barcodes in a supplied image
with a default
FirebaseVisionBarcodeDetectorOptions
.
Returns
- an instance of
FirebaseVisionBarcodeDetector
. Note that multiple calls of this API would always return the same barcode detector instance and under the sameFirebaseVision
.
public FirebaseVisionCloudLandmarkDetector getVisionCloudLandmarkDetector ()
Gets a
FirebaseVisionCloudLandmarkDetector
that can detect landmark in a supplied
image with default options.
Returns
- an instance of
FirebaseVisionCloudLandmarkDetector
. Note that multiple calls of this API would always return the same cloud landmark instance and under the sameFirebaseVision
.
public FirebaseVisionCloudLandmarkDetector getVisionCloudLandmarkDetector (FirebaseVisionCloudDetectorOptions options)
Gets a
FirebaseVisionCloudLandmarkDetector
that can detect landmark in a supplied
image.
Parameters
options | the options for the cloud landmark detector. |
---|
Returns
- an instance of
FirebaseVisionCloudLandmarkDetector
. Note that landmark detector instance will be the same instance if the supplied options are the same and under the sameFirebaseVision
.
public FirebaseVisionFaceDetector getVisionFaceDetector ()
This method is deprecated.
The standalone ML Kit SDK replaces this API. For more information, refer to the migration guide.
Gets a
FirebaseVisionFaceDetector
that detects faces in a supplied image with a
default
FirebaseVisionFaceDetectorOptions
.
Returns
- an instance of
FirebaseVisionFaceDetector
. Note that multiple calls of this API would always return the same cloud face instance and under the sameFirebaseVision
.
public FirebaseVisionFaceDetector getVisionFaceDetector (FirebaseVisionFaceDetectorOptions options)
This method is deprecated.
The standalone ML Kit SDK replaces this API. For more information, refer to the migration guide.
Gets a
FirebaseVisionFaceDetector
that detects faces in a supplied image.
Parameters
options | the options for the face detector. |
---|
Returns
- an instance of
FirebaseVisionFaceDetector
. Note that face detector instance will be the same instance if the supplied options are the same and under the sameFirebaseVision
.
public boolean isStatsCollectionEnabled ()
Determines whether stats collection in FirebaseVision
is enabled or disabled
Returns
- true if stats collection is enabled and false otherwise.
public void setStatsCollectionEnabled (boolean enable)
Enables stats collection in ML Kit vision. The stats include API calls counts, errors, API call durations, options, etc. No personally identifiable information is logged.
The setting is per FirebaseApp
,
and it is persistent together with app's private data. It means if the user uninstalls
the app or clears all app data, the setting will be erased. The best practice is to set
the flag in each initialization.
By default the logging is enabled. You have to specifically set it to false to disable logging.