Difference between revisions of "ML-TN-001 - AI at the edge: comparison of different embedded platforms - Part 1"

From DAVE Developer's Wiki
Jump to: navigation, search
(Added image)
Line 80: Line 80:
 
The dataset was created collecting 240 images of 6 different fruits. 3/4 of the images were used for the training and the rest was used for test purpose. Training the model with a greater number of images would have led to a better accuracy but it wouldn't have changed the inference time.
 
The dataset was created collecting 240 images of 6 different fruits. 3/4 of the images were used for the training and the rest was used for test purpose. Training the model with a greater number of images would have led to a better accuracy but it wouldn't have changed the inference time.
  
Several measures were taken to counter the high overfitting tendency due to the small amount of images. For instance, new images were synthesized from the existing ones to simulate a larger dataset.
+
Several measures were taken to counter the high overfitting tendency due to the small amount of images. For instance, new images were synthesized from the existing ones to simulate a larger dataset, as shown below:
 
+
[[File:Drawio200% augmentation.png|none|thumb|400x400px|New images synthesized from an existing one. Original image by tookapic from Pixabay.com]]
=== Model conversion ===
 
  
 
==Articles in this series==
 
==Articles in this series==

Revision as of 14:50, 15 September 2020

Info Box
NeuralNetwork.png Applies to Machine Learning
Work in progress


History[edit | edit source]

Version Date Notes
1.0.0 September 2020 First public release

Introduction[edit | edit source]

Thanks to the unstoppable technology progress, nowadays Artificial Intelligence (AI) and specifically Machine Learning (ML) are spreading on low-power, resource constrained devices as well. In a typical Industrial IoT scenario, this means that edge devices can implement complex inference algorithms that were used to run on the cloud platforms only.

This Technical Note (TN for short) is the first one of a series illustrating how machine learning-based test applications are deployed and perform across different embedded platforms, which are eligible for building such intelligent edge devices.

The idea is to develop one or more reference applications with the help of well-known frameworks/libraries and to test them on these platforms for comparing performances, resource utilization, development flow, etc.

In the following sections, these applications are described in more detail. Each article of this series explores in detail one specific platform or use case.

Reference application #1: fruit classifier[edit | edit source]

This application implements a classifier like the one described here. There is one notable difference, however, with respect to the linked article. In this case, the model was created from scratch.

Model creation[edit | edit source]

The model was created and trained using Keras, a high-level API of TensorFlow.

The following block shows its architecture:

Model: "sequential"
_________________________________________________________________
Layer (type)                 Output Shape              Param #   
=================================================================
conv2d (Conv2D)              (None, 222, 222, 32)      896       
_________________________________________________________________
activation (Activation)      (None, 222, 222, 32)      0         
_________________________________________________________________
max_pooling2d (MaxPooling2D) (None, 111, 111, 32)      0         
_________________________________________________________________
conv2d_1 (Conv2D)            (None, 109, 109, 32)      9248      
_________________________________________________________________
activation_1 (Activation)    (None, 109, 109, 32)      0         
_________________________________________________________________
max_pooling2d_1 (MaxPooling2 (None, 54, 54, 32)        0         
_________________________________________________________________
conv2d_2 (Conv2D)            (None, 52, 52, 64)        18496     
_________________________________________________________________
activation_2 (Activation)    (None, 52, 52, 64)        0         
_________________________________________________________________
max_pooling2d_2 (MaxPooling2 (None, 26, 26, 64)        0         
_________________________________________________________________
conv2d_3 (Conv2D)            (None, 24, 24, 128)       73856     
_________________________________________________________________
activation_3 (Activation)    (None, 24, 24, 128)       0         
_________________________________________________________________
max_pooling2d_3 (MaxPooling2 (None, 12, 12, 128)       0         
_________________________________________________________________
flatten (Flatten)            (None, 18432)             0         
_________________________________________________________________
dense (Dense)                (None, 256)               4718848   
_________________________________________________________________
activation_4 (Activation)    (None, 256)               0         
_________________________________________________________________
dropout (Dropout)            (None, 256)               0         
_________________________________________________________________
dense_1 (Dense)              (None, 6)                 1542      
_________________________________________________________________
activation_5 (Activation)    (None, 6)                 0         
=================================================================
Total params: 4,822,886
Trainable params: 4,822,886
Non-trainable params: 0

The training was done in the cloud using a AWS EC2 server setted up ad hoc.

The dataset was created collecting 240 images of 6 different fruits. 3/4 of the images were used for the training and the rest was used for test purpose. Training the model with a greater number of images would have led to a better accuracy but it wouldn't have changed the inference time.

Several measures were taken to counter the high overfitting tendency due to the small amount of images. For instance, new images were synthesized from the existing ones to simulate a larger dataset, as shown below:

New images synthesized from an existing one. Original image by tookapic from Pixabay.com

Articles in this series[edit | edit source]

The other articles in this series are: