"No one is harder on a talented person than the person themselves" - Linda Wilkinson ; "Trust your guts and don't follow the herd" ; "Validate direction not destination" ;

November 07, 2018

Day # 147 - Part II - Deep Learning techniques for Computer Vision applied to embedded systems

A very interesting Final Year Paper - Deep Learning techniques for Computer Vision applied to embedded systems

Part Two Series.

import tensorflow as tf
from tensorflow import keras
model = keras.Sequential()
model.add(keras.layers.Dense(64,activation='relu'))
model.add(keras.layers.Dense(64,activation='relu'))
model.add(keras.layers.Dense(10,activation='softmax'))
model.compile(optimizer=tf.train.AdamOptimizer(0.001),loss='categorical_crossentropy',metrics=['accuracy'])
import numpy as np
data = np.random.random((1000,32))
labels = np.random.random((1000,10))
model.fit(data,labels,epochs=10,batch_size=32)
view raw keras1.py hosted with ❤ by GitHub
import tensorflow as tf
#load mnist dataset
mnist = tf.keras.datasets.mnist
#split into train and test
(x_train,y_train),(x_test,y_test)=mnist.load_data()
x_train,x_test=x_train/255.0,x_test/255.0
#composing the model
model = tf.keras.models.Sequential([tf.keras.layers.Flatten(),
tf.keras.layers.Dense(512,activation=tf.nn.relu),
tf.keras.layers.Dropout(0.2),
tf.keras.layers.Dense(10,activation=tf.nn.softmax)])
#configuring training parameters
model.compile(optimizer='adam',loss='sparse_categorical_crossentropy',metrics=['accuracy'])
#start training
model.fit(x_train,y_train,epochs=5)
#evaluating the model
model.evaluate(x_test,y_test)
view raw keras2.py hosted with ❤ by GitHub
Creating a custom Object Detector Machines

Steps Involved
  • Dataset Preperation (Download images using - Fatkun Batch Download Images)
  • Label Images by Hand (Painful process) - RectLabel Tool for manually labelling
  • Convert into .tfrecords - Custom Tensorflow code to prepare .tfrecords
  • Create labels with .pbtxt format
  • Create bounding boxes
  • Set TF Object Detection API
  • Create Pipeline for Training - Configure model, train_config, train_input_header, eval_config, eval_input_reader
  • Perform Training
  • Monitor Performance
  • Export Graph
  • Compile for Vision Bonnet
  • Deploy and Test
This is the first and most exhaustive step-by-step documentation neatly mentioned.

Happy Learning!!!

No comments: