Discover our
resources

Activity: Intruder detection

Materials required:

  • 1 robot minimum
  • 1 computer/robot
  • a flat object (box, board, smartphone, etc.)

Software configuration :

  • example configuration: "intruder detection

Duration :

2 hours

Age :

15+ years

The advantages of this activity : 

  • Ideal for the classroom
  • Little equipment required
  • Cross-disciplinary (maths / IT)

Mathematical understanding of neural networks through an activity based on the robot's ultrasonic sensor. In particular, we discover why intermediate layers of neurons are needed.

[Video content coming soon]

Installation

Place the robot next to the computer, facing a wall (or arena board) about 50 cm away, and provide a flat-sided object (a box, a board, a smartphone) to play the role of intruder.

Load the"Intruder detection" configuration in the"Supervised learning" category. This scenario uses the ultrasonic sensor only.

The entire activity is carried out in"manual editing" mode, i.e. you choose the neural network parameters yourself, without using a learning algorithm.

Interface presentation

In this activity, your main screen has two views:

  • Below, the neural network under study. At the start of the activity, the manual editing mode (in the buttons at the bottom of your software interface) must be activated, allowing you to modify the neural network parameters yourself. To modify the value of a connection, place your mouse over it (it turns red), then use your keyboard to enter the desired value, or your mouse wheel to modify the current value. To modify the value of a neuron's bias, place your mouse over the neuron itself (not the value display), then proceed as for connections.
  • Above, a graph showing thestate space. On the abscissa, the distance measured by the ultrasonic sensor. On the ordinate, the activation levels of the output neurons. There are two curves represented because there are two output neurons. Curve/neuron correspondence is color-coded. The value of the output neurons is a function of the input value (distance). The background color of the graph indicates which curve is above the other for each input value, and therefore which action will be chosen by the robot for that input value.

‍‍

‍Objectivesand issues

The robot faces a wall and must beep when someone (an intruder) passes between it and the wall.

The neural network must be configured to perform this task. Since the only sensor used is the ultrasonic sensor, the aim is to obtain a beep when the distance is small, and the "do nothing" action when the distance is normal.

Integration of neural biases

The simple "connection weight" parameters are insufficient to accomplish this task. We need to activate the "neural bias" option (in the AI tab), which unlocks new parameters that will enable us to achieve this goal.

Attempted cheating

Issues

An intruder tries to cheat by exploiting the characteristics of the ultrasonic sensor: if the flat side is placed diagonally to the sensor, the waves bounce back and the distance captured is then much greater than that of the wall! We need to adapt our neural network to detect this cheating attempt too.

Intermediate neural layers

To do this, we'll need to add an intermediate layer to our neural network (in the AI tab), in order to obtain a non-linear model thanks to the activation functions.

Review and feedback

I remember:

  • A neural network is a set of neurons organized in layers. Each layer may contain one or more neurons.
  • Neurons are abstract objects containing a simple numerical value.
  • Neurons are linked together by connections whose values are called weights.
  • Each neuron also has a bias, which is added to the neuron's value.
  • Input layer neuron values are determined by sensor values.
  • The neurons in the output layer correspond to the robot's actions. In autonomous mode, the action with the highest value is always selected.
  • Intermediate layers enable the network to perform more complex tasks. The graph shows that the straight lines of the output neurons are replaced by increasingly complex curves as the number of intermediate layers increases.
  • Training a neural network simply involves choosing a value for each of its parameters: connection weight and neuron bias. When the number of neurons and connections becomes large, this complex task is performed by a learning algorithm!