The AI-CPS is an end-to-end open source platform for cyber-physical systems considering a knowledge base with the aid of artificial neuronal networks (ANN).
It has a comprehensive, flexible ecosystem of tools, libraries, and community resources that lets researchers push the state-of-the-art in ANN and developers easily build and deploy ANN-powered applications.
Its particular focus lays on the efficient application of knowledge of ANN.
For this, it enables the flexible, node-independent (a) situational ANN application, (b) ANN training and validation as well as (c) ANN refinement,
which is realized as Over-The-Air deployment of
(1) ANN models considered as knowledge base,
(2) ANN activations considered as activation base,
(3) ANN training material considered as learning base and
(4) ANN routines considered as codeBase.
Among furthers, this is realized on behalf of tensor_flow libraries, docker mechanisms, python applications,
so that they can be realized on any kind of device (tested with raspberry, mac, ubuntu),
any kind of platform (tested with aarch64, x86_64 and x86_64_gpu).
The tool was originally developed by Dr.-Ing. Marcus Grum.
-
Download and install recent OS, e.g.
raspberry Pi OS Lite buster 12.02.2020, on sd card via laptop. -
Create ssh file an boot section.
-
Configure WLAN information.
-
Put SD card into raspberry and start device.
-
Download and install Raspberry Pi Imager (e.g. v1.7.2) from Raspberry Pi OS Page.
-
Configure your device by selecting
raspberry Pi OS Lite (64bit), SD card and corresponding settings. -
Hit
write os. -
Put SD card into raspberry and start device.
-
Change default password.
sudo passwd pi -
Connect on your raspberry via shell with user
pi, e.g. with passwordraspberry:or by
-
Test your current distro by
lsb_release -a. -
Test your architecture by
uname -a.
Please follow installation details of AiLab Installation Guide. This shows the installation of numerous of the required tools. Hence, the following just shows a raspberry focus and some extra commands.
This is based on the Docker Installation Guide.
-
Update your os and accept its 'Suite' value from 'testing' to 'oldstable' explicitly before updates for this repository can be applied.
sudo apt-get update -
Upgrade your os.
sudo apt-get upgrade -
Install docker
curl -sSL https://get.docker.com | sh -
Add a non-root user to the docker group.
sudo usermod -aG docker ${USER} -
Prepare installation of Docker-Compose.
sudo apt-get install libffi-dev libssl-dev sudo apt install python3-dev sudo apt-get install -y python3 python3-pip -
Install Docker-Compose.
sudo pip3 install docker-compose -
Enable the Docker system service to start your containers on boot.
sudo systemctl enable docker -
Restart your device.
sudo reboot -
Run Hello World Container for testing Docker installation.
docker run hello-world -
Create docker volume
ai_systemfor using mechanisms of this repository:docker volume create ai_system
This is based on the Docker Installation Guide.
-
Download recent
.dmgfile calledDocker Desktop for Macand install it. -
Run Hello World Container for testing Docker installation.
docker run hello-world -
Create docker volume
ai_systemfor using mechanisms of this repository:docker volume create ai_system
-
Find useful links, here:
https://github.com/fgervais/docker-tensorflow/blob/master/Dockerfile https://github.com/armindocachada/raspberrypi-docker-tensorflow-opencv https://github.com/lhelontra/tensorflow-on-arm https://github.com/samjabrahams/tensorflow-on-raspberry-pi -
Maybe include camera at pi.
https://www.raspberrypi.com/products/raspberry-pi-high-quality-camera/
-
Start container that provides all (SciPi, Matplotlib, etc.).
docker run --rm -it armswdev/tensorflow-arm-neoverse bashAlternatively, use light-weight containers.
docker run --rm -it francoisgervais/tensorflow:2.1.0-cp35 bash
-
Run tensorflow docker container and execute a small example program.
docker run -it armswdev/tensorflow-arm-neoverse python3 -c "import tensorflow as tf; print(tf.__version__); print(tf.reduce_sum(tf.random.normal([1000, 1000])))"
-
Run tensorflow docker container and execute a small example script.
docker run -it \ -v /home/pi/knowledgeBases:/home/ubuntu/knowledgeBases \ armswdev/tensorflow-arm-neoverse \ python3 /home/ubuntu/knowledgeBases/testScript.py
-
Run tensorflow docker container in background.
docker run \ -v /home/pi/knowledgeBases:/home/ubuntu/knowledgeBases \ armswdev/tensorflow-arm-neoverse -
Get to know the container's name, which is in this example
37eb7158877c.docker ps -
Execute script.
docker exec 37eb7158877c python3 /home/ubuntu/knowledgeBases/tensorflowWorkDir/testScript.py
-
Start container.
docker pull tensorflow/tensorflow # latest stable release (cpu-based calculation), which is right now: 2.8.0Alternatively, use containers with an alternative configuration.
docker pull tensorflow/tensorflow:latest-gpu # "gpu" support; "latest" of the latest TensorFlow binary image, which is right now: 2.6.0 docker pull tensorflow/tensorflow:version-gpu # "gpu" support; "version" of the TensorFlow binary image, for example: 2.1.0For further information, have a look on Access an NVIDIA GPU Information Section.
-
Run tensorflow docker container and execute a small example program.
docker run -it tensorflow/tensorflow python3 -c "import tensorflow as tf; print(tf.__version__); print(tf.reduce_sum(tf.random.normal([1000, 1000])))"
-
Run tensorflow docker container and execute a small example script.
docker run -it \ -v /home/pi/knowledgeBases:/home/ubuntu/knowledgeBases \ tensorflow/tensorflow \ python3 /home/ubuntu/knowledgeBases/testScript.pyAlternatively, consider the tmp folder as current working directory
docker run -it --rm \ -v $PWD/repositories/tensorflowWorkDir:/tmp \ -w /tmp \ tensorflow/tensorflow \ python3 ./testScript.py
-
Find useful links, here:
https://github.com/tensorflow/build https://medium.com/tensorflow/tensorflow-1-9-officially-supports-the-raspberry-pi-b91669b0aa0 https://www.tensorflow.org/install/docker https://github.com/tensorflow/build/tree/master/raspberry_pi_builds -
Find individual instructions at corresponding readmes of this repository.
-
Install MQTT library:
pip3 install paho-mqtt
-
Install MQTT library:
pip3 install paho-mqtt
-
Install pip3 for installing MQTT library:
sudo apt install python3-pip -
Install MQTT library for communication client:
pip3 install paho-mqtt -
Install mosquitto server for MQTT broker:
sudo apt-get install mosquitto
-
Start MQTT server at first CLI for managing communication:
For Mac:
/usr/local/sbin/mosquitto -c /usr/local/etc/mosquitto/mosquitto.confFor Ubuntu:
mosquitto -vor
sudo /usr/sbin/mosquitto -c /etc/mosquitto/mosquitto.confYou can stop broker server by one of the following lines:
sudo service mosquitto stop sudo systemctl stop mosquitto.serviceIf you want to see verbose information, which is not displayed at CLI when broker is started as service, have a look on the corresponding log file:
sudo tail -n20 -f /var/log/mosquitto/mosquitto.log -
If desired, subscribe from second CLI for displaying all messages:
mosquitto_sub -t "#" -v -u testuser
Here, relevant tags represent as follows:
h: mqtt host to connect to. Defaults to localhost.p: network port to connect to. Defaults to 1883 for plain MQTT and 8883 for MQTT over TLS.t: mqtt topic to subscribe to. May be repeated multiple times.u: provide a username.P: provide a password.v: print published messages verbosely.
Alternatively, consider testing at world-wide, public test server:
```
mosquitto_sub -t "CoNM/workflow_system" -v -u testuser -h "test.mosquitto.org" -p 1883
```
-
Start
AI_simulation_basis_communication_client.pyfrom a third CLI:python AI_simulation_basis_communication_client.py -
Send message manually from fourth CLI:
mosquitto_pub -t "CoNM/workflow_system" -u testuser -m "This is a test message."
Alternatively, consider testing at world-wide, public test server:
```
mosquitto_pub -t "CoNM/workflow_system" -u testuser -m "Please do manaul test instruction mxy." -h "test.mosquitto.org" -p 1883
```
Face communication management throughout the process at first CLI being the message broker.
Relevant messages from subscriptions e.g. can be seen at the second CLI representing a machine being a mqtt client.
The third CLI represents a machine that is activated by messages in order to realize any kind of complex, algorithmic procedures.
-
If further packages are required, you might install them from inside the container.
python -m pip install -U pip python -m pip install -U matplotlib pip install SciPyOf course, you can prepare an corresponding image providing packages required. For a quick testing, this is okay.
-
Copy relevant files from local desktop to raspberry.
scp -r /Users/mgrum/repositories/tensorflowWorkDir/ [email protected]:/home/pi/knowledgeBases/Alternatively, you can deploy them via github or via docker.
-
Create Dockerfile for creating an image.
# syntax=docker/dockerfile:1 FROM busybox ADD ./apple_banana_orange_pump_20.h5 /knowledgeBase/currentSolution.h5 CMD ["/knowledgeBase"]Alternatively, consider the following
scratch # 34.0MB busybox # 35.2MB alpine:3.14 # 39.6MB -
Build docker image from Dockerfile specified.
docker build --tag apple_banana_orange_pump_20 . -
Have a look on the image created.
docker run -it --rm apple_banana_orange_pump_20 sh -
Copy data from container, e.g. this is called
bold_galileo, to local file.docker cp bold_galileo:/test /Users/mgrum/repositories/tensorflowWorkDir/test_volume02 -
Start container having this directory mounted.
docker run -it --rm \ -v $PWD/repositories/tensorflowWorkDir:/tmp \ -v /Users/mgrum/repositories/tensorflowWorkDir/test_volume02:/tmp/test_volume02 \ -w /tmp \ tensorflow/tensorflow
Deploy relevant file, such as a solution/image, via docker and consider file copying via docker-composeroutines.
- Follow individual readme files of
imageandscenariofolders.
-
Test AI container manually:
cd $repositories/AI-CPS/scenarios/apply_knnSolution/x86_gpu docker-compose up -
Run local MQTT client:
cd $repositories/AI-CPS/code/ sudo python3 AI_simulation_basis_communication_client.py -
Release one of the remote requests shown before and face AI case realization.
-
Initiate example
apply_knnSolutionfrom remote CLI:mosquitto_pub -t "CoNM/workflow_system" -u testuser -m "Please realize the following AI case: scenario=apply_knnSolution, knowledge_base=marcusgrum/knowledgebase_apple_banana_orange_pump_20, activation_base=marcusgrum/activationbase_apple_okay_01, code_base=marcusgrum/codebase_ai_core_for_image_classification, learning_base=-, sender=SenderA, receiver=ReceiverB." -h "test.mosquitto.org" -p 1883 -
Initiate example
create_knnSolutionfrom remote CLI:mosquitto_pub -t "CoNM/workflow_system" -u testuser -m "Please realize the following AI case: scenario=create_knnSolution, knowledge_base=-, activation_base=-, code_base=marcusgrum/codebase_ai_core_for_image_classification, learning_base=marcusgrum/learningbase_apple_banana_orange_pump_02, sender=SenderA, receiver=ReceiverB." -h "test.mosquitto.org" -p 1883 -
Initiate example
refine_knnSolutionfrom remote CLI:mosquitto_pub -t "CoNM/workflow_system" -u testuser -m "Please realize the following AI case: scenario=refine_knnSolution, knowledge_base=marcusgrum/knowledgebase_apple_banana_orange_pump_01, activation_base=-, code_base=marcusgrum/codebase_ai_core_for_image_classification, learning_base=marcusgrum/learningbase_apple_banana_orange_pump_02, sender=SenderA, receiver=ReceiverB." -h "test.mosquitto.org" -p 1883
Virtual / computer-based simulated experiment examples can be found at this repository at ./code/experiments.
For instance, ...
-
experiment01simulates the manipulation of CPS knowledge base by process change - alternative product change (in context of continual learning and training data manipulation): Inhowfar do AI-based CPS forget if a process changes leads to a different product type distribution (in this case alternative products) that does not correspond to the CPS's current specialization? -
experiment02simulates the manipulation of CPS knowledge base by smart sensors overtaking tasks partly - filtering sensory input (in context of continual learning and training data manipulation): Inhowfar do AI-based CPS forget if fruit evaluation is overtakten by preceeding smart sensors and the CPS's current specialization does not correspond to the required set of skills? -
experiment03simulates the manipulation of CPS knowledge base by worsening sensors badly affecting tasks: filtering sensory input (in context of continual learning and training data manipulation): Inhowfar do AI-based CPS forget if current evaluation task is disturbed by defect sensors, such as providing blurred images that do not correspond to the CPS's current specialization? -
experiment04simulates the manipulation of CPS knowledge base by process change - sub-set product change (in context of continual learning and training data manipulation): Inhowfar do AI-based CPS forget if a process changes leads to a different product type distribution (in this case a sub-set of trained products) that does not correspond to the CPS's current specialization?
Here, AI-based CPS can carry out tasks in simulation runs and their performance can be measured. As these are considered as AI-based individuals, statistical analyses can explore their performance.
For instance, you can base an entire cyber-physical production system,
such as the CoNM application example of EV3-Based Industry4.0-Production-System,
on the basis of AI-CPS.
Further details can be found at:
Grum M. 2022. Construction of a Concept of Neuronal Modeling. Springer Gabler Wiesbaden. https://doi.org/10.1007/978-3-658-35999-7
For instance, you can include AI-CPS in traditional cyber-physical production systems, such as the Research and Application Center Industry 4.0 (RACI).
Here, a NodeRed environment can manage the AI knowledge base selection,
such as by an AI Case-Based Reasoning.
The AI simulation basis environment carries out the ANN-based model application
and communicates results back to interested parties via the MQTT messaging broker.
Further details can be found at:
Grum, M. et al. 2023. AI Case-Based Reasoning for Artificial Neural Networks. A2IA 2023 Conference.
Applying this in ordinary production processes, experiments can be realized that focus on human-AI teaming. The following example focuses on (1) human trust, (2) human frustation as well as (3) human forgetting because of AI support.
As this Neuronal Modeling and Description Language (NMDL) model shows, humans are trained remotely to realize a production process. Then, humans are faced with the trained production process within the real production environment. Thereafter, humans are faced with AI support at the trained production process within the real production environment. Lastly, humans are faced with the original production process (without AI support). In between, production performance as well as trust and frustration are surveyed.
Experiments and publications about this are in progress.

