TensorFlow Deep Dive

TensorFlow

TensorFlow is an open-source machine learning framework developed by Google. It excels in numerical computation using dataflow graphs.

Let's discuss little bit about TensorFlow ...It is a libre open source software which is also said to be "FLOSS" and originated via Google researchers and scientists. Generally we utilized it to speed the machine learning, deep learning and other various arithmetical forecasting or prescriptive analytics consignments.

Tensorflow also depicted to prune the procedure over generating and implementing proceeded data interpretation approach like prediction, forecasting, arithmetical and data science modellers. A modeller that create theoretical descriptions of techniques or procedure for the prediction and development.

Python
# firstly we need to import required libraries
import tensorflow as tf
from tensorflow import keras
import matplotlib.pyplot as plt
import numpy as np

Here, TensorFlow software manipulate a collection of data which generally positioned even as a computational vertex in tabulation or graphical shape, we can say. Let's understand, What is tensor? In general, Tensor is a tabulation in which we produce the outline and vertex that can depict the multidimensional matrices or vertex especially where very large dataset computations accomplished like neural network.

Python
tf.config.experimental.list_logical_devices()

[LogicalDevice(name='/device:CPU:0', device_type='CPU'),
  LogicalDevice(name='/device:GPU:0', device_type='GPU')]

πŸ“Š Numpy Integration

Now let's gain some info regarding the strongest library of python i.e numPy. So Numpy, we can say one of the very influencive libraries in Python libraries, and afterthat consistency and unification in the data structure provided via Tensorflow efficiently. Accordingly, we can say integrated Tensorflow enables us to build complex input pipelines, null chunks. For example NDarrays, the library's initial datatype, which spontaneously converted into TensorFlow Tensors in TF operations; similar we can say also vericious or else vice-versa.

☁️ Google Colab

As I am using Colab, released via Google, a TensorFlow Jupyter notebook environment which is not demanding any updation. We can use it in browser also. that provides free access to GPUs and the storage and also share notebooks on Google Drive.

Python
# Now let's splitting the data into training dataset and testing dataset from tensorflow
(X_train, y_train), (X_test,y_test) = tf.keras.datasets.cifar10.load_data()

🧠 Model Architecture

Convolutional layer: CNN Layer is used to process the image β€” used for convolutional neural networks.

MaxPooling layer: MaxPooling layer used to down-sampling attribute by taking the maximum value in non-overlapping rectangular blocks.

Flatten layer: Flatten layer used to flattens the multi-dimensional input tensors into a single dimension.

Python
model = keras.Sequential([
  keras.layers.Flatten(input_shape=(32,32,3)),
  keras.layers.Dense(3000, activation='relu'),
  keras.layers.Dense(1000, activation='relu'),
  keras.layers.Dense(10, activation='sigmoid')
])

model.compile(
  optimizer='SGD',
  loss='categorical_crossentropy',
  metrics=['accuracy']
)
Training Output
Epoch 1/5
1563/1563 [==============================] - 8s 4ms/step - loss: 1.8099 - accuracy: 0.3551
Epoch 2/5
1563/1563 [==============================] - 6s 4ms/step - loss: 1.6204 - accuracy: 0.4269
Epoch 5/5
1563/1563 [==============================] - 6s 4ms/step - loss: 1.4297 - accuracy: 0.4969

⚑ CPU vs GPU Performance

CPU: 6min 32s
Epoch 5/5: accuracy: 0.4964
GPU: 42.6s βœ…
Epoch 5/5: accuracy: 0.4923

πŸš€ Applications

πŸ₯ Medical

As per analysis, medical growing vastly in AI field... GE Healthcare utilizing TensorFlow to enhance the velocity and accuracy of MRIs to identify distinct body parts. Google utilized TensorFlow to create DermAssist, a free mobile application which permits users to capture images of their skin and spot future health complications. Sinovation Ventures utilized TensorFlow to spot and classify eye diseases from optical coherence tomography (OCT) scans.

πŸ“± Social media

Let's discuss about twitter, Twitter executed TensorFlow to rank tweets by noteworthiness for a specified user, and replaced its podium to be visible tweets in sequence this ranking. Priorly, tweets were directly shown in transpose chronological order. The photo sharing app VSCO utilixed TensorFlow to assist suggest custom filters for pictures.

πŸ” Search Engine

Google officially released RankBrain on October 26, 2015, backed by TensorFlow.

πŸŽ“ Education

InSpace, a virtual learning podium, generally utilized TensorFlow to extract toxic chat messages in classrooms. Liulishuo, an online English learning platform, mostly utilizes TensorFlow to generate an adjustabe schedule for each and every student.

πŸ“š References

1. TensorFlow: Open source machine learning. Google. 2015.
2. Wikipedia
3. Abadi, MartΓ­n et al. (2016). TensorFlow: A System for Large-Scale Machine Learning.
Python
# Import required libraries
import tensorflow as tf
from tensorflow import keras
import matplotlib.pyplot as plt
import numpy as np
Python
tf.config.experimental.list_logical_devices()

[LogicalDevice(name='/device:CPU:0', device_type='CPU'),
  LogicalDevice(name='/device:GPU:0', device_type='GPU')]
Python
model = keras.Sequential([
  keras.layers.Flatten(input_shape=(32,32,3)),
  keras.layers.Dense(3000, activation='relu'),
  keras.layers.Dense(1000, activation='relu'),
  keras.layers.Dense(10, activation='sigmoid')
])

model.compile(
  optimizer='SGD',
  loss='categorical_crossentropy',
  metrics=['accuracy']
)
Training Output
Epoch 1/5
1563/1563 [==============================] - 8s 4ms/step - loss: 1.8099 - accuracy: 0.3551
Epoch 5/5
1563/1563 [==============================] - 6s 4ms/step - loss: 1.4297 - accuracy: 0.4969

πŸ€– Real-World Applications

πŸ₯ Medical

GE Healthcare uses TensorFlow for faster MRIs. Google created DermAssist for skin analysis.

πŸ“± Social Media

Twitter ranks tweets by relevance. VSCO suggests custom filters using TensorFlow.

πŸ” Search Engine

Google RankBrain powered by TensorFlow since 2015.