Image Recognition and Object Detection with MediaPipe on Android
Anant Chowdhary
Software Engineer
Agenda
What is MediaPipe ?
What is MediaPipe ?
Some of them are :
Why MediaPipe ?
MediaPipe Tasks and Graphs
MediaPipe Tasks and Graphs
MediaPipe Tasks and Graphs
(Node) GrayScaleCalculator
(Node) PassThroughCalculator
Input Video (input_video)
Output Video (output_video)
MediaPipe Tasks and Graphs
node {
calculator: “GrayScaleCalculator”
input_stream: “input_video”
output_stream: “grayscale_video”
}
node {
calculator: “PassThroughCalculator”
input_stream: “grayscale_video”
output_stream: “output_video”
}
output_stream: “output_video”
Vision Tasks
Vision Tasks
cell phone
Object Detection
Image Classification
Image Segmentation
Object Detection
Models used for Object Detection
Models used for Object Detection
EfficientDet-Lite0 | EfficientDet-Lite2 | SSD MobileNetV2 |
1.5 million object instances, 80 labels | 1.5 million object instances, 80 labels | 1.5 million object instances, 80 labels |
Accurate, lightweight, strikes a balance between latency and accuracy | More accurate than EfficientDet-Lite0 in general, but slower and requires more memory, | Very fast, light but not as accurate as EfficientDet-Lite0 |
Models used for Object Detection
MediaPipe Object Detection on Android
dependencies {
implementation ‘com.google.mediapipe:tasks-vision:latest.release’
}
BaseOptions for MediaPipe Tasks
MediaPipe ObjectDetector
MediaPipe ObjectDetector
ObjectDetector
ObjectDetectorOptions
BaseOptions
RunningMode
maxResults
threshold
Allowlist
Denylist
MediaPipe ObjectDetector
objectDetector = ObjectDetector.createFromOptions(context, options);
val mpImageForInference = BitmapImageBuilder(bitmapImage).build()
MediaPipe ObjectDetector Results
Some Real World Examples of Object Detection
(Using EfficientDet-lite0.tflite)
Some Real World Examples of Supported Labels
(Using EfficientDet-lite0.tflite)
Image Classification
cell phone
Image Classification
Image Classification Inference
Image Classification Results
Classification
Category
Category
Category
Classification
Category
Category
Category
Classification
Category
Category
Classification[]
Category
Image Classification Results
ImageClassifierResult:
Classifications #0:
head index: 0
category #0:
category name: "/m/01f6pd"
display name: "American Crow"
score: 0.7140
index: 28
category #1:
category name: "/m/01g1fg"
display name: "Fish Crow"
score: 0.00491
index: 29
Image Segmentation
Image Segmentation
Image Segmentation
MediaPipe Image Segmentation Inference
imageSegmenter = ImageSegmenter.createFromOptions(context, imageSegmenterOptions);
Image Segmentation
Image Segmentation
HairSegmenter
DeepLab-V3
Where do we find Models from ?
On-Device Machine Learning with MediaPipe
On-Device Machine Learning with MediaPipe
A few things to think about when developing with MediaPipe
In Summary
Thank You