*5.2.5 Shallow neural network construction*

Two SNNs are constructed, and they are cascade connected. The first SNN1 estimates whether the ground is with or without lawn grasses using the horizontal or vertical acceleration sensor. These sensors are expected to measure the acceleration changes caused by the surface of the ground. There are seven feature types, as mentioned in 5.2.4, and 14 neurons in the input layer of SNN1. The second SNN2 estimates the lawn grass lengths using the product of the battery voltage and duty ratio of the motor control signal. This product value tends to vary according to the loads given to the cutting motor. The number of neurons in the input layer of SNN2 is seven. These networks are constructed using "Statistics and Machine Learning Toolbox" in MATLAB [22]. The specifications of the two SNNs are summarized in **Table 8**.

## *5.2.6 Evaluation results*

In the following, two SNNs are first trained, and next, they are used to estimate lawn grass lengths or ground conditions. Their results are compared with those of the RF algorithm. The evaluations are repeated ten times, and their averages are

used because the set of training data is randomly selected from the set of time

**Number of neurons Used sensors**

7 10 2 Battery Voltage & Control Signal's Duty

**Estimation SNN RF Diff.**

Short Lawn Grasses 96.2 92.8 +3.4 Not Lawn Grasses 95.8 95.5 +0.3

Short Lawn Grasses 90.9 92.4 ˗1.5 Not Lawn Grasses 96.3 95.9 +0.4

Short Lawn Grasses 93.5 92.6 +0.9 Not Lawn Grasses 96.0 94.1 +0.3

Sensor

**Input Hidden Output** SNN1 for Ground Condition 14 10 2 Horizontal or Vertical Acceleration

*AI-Based Approach for Lawn Length Estimation in Robotic Lawn Mowers*

Precision Long Lawn Grasses 92.3 94.1 ˗1.8

Recall Long Lawn Grasses 97.6 94.1 +3.5

F-Measure Long Lawn Grasses 94.9 94.1 +0.8

Accuracy 94.8 94.1 +0.7

As stated in 5.2.6, the SNNs outperforms the RF algorithm, and the estimation system based on the SNNs is implemented on a Raspberry Pi assuming an actual ECU. The processes Lawn Grass Length/Not Lawn Grass Estimator are shown in **Figure 11**. The sensor data streams are sent in a serial format and are received and saved in the memory of the Raspberry Pi. When the required data size is reached, a

set of data is preprocessed. Seven features mentioned in 5.2.4 are extracted according to the sensors, including Horizontal/Vertical Acceleration and Battery Voltage times Duty of Cutting Motor, as shown in **Figure 10**. Then, the Lawn Length/Not Lawn Grass Estimator based on the SNNs estimates that a target area is with Long Lawn Grasses, Short Lawn Grasses, or without Lawn Grasses. Finally, the

estimation result is sent to the motor controllers, as shown in **Figure 2(b)**.

The evaluation results are shown in **Table 9**. The evaluation results corresponding to the evaluation measurements defined in 5.1.3 are shown in this table. The accuracy of the SNN outperforms that of the RF algorithm on average, and the differences in evaluation criteria of each estimation are shown in the "**Diff**" column in **Table 9**. Except for the Precision of "Long Lawn Grasses" and the Recall of "Short Lawn Grasses," the differences are positive. However, the differences are not as large in all estimations, and the required estimation time is negligible.

**6. Evaluations of SNN against sensor data stream**

frames, as shown in **Table 7**.

SNN2 for Long/Short Lawn

*DOI: http://dx.doi.org/10.5772/intechopen.97530*

*Configurations of two SNNs.*

Grasses

**Table 8.**

**Table 9.**

**137**

*Evaluation of SNN.*


#### **Table 6.**

*Specifications of measurement data for evaluating SNN.*


**Table 7.**

*Number of time frames for training and testing SNN.*


#### **Table 8.**

features are typically extracted from input signal data during pre-processing. The obtained features are used as input data to a machine learning algorithm. Therefore, for each sensor data, seven neurons are needed in the input layer of SNN shown in **Figure 6**. In the experiments, these features are obtained from a time frame

The details of collected data are shown in **Table 6**. In the experiments, a subset of time frames from each field data is used for training the SNN, and the obtained model is tested on the remaining test data. The number of time frames used for testing is approximately 670 in each group. The remaining time frames are used for

Two SNNs are constructed, and they are cascade connected. The first SNN1 estimates whether the ground is with or without lawn grasses using the horizontal or vertical acceleration sensor. These sensors are expected to measure the acceleration changes caused by the surface of the ground. There are seven feature types, as mentioned in 5.2.4, and 14 neurons in the input layer of SNN1. The second SNN2 estimates the lawn grass lengths using the product of the battery voltage and duty ratio of the motor control signal. This product value tends to vary according to the loads given to the cutting motor. The number of neurons in the input layer of SNN2 is seven. These networks are constructed using "Statistics and Machine Learning Toolbox" in MATLAB [22]. The specifications of the two SNNs are summarized in

In the following, two SNNs are first trained, and next, they are used to estimate lawn grass lengths or ground conditions. Their results are compared with those of the RF algorithm. The evaluations are repeated ten times, and their averages are

**Groups Number of time frames**

Long Lawn Grasses 2,356 Short Lawn Grasses 1,574 Not Lawn Grasses 2,470 Total 6,400

**Groups Number of time frames**

Long Lawn Grasses 1,686 670 Short Lawn Grasses 904 670 Not Lawn Grasses 1,801 669 Total 4,391 2,009

**For training For testing**

obtained every 3.2 s over 2.3-h measurement data.

training, as shown in **Table 7**.

*Robotics Software Design and Engineering*

**Table 8**.

**Table 6.**

**Table 7.**

**136**

*5.2.6 Evaluation results*

*5.2.5 Shallow neural network construction*

*Specifications of measurement data for evaluating SNN.*

*Number of time frames for training and testing SNN.*

*Configurations of two SNNs.*


#### **Table 9.**

*Evaluation of SNN.*

used because the set of training data is randomly selected from the set of time frames, as shown in **Table 7**.

The evaluation results are shown in **Table 9**. The evaluation results corresponding to the evaluation measurements defined in 5.1.3 are shown in this table. The accuracy of the SNN outperforms that of the RF algorithm on average, and the differences in evaluation criteria of each estimation are shown in the "**Diff**" column in **Table 9**. Except for the Precision of "Long Lawn Grasses" and the Recall of "Short Lawn Grasses," the differences are positive. However, the differences are not as large in all estimations, and the required estimation time is negligible.
