Part Two Series.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) |
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:
Post a Comment