วันอังคารที่ 15 พฤษภาคม พ.ศ. 2561

Speech Recognition with Android TensorFlow Machine Learning

Speech Recognition with Android TensorFlow Machine Learning


Runs a simple speech recognition model built by the audio training tutorial. Listens for a small set of words, and highlights them in the UI when they are recognized.

The example application displays a list view with all of the known audio labels,
and highlights each one when it thinks it has detected one through the
microphone.

About TensorFlow Machine Learning Library
https://androidcontrol.blogspot.com/2017/03/machine-learning-tensorflow-android-app.html

What is TensorFlow?
TensorFlow is open source machine learning library from Google. Computation code is written in C++, but programmers can write their TensorFlow software in either C++ or Python and implemented for CPUs ,GPUs or both.

In November 2015, Google announced and open sourced TensorFlow, its latest and greatest machine learning library. This is a big deal for three reasons:

1.Machine Learning expertise: Google is a dominant force in machine learning. Its prominence in search owes a lot to the strides it achieved in machine learning.
2.Scalable : the announcement noted that TensorFlow was initially designed for internal use and that it’s already in production for some live product features.
3.Ability to run on Mobile.

This last reason is the operating reason for this post since we’ll be focusing on Android. If you examine the tensorflow repo on GitHub, you’ll find a little tensorflow/examples/android directory. I’ll try to shed some light on the Android TensorFlow example and some of the things going on under the hood.

Original code 
https://github.com/tensorflow/tensorflow/tree/master/tensorflow/examples/android



Download Android App on Google Play




more Machine Learning TensorFlow Android App.





Reference
TensorFlow Android Demo Code
https://androidcontrol.blogspot.com/2017/09/android-flower-images-classifier-tensorflow.html



My Website
email : info@softpowergroup.net  ,amphancm@gmail.com
Tel .+6681-6452400 ( Thailand )

วันอาทิตย์ที่ 10 กันยายน พ.ศ. 2560

Android Flower Images Classifier with TensorFlow Machine Learning

Android Flower Images Classifier with TensorFlow Machine Learning 

About TensorFlow Machine Learning Library
In this blog, we will learn how to install and run TensorFlow on Android, and will train a simple classifier to classify images of flowers. 
Daisy , Dandelion , Roses , Tulip , Sunflowers

Let's Started


1.Get Android TensorFlow Demo Code

Google’s open source TensorFlow project includes a wonderfully documented demo Android app.
https://github.com/tensorflow/tensorflow




The demo app is really four apps, but we’re going to focus on the “TF Classify” only.
TF Classify opens your camera, and classifies whatever objects you show it. The really mind blowing thing is that this works totally offline — you do not need an internet connection. I had a lot of fun with this.
It prints out the object classification along with a confidence level (1.000 for perfect confidence, 0.000 for zero confidence). When your object fills most of the image, it often does pretty well.

Need Android Studio install


2.Bazel : Building the Android TensorFlow Demo Code


NOTE: Bazel does not currently support building for Android on Windows. Full support for gradle/cmake builds is coming soon, but in the meantime we suggest that Windows users download the prebuilt binaries instead.
Install Bazel and Android Prerequisites
Bazel is the primary build system for TensorFlow. To build with Bazel, it and the Android NDK and SDK must be installed on your system.
  1. Install the latest version of Bazel as per the instructions on the Bazel website.
  2. The Android NDK is required to build the native (C/C++) TensorFlow code. The current recommended version is 12b, which may be found here.
  3. The Android SDK and build tools may be obtained here, or alternatively as part of Android Studio. Build tools API >= 23 is required to build the TF Android demo (though it will run on API >= 21 devices).
Edit WORKSPACE
The Android entries in <workspace_root>/WORKSPACE must be uncommented with the paths filled in appropriately depending on where you installed the NDK and SDK. Otherwise an error such as: "The external label '//external:android/sdk' is not bound to anything" will be reported.
Also edit the API levels for the SDK in WORKSPACE to the highest level you have installed in your SDK. This must be >= 23 (this is completely independent of the API level of the demo, which is defined in AndroidManifest.xml). The NDK API level may remain at 14.
Build
After editing your WORKSPACE file to update the SDK/NDK configuration, you may build the APK. Run this from your workspace root:
bazel build -c opt //tensorflow/examples/android:tensorflow_demo
Install
Make sure that adb debugging is enabled on your Android 5.0 (API 21) or later device, then after building use the following command from your workspace root to install the APK:
adb install -r bazel-bin/tensorflow/examples/android/tensorflow_demo.apk

3.Install TensorFlow on your machine.
https://www.tensorflow.org/install/

What is TensorFlow?

need install Python 2.7 or 3.3+ and pip install first. and basic understand of linux command.


We have install TensorFlow on Macbook Pro OSX EI Caption Versions 10.11.4 . It work fine.
and use with Python 2.7


4.Prepare the Training Images and Retrain Model
We have follow details in codelabs
https://codelabs.developers.google.com/codelabs/tensorflow-for-poets/




5.Using our Model in an Android App
Now let’s make a couple minor changes to the Android project to use our custom model.

First, copy your model and labels into the project’s assets folder. Mine were at tf_files/retrained_graph.pb and  tf_files/retrain_labels.txt.
Next, open up ClassifierActivity, which can be found in:
tensorflow/examples/android/src/org/tensorflow/demo/ClassifierActivity.java

You’ll want to update the constants at the top of the file to define the settings for our new model. It looks like this when you first open it:


Change it to:

Hit run to build the project and load the APK on your device, and you’ve got your flowers classifier!




The Results 



Here’s a video


Reference
TensorFlow Android Demo Code
https://androidcontrol.blogspot.com/2017/09/android-flower-images-classifier-tensorflow.html



My Website
email : info@softpowergroup.net  ,amphancm@gmail.com
Tel .+6681-6452400 ( Thailand )

วันอาทิตย์ที่ 30 กรกฎาคม พ.ศ. 2560

Android and ESP8266 IoT with FireBase Realtime Database



Android and ESP8266 IoT with FireBase Realtime Database

In this project we will sent temperature and humidity data to firebase realtime database and monitor them on android device. This is a basic for internet of things application.

System Diagram

Hardware

1.ESP8266 WiFi Module or NodeMCU ( We use ESP8266 12E )
2.Temperature and Humidity Sensor DHTxx ( we use DHT22 or AM2302 )
3.OLED Display for Option

Wiring Diagram






more info about hardware

Firebase Setting

Android Code
comming soon

ESP8266 Code
https://github.com/amphancm/ESP8266-Firebase

Arduino Library
Firebase Arduino Library
WiFi Connector
DHT Sensor
Adafriut GFX ( OLED Display )


Reference
        • Firebase Arduino [GitHub]
        • Firebase Arduino - Documentation

My Website
email : info@softpowergroup.net  ,amphancm@gmail.com
Tel .+6681-6452400 ( Thailand )


วันจันทร์ที่ 13 มีนาคม พ.ศ. 2560

Machine Learning Tensorflow Android App Demo

Machine Learning TensorFlow Android App Demo

What is TensorFlow?
TensorFlow is open source machine learning library from Google. Computation code is written in C++, but programmers can write their TensorFlow software in either C++ or Python and implemented for CPUs ,GPUs or both.


In November 2015, Google announced and open sourced TensorFlow, its latest and greatest machine learning library. This is a big deal for three reasons:
  1. Machine Learning expertise: Google is a dominant force in machine learning. Its prominence in search owes a lot to the strides it achieved in machine learning.
  2. Scalable : the announcement noted that TensorFlow was initially designed for internal use and that it’s already in production for some live product features.
  3. Ability to run on Mobile.
This last reason is the operating reason for this post since we’ll be focusing on Android. If you examine the tensorflow repo on GitHub, you’ll find a little tensorflow/examples/android directory. I’ll try to shed some light on the Android TensorFlow example and some of the things going on under the hood.



Install TensorFlow on your System ( PC or Notebook , Windows or mac )

It has many method to install

  • virtualenv
  • pip
  • Docker
  • installing from sources

We use pip method first.



Installing with native pip


Python
In order to install TensorFlow, your system must contain one of the following Python versions:

  • Python 2.7
  • Python 3.3+

Pip installs and manages software packages written in Python. If you intend to install with native pip, then one of the following flavors of pip must be installed on your system:
  • pip, for Python 2.7
  • pip3, for Python 3.n.
pip or pip3 was probably installed on your system when you installed Python. To determine whether pip or pip3 is actually installed on your system, issue one of the following commands:
$ pip -V  # for Python 2.7
$ pip3 -V # for Python 3.n 

We strongly recommend pip or pip3 version 8.1 or higher in order to install TensorFlow. If pip or pip3 8.1 or later is not installed, issue the following commands to install or upgrade:
$ sudo easy_install --upgrade pip
$ sudo easy_install --upgrade six 

Install Bazel
https://bazel.build/versions/master/docs/install.html


Building the Demo from Source

git clone --recurse-submodules https://github.com/tensorflow/tensorflow.git


Build the Android APK 
$ cd ~/tensorflow
$ bazel build //tensorflow/examples/android:tensorflow_demo

Install the APK to Android devices
$ adb install -r -g bazel-bin/tensorflow/examples/android/tensorflow_demo.apk
Reference



วันอาทิตย์ที่ 8 มกราคม พ.ศ. 2560

Android Gauge View Example Code


Android Gauge View Example Code

We have  test 3 example source code.
1.GaugeView
2.CustomGauge
3.SC-widgets


 

GaugeView


An Android library for drawing gauges on Canvas.
https://github.com/CodeAndMagic/GaugeView


 

CustomGauge



update some code in build.gradle

buildscript {
    repositories {
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:2.2.3'        classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.4'        classpath 'com.github.dcendents:android-maven-gradle-plugin:1.4.1'

        // NOTE: Do not place your application dependencies here; they belong        // in the individual module build.gradle files    }
}


SC-widgets


This is a library of widgets.
The 2.x version change completely the way to draw using the ScDrawer as base for create the ScGauge and all classes inherited from it. This using a path to follow and applying some features to draw extra on the path. This way to think leaves a lot of freedom to the users to create particular components limited only by his imagination.
https://github.com/Paroca72/sc-widgets


My Website
email : info@softpowergroup.net   Tel .081-6452400

วันพฤหัสบดีที่ 15 ธันวาคม พ.ศ. 2559

Android Things with Raspberry Pi Board


Android Things with Raspberry Pi Board

What is Android Things?

On 13 December 2016,
Google launched a version of Android called Android Things.
Android Things (formerly known as Brillo)

Android Things are IoT Platform for Android Developer.Use Development tools and ecosystem the same Android App Development. So you can use Android Studio to develop Android Things.
and without previous knowledge of embedded system design.


Understand the Android Things Platform
Android Things has a few key differences compared to the core Android OS, read the Overview to understand key concepts that you'll need to understand.



Hardware Supported

Intel Edison
NXP Pico
Raspberry Pi 3

Software

Android Things SDK Preview!  https://developer.android.com/things/preview/index.html

Google has released the SDK preview of Android Things.
You can learn more about that (and key Android Things concepts)
Unfortunately,
we’re not entirely sure when the full version will go live just yet.

Getting Started with Android Things


Make your IoT Hardware

Download Flash image Android Things.
For Raspberry Pi image

Then copy image to SD card
use SDCardFormatter tools or other tools ( Raspberry Pi Tools )


Connect the Hardware
How to connect to your Development Board. ( we use raspberry pi 3 board )
We use Ethernet or LAN cable first. ( If you want to use WiFi, it's more complicate than Ethernet )

Raspberry Pi wiring diagram






Set Up Your Development Environment

Download Android Studio ( if you don't have yet )
and if Android Studio is old version then update to new.

( SDK tools version 24 or higher )

Connect your board and verify you can access the device via adb command

use Ethernet or LAN Cable First.

$ adb connect <ip-address>:5555
connected to <ip-address>:5555

Open Android Studio

Open Sample Code Download Example Code

Then Run Code

see on VDO



My Website
email : info@softpowergroup.net   Tel .081-6452400