Smarter Than Monkey, Meet APE
yihsuanchen@kkbox.com
Agenda
● What’s Monkey ?
● What’s APE ?
● What We Learned ?
○ Recommendation
○ Limitation
○ Vision
Before Starting
Yihsuan Chen
KKBOX
Software Engineer in Test
What’s Monkey ?
Monkey Test
● Fuzz testing
○ For stability
○ Crash, OOM, ANR
● Advantage
○ Fast
○ Low-cost
Monkey Test In KKBOX
● 2016 - 2019
○ 291 / 310 of closed / open issues
● Daily Crash Free Rate
○ 96% in 2016
○ 99.9% in 2019
● Development
○ 5 workdays
git@github.com:dino-su/android-monkey-quick-start.git
Dino Su @KKBOX
Android Monkey Test @TestCorner#14
?
Limitation
● Hard to reproduce
○ Random script
○ Random location
○ Random event
All things are random!
● Minor issue
A Little Stupid
APE
With Object Detection
Smarter Than Monkey, Meet APE
What We Want
🔲 Continuous Integration
🔲 Incremental Datasets
🔲 Speed
🔲 Well Integrity Lifecycle
🔲 Cross-Platform
TensorFlow Object Detection API
README.md
Smarter Than Monkey, Meet APE
Smarter Than Monkey, Meet APE
Setup
● Training
○ Local or Cloud
● TensorFlow
○ CPU or GPU
Smarter Than Monkey, Meet APE
Smarter Than Monkey, Meet APE
Training Inputs
● Screenshots
● Annotation tool
● Transfer your training dataset to TFRecord file format
Smarter Than Monkey, Meet APE
Smarter Than Monkey, Meet APE
Training Configs
● Pre-trained model Zoo
● Sample configs
e.g.
● ssd_mobilenet_v2_quantized
● ssd_mobilenet_v2_quantized_*.config
Smarter Than Monkey, Meet APE
Training
● Config, saving place, training steps
$ python object_detection/model_main.py 
--pipeline_config_path= ${CONFIG} 
--model_dir=${MODEL_SAVING_PLACE} 
--num_train_steps= ${TRAINING_STEPS} 
--sample_1_of_n_eval_examples=1 
--alsologtostderr
Tensorboard
● To inspect the progress of training
$ tensorboard --logdir= ${MODEL_SAVING_PLACE}
Smarter Than Monkey, Meet APE
Smarter Than Monkey, Meet APE
TensorFlow Lite
● Convert checkpoint to TFLite
model.ckpt-20000
$ python object_detection/export_tflite_ssd_graph.py ...
tflite/
detect.tflite
Smarter Than Monkey, Meet APE
Smarter Than Monkey, Meet APE
Smarter Than Monkey, Meet APE
git@github.com:tensorflow/examples.git /lite/examples/object_detection/
TensorFlow Lite
● Deploy TFLite & labelmap.txt into your project
Android app/src/main/assets/labelmap.txt
app/src/main/assets/detect.tflite
iOS ObjectDetection/Model/labelmap.txt
ObjectDetection/Model/detect.tflite
Live Demo
TFLite Object Detector
How We Test
● Loop, in a specific event count
○ Screenshot
○ Feed the screenshot to TFLite Object Detection API
○ Get labels’ information (label name, coordinate, confidence)
○ Do actions (click, scroll, keyevent)
Live Demo
KKBOX APE
A Quick Recap
Smarter Than Monkey, Meet APE
What We Want
✅ Continuous Integration
✅ Incremental Datasets
✅ Speed
🔲 Well Integrity Lifecycle
🔲 Cross-Platform
What We Learned ?
About ENV
Smarter Than Monkey, Meet APE
About ENV
● Between TensorFlow-CPU & TensorFlow-GPU
tensorflow (Intel® Core™ i7-7700 Processor)
4h 11 min / 25000 steps
tensorflow-gpu (GeForce® GTX 1060 WINDFORCE OC 3G)
1h 12 min / 25000 steps
Training with GPU is highly recommended.
About Annotation Tool
Smarter Than Monkey, Meet APE
Live Demo
VoTT Active Learning
Active Learning is very helpful for labeling.
About Measure
Smarter Than Monkey, Meet APE
Smarter Than Monkey, Meet APE
Deploy To Freeze Model
Convert checkpoint to freeze model (README.md)
Inference (Single Image)
Inference For Single Image
Detection
● Get a list of labels
● Make an assertion of specific condition
Fail
assertTrue('play button' in labels)
Case 1: Necessary
Fail
assertEqual(len(labels), 0)
Case 2: Not-Allowed
Inference For Single Image
● Advantage
○ Fast
○ Effective
It works, but not that smart.
Inference (F1 Measure)
F1 Measure
● With a general formula
○ Detection
○ Boxes information of ground truth
○ Confidence score
○ Precision / Recall
○ F1 Score
● F1 Score (Performance indicators)
Smarter Than Monkey, Meet APE
Label F1 Criteria F1 Score F1 Diff
back button 0 0.946 0.946
cancel button 0 0.969 0.969
check box 0 1.0 1.0
cover 0 0.955 0.955
pause button 0 0.882 0.882
play button 0 0.876 0.876
text button 0 0.949 0.949
overall 0 0.939 0.939
F1 Score - 1st Model
Label F1 Criteria F1 Score F1 Diff
back button 0.946 0.948 0.02
cancel button 0.969 0.979 0.1
check box 1.0 1.0 0
cover 0.955 0.998 0.043
pause button 0.882 1.0 0.118
play button 0.876 1.0 0.124
text button 0.949 0.949 0
overall 0.939 0.982 0.043
F1 Score - 2nd Model
Label F1 Criteria F1 Score F1 Diff
back button 0.948 0.939 -0.009
cancel button 0.979 0.981 0.002
check box 1.0 1.0 0
cover 0.998 0.98 -0.018
pause button 1.0 0.955 -0.045
play button 1.0 1.0 0
text button 0.949 0.956 0.007
overall 0.982 0.973 -0.009
F1 Score - 3rd Model
Do performance measurement ASAP.
About Label
Before
● Labeling guideline
○ Each elements -> Different labels
go off air buttoncancel button
Before After
allow button
cancel button
confirm button
delete button
deny button
download button
go off air button
ok button
Smarter Than Monkey, Meet APE
Why I'm here ?
After
● Labeling guideline
○ Each functional groups -> Different labels
Before After
allow button ok button
cancel button cancel button
confirm button ok button
delete button ok button
deny button cancel button
download button ok button
go off air button ok button
ok button ok button
ok button
Well, not bad
Keep minimizing labels
Model is more learnable than we thought.
We Lost All Annotations Of All Images
Before After
allow button text button
cancel button text button
confirm button text button
delete button text button
deny button text button
download button text button
go off air button text button
ok button text button
OMG, it’s really not that bad
Keep minimizing labels
Model is “really” more learnable than we thought.
About Color
Smarter Than Monkey, Meet APE
About Color
● Color is not that important to Testing
○ Button color
○ Text color
○ Background color
● Take a long shot, we converted the training into grayscale
About Color
● Set model config to read image by garyscale
model {
...
image_resizer {
fixed_shape_resizer {
...
convert_to_grayscale : true
}
}
}
15000 steps20000 steps
Smarter Than Monkey, Meet APE
Smarter Than Monkey, Meet APE
Grayscale training is a good choice.
A Quick Recap
Smarter Than Monkey, Meet APE
What We Want
✅ Continuous Integration
✅ Incremental Datasets
✅ Speed
✅ Well Integrity Lifecycle
🔲 Cross-Platform
Limitation
About Resolution
● Training dataset
○ Android Phone (Portrait mode)
○ 1080p 16:9
● POC
○ Android Tablet (Landscape mode)
○ iOS iPhone
Smarter Than Monkey, Meet APE
1136 x 6401920 x 1080 1536 x 2048
HTC Nexus 9iPhone SESamsung A7
300 x 300300 x 300 300 x 300
HTC Nexus 9iPhone SESamsung A7
200x200x 200x
HTC Nexus 9iPhone SESamsung A7
We are working on it and will update you soon.
Vision
Vision
● Conclusion
ML is not that far away from us.
● For Mobile
○ Libraries is easy to use
○ Detect speed of TensorFlow Lite is fast
○ As above, and also precise
About Localization Testing
Smarter Than Monkey, Meet APE
Localization Testing
● Optical Character Recognition System
● Flow
○ Set language
○ Test & Detect
○ Assert specific language string
登入 KKBOX
Login to KKBOX
ログイン
About Page Object
Smarter Than Monkey, Meet APE
iPlayground@youtu.be/iKhC2oCgF4M
Vivian Liu @KKBOX
Design Patterns in XCUITest @iPlayground 2018
Page Object
class LoginPage {
init() {
# assertion of this page
expectExist(element: LoginButton)
}
func login() {
type(element: accountTextField)
type(element: passwordTextField)
click(element: loginButton)
}
}
Page Object
● Assertion with specific condition
○ isDisplay or isExist
■ On screen ?
■ On hierarchy ?
Page Object
● Assertion with object detection
● Truly exist and display on the screen
PlayerPage
assertTrue('play button' in labels)
LoginPage
assertTrue('login button' in labels)
Summary
APE
● TensorFlow Object Detection API
● Inference
● KKBOX APE with TensorFlow Lite
Recommended
● About Env
○ Ubuntu, with Nvidia GPU
● About Annotation
○ VoTT
● Optimization
○ Minimizing labels
○ Grayscale training
Vision
● What we thought
○ It’s helpful for Localization Testing
○ It’s helpful for Design Pattern
ML is not that far away from us.
Welcome to the ML world !
Let's do some brainstorming !
Smarter Than Monkey, Meet APE
facebook.com/TestingWithKK
Thanks

More Related Content

PDF
Siddha Ganju. Deep learning on mobile
PDF
Siddha Ganju, NVIDIA. Deep Learning for Mobile
PDF
"Solving Vision Tasks Using Deep Learning: An Introduction," a Presentation f...
PPTX
Transfer learning, active learning using tensorflow object detection api
PPTX
Teachableee Machine for great learners in unique way
PDF
Tensorflow on Android
PPTX
Deep learning on mobile - 2019 Practitioner's Guide
PDF
Weekly #106: Deep Learning on Mobile
Siddha Ganju. Deep learning on mobile
Siddha Ganju, NVIDIA. Deep Learning for Mobile
"Solving Vision Tasks Using Deep Learning: An Introduction," a Presentation f...
Transfer learning, active learning using tensorflow object detection api
Teachableee Machine for great learners in unique way
Tensorflow on Android
Deep learning on mobile - 2019 Practitioner's Guide
Weekly #106: Deep Learning on Mobile

Similar to Smarter Than Monkey, Meet APE (20)

PDF
ML in Android
PPTX
Ai in 45 minutes
PPTX
Deep learning on mobile
PPTX
Ml goes fruitful
PDF
Inteligencia artificial para android como empezar
PDF
Creating a custom ML model for your application - DevFest Lima 2019
PDF
Building a custom machine learning model on android
PDF
NUS-ISS Learning Day 2019-Deploying AI apps using tensor flow lite in mobile ...
PDF
Client side machine learning
PDF
Creating a Custom ML Model for your Application - Kotlin/Everywhere
PPTX
Key Insights Of Using Deep Learning To Analyze Healthcare Data | Workshop Fro...
PDF
Android+TensorFlow
PDF
Creating a custom Machine Learning Model for your applications - Java Dev Day...
PDF
Practical Deep Learning
PDF
“Deep Learning on Mobile Devices,” a Presentation from Siddha Ganju
PDF
An introduction to Machine Learning
PDF
Machine Learning Basics for Web Application Developers
PDF
Machine Learning on mobile devices
PDF
Introduction Machine Learning by MyLittleAdventure
PPTX
Keras on tensorflow in R & Python
ML in Android
Ai in 45 minutes
Deep learning on mobile
Ml goes fruitful
Inteligencia artificial para android como empezar
Creating a custom ML model for your application - DevFest Lima 2019
Building a custom machine learning model on android
NUS-ISS Learning Day 2019-Deploying AI apps using tensor flow lite in mobile ...
Client side machine learning
Creating a Custom ML Model for your Application - Kotlin/Everywhere
Key Insights Of Using Deep Learning To Analyze Healthcare Data | Workshop Fro...
Android+TensorFlow
Creating a custom Machine Learning Model for your applications - Java Dev Day...
Practical Deep Learning
“Deep Learning on Mobile Devices,” a Presentation from Siddha Ganju
An introduction to Machine Learning
Machine Learning Basics for Web Application Developers
Machine Learning on mobile devices
Introduction Machine Learning by MyLittleAdventure
Keras on tensorflow in R & Python
Ad

Recently uploaded (20)

PDF
Practical Indispensable Project Management Tips for Delivering Successful Exp...
DOCX
How to Use SharePoint as an ISO-Compliant Document Management System
PDF
CapCut PRO for PC Crack New Download (Fully Activated 2025)
PPTX
Python is a high-level, interpreted programming language
PPTX
Matchmaking for JVMs: How to Pick the Perfect GC Partner
PPTX
Cybersecurity-and-Fraud-Protecting-Your-Digital-Life.pptx
PPTX
Viber For Windows 25.7.1 Crack + Serial Keygen
PPTX
Introduction to Windows Operating System
DOC
UTEP毕业证学历认证,宾夕法尼亚克拉里恩大学毕业证未毕业
PDF
Type Class Derivation in Scala 3 - Jose Luis Pintado Barbero
PDF
AI-Powered Fuzz Testing: The Future of QA
PDF
AI/ML Infra Meetup | Beyond S3's Basics: Architecting for AI-Native Data Access
PDF
Visual explanation of Dijkstra's Algorithm using Python
PDF
MCP Security Tutorial - Beginner to Advanced
PPTX
CNN LeNet5 Architecture: Neural Networks
PDF
How Tridens DevSecOps Ensures Compliance, Security, and Agility
PPTX
HackYourBrain__UtrechtJUG__11092025.pptx
DOCX
Modern SharePoint Intranet Templates That Boost Employee Engagement in 2025.docx
PDF
MiniTool Power Data Recovery 12.6 Crack + Portable (Latest Version 2025)
PDF
AI Guide for Business Growth - Arna Softech
Practical Indispensable Project Management Tips for Delivering Successful Exp...
How to Use SharePoint as an ISO-Compliant Document Management System
CapCut PRO for PC Crack New Download (Fully Activated 2025)
Python is a high-level, interpreted programming language
Matchmaking for JVMs: How to Pick the Perfect GC Partner
Cybersecurity-and-Fraud-Protecting-Your-Digital-Life.pptx
Viber For Windows 25.7.1 Crack + Serial Keygen
Introduction to Windows Operating System
UTEP毕业证学历认证,宾夕法尼亚克拉里恩大学毕业证未毕业
Type Class Derivation in Scala 3 - Jose Luis Pintado Barbero
AI-Powered Fuzz Testing: The Future of QA
AI/ML Infra Meetup | Beyond S3's Basics: Architecting for AI-Native Data Access
Visual explanation of Dijkstra's Algorithm using Python
MCP Security Tutorial - Beginner to Advanced
CNN LeNet5 Architecture: Neural Networks
How Tridens DevSecOps Ensures Compliance, Security, and Agility
HackYourBrain__UtrechtJUG__11092025.pptx
Modern SharePoint Intranet Templates That Boost Employee Engagement in 2025.docx
MiniTool Power Data Recovery 12.6 Crack + Portable (Latest Version 2025)
AI Guide for Business Growth - Arna Softech
Ad

Smarter Than Monkey, Meet APE