running TensorFlow Machine Learning for Image Recognition on Oracle Cloud Infrastructure

Machine Learning in Brief

Machine learning is an application of Artificial intelligence (AI) that provides systems the ability to automatically learn and improve from experience without being explicitly programmed. Machine learning focuses on the development of computer programs that can access data and use it learn for themselves.

The process of learning begins with observations or data, such as examples, direct experience, or instruction, in order to look for patterns in data and make better decisions in the future based on the examples that we provide. The primary aim is to allow the computers learn automatically without human intervention or assistance and adjust actions accordingly. 

 
TensorFlow™ is an open source software library for numerical computation using data flow graphs. Nodes in the graph represent mathematical operations, while the graph edges represent the multidimensional data arrays (tensors) communicated between them. The flexible architecture allows you to deploy computation to one or more CPUs or GPUs in a desktop, server, or mobile device with a single API.
 
TensorFlow was originally developed by researchers and engineers working on the Google Brain Team within Google’s Machine Intelligence research organization for the purposes of conducting machine learning and deep neural networks research, but the system is general enough to be applicable in a wide variety of other domains as well.
 

Machine Learning from Image Processing

How often you come across use cases where images need to be recognized and meaningful data is generated from these images, example it can be as simple as identifying an abnormality is growth of tissues or bones that if recognized can help in identifying and curing the disorder in early stage

Goal

the goal of this blog is to create a TensorFlow Machine Learning environment and to analyze an image rather do an image recognition

Setup ML Environment

Login to Bitnami Console and Create an Instance of TensorFlow from the following link

In this case we will select TensorFlow Serving v1.5.0.1

within few mins this should create instance on Oracle Cloud

SSH into TensorFlow Invironment

Download Public and Private Key

ssh -i bitnami-opc-a457995.pem bitnami@publicIP

Let us study this first image, let TensorFlow use its ML Algorithms to figure out which image is this

 
bitnami@ubuntu:/tmp$ curl -LO 'https://d1u4oo4rb13yy8.cloudfront.net/article-sddntirixr-1442081001.jpeg'
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100  102k  100  102k    0     0  14735      0  0:00:07  0:00:07 --:--:-- 50014
bitnami@ubuntu:/tmp$ inception_client --image=article-sddntirixr-1442081001.jpeg
outputs {
  key: "classes"
  value {
    dtype: DT_STRING
    tensor_shape {
      dim {
        size: 1
      }
      dim {
        size: 5
      }
    }
    string_val: "vault"
    string_val: "triumphal arch"
    string_val: "monastery"
    string_val: "mosque"
    string_val: "altar"
  }
}
outputs {
  key: "scores"
  value {
    dtype: DT_FLOAT
    tensor_shape {
      dim {
        size: 1
      }
      dim {
        size: 5
      }
    }
    float_val: 8.59596157074
    float_val: 8.14022350311
    float_val: 7.99082612991
    float_val: 7.0765748024
    float_val: 6.69686365128
  }
}

Let us use one more image to Analyze

bitnami@ubuntu:/tmp$ curl -LO 'https://spiderimg.amarujala.com/assets/images/2018/03/22/750x506/brahmos_1521703360.jpeg'
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100 68380  100 68380    0     0  13513      0  0:00:05  0:00:05 --:--:-- 1804k
bitnami@ubuntu:/tmp$ inception_client --image=brahmos_1521703360.jpeg
outputs {
  key: "classes"
  value {
    dtype: DT_STRING
    tensor_shape {
      dim {
        size: 1
      }
      dim {
        size: 5
      }
    }
    string_val: "missile"
    string_val: "projectile, missile"
    string_val: "airliner"
    string_val: "warplane, military plane"
    string_val: "wing"
  }
}
outputs {
  key: "scores"
  value {
    dtype: DT_FLOAT
    tensor_shape {
      dim {
        size: 1
      }
      dim {
        size: 5
      }
    }
    float_val: 9.67117881775
    float_val: 9.28978347778
    float_val: 7.33030891418
    float_val: 5.74678897858
    float_val: 4.2038693428
  }
}

bitnami@ubuntu:/tmp$ 

Blog Author

Madhusudhan Rao