1.1 Clone this repo using this command:
git clone https://github.com/nicknochnack/RealTimeObjectDetection
2.1 Clone this repo inside e.g. "Drowsiness/Tensorflow" using this command:
git clone https://github.com/tzutalin/labelImg
2.2 Setup labelImg for Windows:
conda install pyqt=5
conda install -c anaconda lxml
pyrcc5 -o libs/resources.py resources.qrc
python labelImg.py
python labelImg.py [IMAGE_PATH] [PRE-DEFINED CLASS FILE]
2.3 Run labelImg by giving the path
!cd Tensorflow/labelImg && python labelImg.py
3.1 Install Augmentor using pip
pip install Augmentor
3.2 Import Augmentor
import Augmentor as A
3.3 Adding operations to a pipeline
p = A.Pipeline("Tensorflow/workspace/images/train") or p = A.Pipeline("Tensorflow/workspace/images/test")
3.4 Then add operations to the Pipeline object p as follows:
p.flip_left_right(probability=0.5)
p.greyscale(probability=0.2)
p.random_contrast(probability=0.2, min_factor=0, max_factor=255)
p.skew_left_right(probability=0.5)
p.resize(probability=1.0, width=320, height=320)
3.5 Executing a pipeline
num_of_samples = int(6000)
# Now we can sample from the pipeline:
p.sample(num_of_samples)
4. Partition augmented data (images + label files) manually in train and test folder (the ratio is 9:1)
Once you use the training command in the Windows OS terminal, you will start to get the loss metrics (classification, localization, regression, total loss) like below:
Next, run the evaluation command to analyze the train data inside the Windows terminal, you will start to see eval metrics like the below:
7.1 Navigate to the train folder for your trained model e.g.
cd Drowsiness/Tensorlfow/workspace/models/my_ssd_mobnet/train
7.2 Then, open Tensorboard with the following command
tensorboard --logdir=.
7.3 Navigate to the evaluation folder for your trained model e.g.
cd Drowsiness/Tensorlfow/workspace/models/my_ssd_mobnet/eval
7.4 Similarly, open the tensorboard to eval the data