**5. Testing**

*Control Theory in Engineering*

and data (**Figure 16**).

input layer of the MLP.

the NNVALUES.XML file).

**4.4 Autonomous driving**

in order for it to work fully:

*Set training method and training criteria.*

to each of those classified outputs (0, 1, 2).

a move instruction based on the value.

defines which class the image is most likely to belong to.

All hardware devices must be fully installed and working. Training and testing data must be created and stored.

**4.3 Prediction**

being given.

Next, setting the training method and training criteria, a backpropagation rate of 0.0001 for 50,000 iterations was chosen, the higher level of iterations will make the weighting more secure and could be potentially viewed as "over-training"; however, in the given circumstance of a real-time application, the network has to be as accurate as possible. The rate of backpropagation ratio being set to 0.0001 is the

Following this, all that is required is to call the TRAIN function from the CV library, to run the training algorithm with the above specified topology, parameters

Prediction is used in the testing process and the self-driving process. Prediction is the processing of unknown data in order to categorise the class of the image it is

In the case of testing, this is used to compare the network's output to the correct

In the self-driving process, the unknown data (camera image and sensor date) is fed into the neural network via prediction to determine the classification of the image. The value returned is used to determine the current state of the track in front

In the real-time processing part of the project, the real-time image has the aforementioned image preprocessing functions applied to it, to transform it from a fully coloured image into a one-dimensional array of binary values, to match the

Prediction works by receiving this correctly formatted array and passing it to the input layer. This is then fed through the network (which has been fully loaded from

Following this, the network will produce an array of float values, representing the probability of the image belonging to that class. So, in this case it will produce an array of three float values, representing the probability the image which belongs

The highest value in this array is recorded, and its location in the array (0, 1, 2)

This highest value location is then fed into a switch statement which implements

Prior to the calling of the AutoDrive function, the following criteria must be met

standard rate which is used by the majority of users (**Figure 15**).

output in order to calculate the accuracy of the network.

of the vehicle, and this is the direction the car should move in.

**316**

**Figure 15.**

**Figure 16.** *Train model.*

#### **5.1 Unit testing**

Unit testing is the testing for the initial components and all basic instructions in the system. These are developed from the basic implementation of the system (**Table 1**).

#### **5.2 Integration testing**

Integration testing is testing to see if the more advanced functionalities of the system are comprised from the design process (**Table 2**).


**Table 1.** *Unit testing and results.*


#### **Table 2.**

*Integration testing and results.*

#### **5.3 System testing**

The system testing is the tests of the overall system. These are defined by the research section to determine what is needed from the system for the user (**Table 3**).

#### **5.4 Acceptance tests: qualitative results of self-driving**

These tests are used to qualitatively test the self-driving capabilities of the car and measure how smoothly it runs.

These are measured visually during demonstration and thus are only considered to be an opinion as opposed to a solid pass/fail scheme (**Table 4**).

**319**

**6. Evaluation**

*Acceptance test and results.*

**Table 4.**

smoothly.

**6.2 Reflection**

The main aims were to verify:

Can the vehicle follow the track? Can the vehicle control the car motors?

**6.1 Performance summary and achievements**

41 Score out of 10 for smoothness of drive when

42 Score out of 10 for smoothness of drive when going

43 Score out of 10 for smoothness of driving when

following a straight line

following an entire track

around a corner

Overall the project has achieved what it was required to do; it is fully able to drive around the track to a suitable level of accuracy. The chosen libraries were suitable for the project and provided well-documented functions regarding all aspects

In my opinion, the best feature of the vehicle is the custom-made circuit board, which required a great deal of time and effort to design and build. Once this occurred, everything from the operational hardware point of view went very

to implement some of the "would like to" aspects of the MoSCoW requirement analysis, but as discussed below, there is potential for further development.

The system passed all of the required tests. However, there was not enough time

required to enable the vehicle to do the tasks that it had to perform.

Can the vehicle recognise a track via NN and camera data?

*Computational Efficiency: Can Something as Small as a Raspberry Pi Complete…*

**Test Test criteria Where Qualifier Pass** User menu option: testing for camera SysMenu() Visual Yes User menu option: testing for MLP accuracy SysMenu() Visual Yes Is user menu easy to use? SysMenu() Visual Yes User menu option: testing for motors SysMenu() Visual Yes User menu option: testing for ultrasonic sensors SysMenu() Visual Yes

**Test Test criteria Where Qualifier Score**

AutoDrive() Visual Yes

AutoDrive() Visual Yes

AutoDrive() Visual Yes

opinion

opinion

opinion

9

6

7

AutoDrive() Visual

AutoDrive() Visual

AutoDrive() Visual

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

36 Does the vehicle stay still if there is an object within

37 Does the vehicle stay between the two lines needed to

38 Does the vehicle successfully drive one loop around the

15 cm of the front of it?

drive?

track?

*System testing and results.*

**Table 3.**

*Computational Efficiency: Can Something as Small as a Raspberry Pi Complete… DOI: http://dx.doi.org/10.5772/intechopen.88342*


#### **Table 3.**

*Control Theory in Engineering*

camera?

resolution?

black and white?

10x10 to 1x100?

[0–255]?

topology?

XML file?

MLP?

same?

image?

(prediction)

trained MLP?

12 Does canny edge filter apply to image stream from

13 Does camera image become scaled down to 10x10

14 Can image stream from camera be converted to

16 Can image stream from camera be reshaped from

17 Can image be converted to a 1D array of values

19 Can a set of images and their classes (read from folder name) be stored as a training data set?

21 Can a MLP be defined and created based on its

22 Can a trained MLP be stored once trained to an

25 Is backpropagation the algorithm used to train the

26 Does test data allow user to define accuracy of a

28 Are weight values stored of trained MLP not all the

29 Does NN/MLP allow prediction with current

30 Calculate most likely output via neural network

**318**

**5.3 System testing**

*Integration testing and results.*

(**Table 3**).

**Table 2.**

The system testing is the tests of the overall system. These are defined by the research section to determine what is needed from the system for the user

**Test Test criteria Where Qualifier Pass**

15 Can image stream from camera be saved/loaded? TestCamera() Visual Yes

18 Can a saved image be loaded? AutoDrive() Visual Yes

20 Can training data be stored in an XML file? ReadScanStore() Visual Yes

23 Can a trained MLP be loaded from an XML file? TestNetwork() Visual Yes 24 Can a training data set be used to train an MLP? TrainNetwork() Visual Yes

27 Does OpenCV's backpropagation algorithm work? TestNetwork() Visual Yes

TestCamera() Visual Yes

TestCamera() Visual Yes

TestCamera() Visual Yes

TestCamera() Visual Yes

TestCamera() Visual Yes

ReadScanStore() Visual Yes

TrainNetwork() Visual Yes

TrainNetwork() Visual Yes

TrainNetwork() Visual Yes

TestNetwork() Visual Yes

TestNetwork() Visual Yes

AutoDrive() Visual Yes

AutoDrive() Visual Yes

These tests are used to qualitatively test the self-driving capabilities of the car

These are measured visually during demonstration and thus are only considered

**5.4 Acceptance tests: qualitative results of self-driving**

to be an opinion as opposed to a solid pass/fail scheme (**Table 4**).

and measure how smoothly it runs.

*System testing and results.*


**Table 4.** *Acceptance test and results.*
