Wednesday, November 11, 2020

Virtual Reality devices and its real time applications

          

 
    Over the last few years there has been a large movement to produce virtual reality technology that allows users to experience video and images in an immersive atmosphere right from their home. Many different companies have entered the arena at a wide range of prices and it seems another technological war is on. Each one of the devices on the market, though, gives you an experience like nothing you have had at home before.

VR Devices

            There are a few major brands when it comes to finding virtual reality equipment. Samsung, Google, and Oculus Rift are some of the major competitors. Here are brief descriptions of the products.

Samsung Gear VR

            Samsung offers the Gear VR which is a good headset for being easy to use. It uses Oculus Rift as the backbone for it but connects to a Samsung Galaxy to run and display. There is a slot at the front of the device that allows you to just slide your Samsung Galaxy in. The one major issue with Samsung Gear VR is that it is restrictive, you can only use a Samsung Galaxy phone and apps that support it.

Google Cardboard

            Google may just be one of the most interesting introductions into the VR world. Google found itself challenged by other tech innovators who were releasing expensive VR devices. Half-jokingly, Google decided that it could produce a superior product that cost less and was made out of cardboard. And Google Cardboard was born. Google Cardboard is easy to use and there are a wide variety of different manufacturers out there so you are almost guaranteed to be able to find one that works with your phone. Many of them are universal.
            The amazing part of Google Cardboard is that it is literally made of a piece of cardboard and gives an incredible immersive 3d experience. Similar to the Samsung Gear, you slide your phone in the front of the device and your phone does all the work, splitting the screen in two so your eyes can see in 3d. An entire YouTube channel already exists with 360 degree videos that you can use your head movement to navigate through.
Unlike the Samsung Gear, Google Cardboard will allow you to use any device as long as you install the Cardboard app.

Oculus Rift

            Oculus Rift is the company that Kickstarted their way into the virtual reality world. While other companies had been maintaining a low profile on their VR devices Oculus launched a Kickstarter campaign to create their devices. The campaign was successfully funded but the Rift has been in development and pre-order for years. The expected launch is Q1 of this year.
Some of the other competitors or upcoming competitors include:

How These Devices Will Change The World

            All of these virtual reality devices will no doubt change the gaming and movie industries. Slowly over the next few years you will start to be immersed in entertainment in ways that you never thought were possible. It will take a little bit of time for development and filming to completely switch over VR compatible technology but when it does you will see games and movies as if you were actually there, without outside distractions.
It is going to do more than that though. Here are a few more ways it will change the world:

Real Estate, Design, and Development

            Virtual reality equipment will allow you to see what you are looking at in immersive three definition. That means that you can share real life real estate with people across the world and they can feel like they are actually there, touring the location with you. You can also share your digitally created plans like they are real. Imagine being able to walk around that new floorplan for your home or office before you make any purchases.

Body Swapping

         Scientists at the Imperial College London have been working on a way that you can use VR equipment to feel like you are someone else. Using the goggles you are able to see what someone else sees. Electrical diodes deliver the electrical impulses across your body to allow you to even feel what the other person is feeling. While the system isn't perfect yet, it is amazing technology that could make us be able to literally "walk in someone else's shoes."

Medical Uses

            VR is already being used to treat people around the world for Post-Traumatic Stress Disorder and other mental problems. Virtual reality equipment allows people to confront the issues that are holding them back or causing the stress. It even allows autistic people to learn about social cues and norms. There are also people who are developing ways to use VR technology to practice surgery and other medical procedures.
        These purposes for virtual reality are just starting to scratch the surface in what is possible. As it continues to develop and bugs are worked out the whole world will start to notice the changes from VR technology. Taking us to new worlds, both imagination based and reality based.
Share:

Android AOSP source code file structure and build system


Android AOSP source code file structure and build system

To download Android source code please refer to Android page 

AOSP directories

ART ART is an acronym of Android RunTime and it has been introduced in the Android 4.4 Kitkat as an alternative to the Dalvik Virtual Machine. It has completely replaced Dalvik in Android 5.0 Lollipop. The old Dalvik VM was based on a Just-In-Time (JIT) compiler technology, that is, it interprets and compiles an application source code into machine code in real time. ART is based on an AOT (Ahead-of-time) technology, which compiles all the application code at the time of application installation, that is, before the execution. That obviously requires more time to install the application, but that time is usually imperceptible seeing the hardware performance of the latest Android devices.

bionic Bionic is the C-runtime for Android.

build This directory contains the whole Android build system. It contains all the makefile core templates. Besides that, it contains envsetup.sh, a script that allows the developer to work with Android sources without struggling with environment management.

external All the packages regarding open source projects used by Android can be found in this directory. It contains various libraries as well as very important utilities such as zlib, SQLite, and webkit.

device Here you can find all the configurations and definitions for specific devices. 

frameworks This folder is very important because it contains the source code for the Android framework. It is here that you can find all the main components of Android such as Activity, Services, and so on. Here you can also find the mapping used between the native code in C/C++ and the code in Java.

packages As the folder name says, here you can find all the standard Android application packages, for example, Camera, Calculator, Dialer, Launcher, Settings, and so on.

system The system/ directory contains the source code of the Android system core, that is a minimal Linux system that takes care of the initialization of the device before the ART virtual machine starts any Java-based service.

abi : This is the source file for libgabi++.

bootable: This includes the boot and startup related code.

cts: This directory contains the code for the compatibility test suite.

dalvik: This directory contains the code for the Dalvik virtual machine.

development: This directory contains development tools—the source code of the SDK and the NDK.

hardware: This folder contains HAL (Hardware Abstraction Layer), libraries that enable interfacing with the device hardware.

libcore: This directory contains Apache Harmony.

ndk: This directory contains the script to generate the Native Development Kit, that allows the use of the native code written in C/C++ from Android applications.

pdk: This is the Platform Development Kit, a set of utilities that Google sends to various OEMs so that they can update their own frameworks before important system updates

prebuilts: This directory contains precompiled files, including various toolchain versions.

sdk: This is the Software Development Kit.

tools: These are some external IDE tools.

 Android build commnds

~$ . build/envsetup.sh

~$ lunch sdk-eng

~$ make

make –j8

The building system will fire up, looking for all those modules and Android.mk files to include into the build process and perform the compilation.

make –j8 showcommands

With this extra parameter, the build system will print all GCC compilation logs and all javaccompilation logs, to give you as much information as possible during the building process.

Building a module

make art

Cleaning a module

make clean-<module>

Cleaning everything

make clean

Listing modules

make modules

This command shows the list of every module available in the AOSP architecture. 

make snod

This command recreates the system images, based on the current status of the source base, using an incremental building approach

make module_name snod

Building tools

make tools

Related :


The following command will create and provide us with two of the most important tools for an Android expert—adb and fastboot:

Fastboot

Fastboot is the tool that Android gives us to manipulate the device Flash Memory and its partitions, using a computer and an USB connection.

Fastboot does not communicate with the Android system. It communicates with a specific firmware able to interact in a minimal system environment: bootloader mode.

flash: This option is used to deploy a new binary system image from the host computer to the device partitions

erase: This option is used to delete a specific partition

reboot: This option is used to reboot the device in one of the available booting modes: recovery, bootloader, or standard

format: This option is used to format a specific partition

Creating a custom device

Let's create our own manufacturer and device folders: 
mkdir –p device/irarref/f488

Android.mk: Describes in a generic way how to compile the source files.

AndroidProducts.mk: This file contains a PRODUCS_MAKEFILEs variable, with a list of all the available products.

full_f488.mk: This file specifies any relevant information about the device
BoardConfig.mk: This file specifies any relevant information about the device board.
vendorsetup.sh: This script makes the device available to envsetup.sh and lunch.

An overview of Android recovery

As we know, the so-called Recovery is a minimal runtime system, completely decoupled from the main Android system and totally self-sufficient. Its main goal is to guarantee system integrity and provide the necessary tools to fix common minor issues and restore a properly working system.

With an Android vanilla Recovery, we can:

  • Update the Android system
  • Wipe the data partition and the cache partition

The Android Recovery system is completely standalone. This means that whatever might happen to the main Android system, recovery will be always able to restore a working system.

To achieve this level of resilience, recovery contains its own Linux kernel and its own rootfs. 

The Android Recovery system is completely standalone. This means that whatever might happen to the main Android system, recovery will be always able to restore a working system.

To achieve this level of resilience, recovery contains its own Linux kernel and its own rootfs. 

Recovery mode can be accessed with a button combination when the device is turned off. The options you will find in the recovery menu could vary, but an Android vanilla recoverywill definitely provide these options:

  • Reboot system now: This option will restart the system.
  • Apply update from ADB: Android Debug Bridge can be used from a host computer to upload an official Google system update. Only certified updates can be uploaded and applied this way due to security measures enforced by the recovery to guarantee system integrity.
  • Wipe cache partition: This option will erase the cache partition. This partition usually contains the system's temporary data and app cache data. Deleting this file will free quite an amount of disk space, without losing user data or apps.
  • Wipe data/factory reset: This option will erase the volatile memory and restore the original factory system. Everything that is not strictly system-related will be deleted: videos, music, documents, user apps, and so on. The cache partition will be erased as well.

The most popular recovery alternatives are:

  • Clockworkmod
  • 4EXT
  • Amon Ra Recovery
  • Team Win Recovery Project (TWRP)

Please share your feedback about this blog. If you liked it please share with others

Related :

Share:

Thursday, November 5, 2020

Tensorflow Tutorial for Beginners



         TensorFlow is Google’s framework for deep learning.
 Deep learning algorithms have been used for several years across many products and areas at Google, such as search, translation, advertising, computer vision, and speech recognition. TensorFlow is, in fact, a second-generation system for implementing and deploying deep neural networks at Google

        TensorFlow was released to the public as an open source framework with an Apache 2.0 license in November 2015 and has already taken the industry by storm, with adoption going far beyond internal Google projects.

Using TensorFlow for AI Systems

  • One primary area where deep learning is truly shining is computer vision. A fundamental task in computer vision is image classification—building algorithms and systems that receive images as input, and return a set of categories that best describe them. 
  • One exciting area of deep learning research for building machine intelligence systems is focused on generating natural language descriptions for visual content. Like seeing the image and explaining what is there in the image.
  • Natural language understanding (NLU) is a key capability for building AI systems.  One of the most sought-after abilities is to summarize text, taking long documents and generating succinct and coherent sentences that extract the key information from the original texts

A High-Level Overview

        Tensors are the standard way of representing data in deep learning. Simply put, tensors are just multidimensional arrays, an extension of two-dimensional tables (matrices) to data with higher dimensionality.

        In TensorFlow, computation is approached as a dataflow graph.Broadly speaking, in this graph, nodes represent operations (such as addition or multiplication), and edges represent data (tensors) flowing around the system. 


        TensorFlow, in the most general terms, is a software framework for numerical computations based on dataflow graphs. It is designed primarily, however, as an interface for expressing and implementing machine learning algorithms, chief among them deep neural networks.

        The core of TensorFlow is in C++, and it has two primary high-level frontend languages and interfaces for expressing and executing the computation graphs. The most developed frontend is in Python, used by most researchers and data scientists.

Installing TensorFlow

        If you are using a clean Python installation (probably set up for the purpose of learning TensorFlow), you can get started with the simple pip installation

$ pip install tensorflow

This approach does, however, have the drawback that TensorFlow will override existing packages and install specific versions to satisfy dependencies. If you are using this Python installation for other purposes as well, this will not do. One common way around this is to install TensorFlow in a virtual environment, managed by a utility called virtualenv.

$ pip install virtualenv

In order to install TensorFlow in a virtual environment, you must first create the virtual environment.

$ cd ~
$ mkdir envs
$ virtualenv ~/envs/tensorflow


This will create a virtual environment named tensorflow in ~/envs (which will manifest as the folder ~/envs/tensorflow). To activate the environment, use:

$ source ~/envs/tensorflow/bin/activate
The prompt should now change to indicate the activated environment:

(tensorflow)$
At this point the pip install command:

(tensorflow)$ pip install tensorflow
will install TensorFlow into the virtual environment, without impacting other packages installed on your machine.


Finally, in order to exit the virtual environment, you type:

(tensorflow)$ deactivate

Simple hello world (helloWorld.py)

import tensorflow as tf
h = tf.constant("Hello")
w = tf.constant(" World!")
hw = h + w
with tf.Session() as sess:
    ans = sess.run(hw)

Computation Graphs

        TensorFlow allows us to implement machine learning algorithms by creating and computing operations that interact with one another. These interactions form what we call a “computation graph,” with which we can intuitively represent complicated functional architectures.
        In TensorFlow, each of the graph’s nodes represents an operation, possibly applied to some input, and can generate an output that is passed on to other nodes.
TensorFlow involves two main phases: 
  1. Constructing a graph 
  2. Executing it.

Constructing and Managing Our Graph

        As we import TensorFlow, a default graph is automatically created for us. We can create additional graphs and control their association with some given operations. tf.Graph() creates a new graph, represented as a TensorFlow object. 

import tensorflow as tf
print(tf.get_default_graph())
g = tf.Graph()
print(g)


Out:
<tensorflow.python.framework.ops.Graph object at 0x7fd88c3c07d0>
<tensorflow.python.framework.ops.Graph object at 0x7fd88c3c03d0>

Data Types

    The basic units of data that pass through a graph are numerical, Boolean, or string elements. 

c = tf.constant(4.0, dtype=tf.float64) 

print(c) 

print(c.dtype) 


Out: Tensor("Const_10:0", shape=(), dtype=float64) <dtype: 

'float64'>

Data type

Python type

Description

DT_FLOAT

tf.float32

32-bit floating point.

DT_DOUBLE

tf.float64

64-bit floating point.

DT_INT8

tf.int8

8-bit signed integer.

DT_INT16

tf.int16

16-bit signed integer.

DT_INT32

tf.int32

32-bit signed integer.

DT_INT64

tf.int64

64-bit signed integer.

DT_UINT8

tf.uint8

8-bit unsigned integer.

DT_UINT16

tf.uint16

16-bit unsigned integer.

DT_STRING

tf.string

Variable-length byte array. Each element of a Tensor is a byte array.

DT_BOOL

tf.bool

Boolean.

DT_COMPLEX64

tf.complex64

Complex number made of two 32-bit floating points: real and imaginary parts.

DT_COMPLEX128

tf.complex128

Complex number made of two 64-bit floating points: real and imaginary parts.

DT_QINT8

tf.qint8

8-bit signed integer used in quantized ops.

DT_QINT32

tf.qint32

32-bit signed integer used in quantized ops.

DT_QUINT8

tf.quint8

8-bit unsigned integer used in quantized ops.

Tenserflow Operations

TensorFlow operation

Description

tf.constant(value)

Creates a tensor populated with the value or values specified by the argument value

tf.fill(shapevalue)

Creates a tensor of shape shape and fills it with value 

tf.zeros(shape)

Returns a tensor of shape shape with all elements set to 0

tf.zeros_like(tensor)

Returns a tensor of the same type and shape as tensor with all elements set to 0

tf.ones(shape)

Returns a tensor of shape shape with all elements set to 1

tf.ones_like(tensor)

Returns a tensor of the same type and shape as tensor with all elements set to 1

tf.random_normal(shape,meanstddev)

Outputs random values from a normal distribution

tf.truncated_normal(shape,meanstddev)

Outputs random values from a truncated normal distribution (values whose magnitude is more than two standard deviations from the mean are dropped and re-picked)

tf.random_uniform(shape,minvalmaxval)

Generates values from a uniform distribution in the range [minvalmaxval)

tf.random_shuffle(tensor)

Randomly shuffles a tensor along its first dimension 

Related topics:

Introduction to Artificial Intelligence (AI) and Machine Learning

Python tutorial for beginners(Python Basics)

Best Tenserflow related book :

Learn TensorFlow 2.0: Implement Machine Learning and Deep Learning Models with Python

Pro Deep Learning with TensorFlow: A Mathematical Approach to Advanced Artificial Intelligence in Python

You may also like :

Internet of Things (IOT) Basics

Android Basic Concepts

Did you find our blog helpful ? Share in comment section. Feel free to share on Twitter or Facebook by using the share buttons

Share:

Popular Posts

Contact Form

Name

Email *

Message *

Pages