- Python 3.8/3.9 64bit
- Installed CANoe/CANoe4SW>=16
The sample AI SUTs are designed to communicate with the AI SIL Testing and Analysis CANoe/CANoe4SW sample configuration. Please also visit the help site there if there are any problems.
This repository contains two AI SUTs. They demonstrated how an AI written in PyTorch or TensorFlow can communicate with CANoe/CANoe4SW. If everything is set up correctly, interactions between CANoe/CANoe4SW and SUT are printed out. Depending on the setup, some queries (in particular explainable AI queries) can take a few seconds.
- torch_sut.py: recommended SUT
In this SUT, an object detector from torchvision is loaded. The detector is pretrained on the COCO dataset. The top 3 annotations are displayed in the CANoe/CANoe4SW sample configuration. For the top 1 annotation, an explanation can be generated. - tf_sut.py:
This SUT demonstrates how an image classifier from TensorFlow can work with CANoe/CANoe4SW. Because an image classifier only classifies the whole image, no bounding boxes are generated and only the input image is shown in the CANoe/CANoe4SW sample configuration. Also, the automatic test may not pass, because image classifiers are mostly trained on the ImageNet dataset instead of COCO. The ImageNet label IDs are tried to convert to COCO labels IDs.
- Start a shell e.g. in Visual Studio Code or IDE of choice
- Recommended: Load the whole repository in an IDE such as Visual Studio Code and then start a shell/terminal there
- Optional: Activate a python development environment (e.g. virtual environment)
- Install dependencies like TensorFlow and PyTorch in the shell via
pip install -r requirements.txt
- Install CANoe-SilAdapter module in the shell via executing the enable_SilAdapter.py file with
python enable_SilAdapter.py
- Run a SUT either in the shell (e.g.
python torch_sut.py
) or IDE of choice - Switch to the CANoe/CANoe4SW sample configuration. If everything is correctly set up, the SUT will display messages whenever it receives new data from CANoe/CANoe4SW.
- If there is a
[ Warning ] Could not connect to rtinode at '{IP address}', retrying...
displayed, please check if the CANoe/CANoe4SW sample configuration is running.
- Checkout this repository on the remote machine
- Copy the folder "Python Runtime" from the CANoe/CANoe4SW installation folder ({CANoe Installation Folder}\Installer Additional Components\SilAdapter\Python Runtime) into this repository on the remote machine
- Start a shell on the remote machine
- Recommended: Load the whole repository in an IDE such as Visual Studio Code and then start a shell/terminal there
- Optional: Activate a python development environment (e.g. virtual environment)
- Install dependencies like TensorFlow and PyTorch in the shell via
pip install -r requirements.txt
- Install CANoe-SilAdapter module in the shell via executing the enable_SilAdapter.py file with
python enable_SilAdapter.py
- Get the IP address of your local machine with the CANoe/CANoe4SW installation (run
ipconfig
in a shell on the local machine) - Setting an environment variable with IP address on the remote machine shell for the SUT to access the local CANoe/CANoe4SW installation. For a Linux system, type in the shell
export VSIL_CONNECTION_ADDRESS={LocalCANoeIPAddress}
. For a Windows system, typeset SIL_CONNECTION_ADDRESS={LocalCANoeIPAddress}
in a cmd-shell or$env:VSIL_CONNECTION_ADDRESS ={LocalCANoeIPAddress}
in a powershell - Run a SUT either in the shell (e.g.
python torch_sut.py
) or IDE of choice - If there is a
[ Warning ] Could not connect to rtinode at '{IP addresse}', retrying...
displayed, please check if the VSIL_CONNECTION_ADDRESS was correctly set or if the CANoe/CANoe4SW sample configuration is running. - Switch to the CANoe/CANoe4SW sample configuration. If everything is correctly set up, the SUT will displays messages whenever it receives new data from CANoe/CANoe4SW.
- Checkout this repository on the remote machine
- Copy the folder "Python Runtime" from the CANoe/CANoe4SW installation folder ({CANoe Installation Folder}\Installer Additional Components\SilAdapter\Python Runtime) into this repository on the remote machine
- Get the IP address of your local machine with the CANoe/CANoe4SW installation (run
ipconfig
in a shell on the local machine) - Start a shell on the remote machine
- Recommended: Load the whole repository in an IDE such as Visual Studio Code and then start a shell/terminal there
- Setting an environment variable with IP address on the remote machine shell for the SUT to access the local CANoe/CANoe4SW installation. For a Linux system, type in the shell export
VSIL_CONNECTION_ADDRESS={LocalCANoeIPAddress}
. - Build a docker image via
docker-compose build
in the remote shell - Start an AI SUT via
docker-compose up torch_sut
- If there is a
[ Warning ] Could not connect to rtinode at '{IP address}', retrying...
displayed, please check if the VSIL_CONNECTION_ADDRESS was correctly set. - Switch to the CANoe/CANoe4SW sample configuration. If everything is correctly set up, the SUT will displays messages whenever it receives new data from CANoe/CANoe4SW.
- ERROR: Could not find a version that satisfies the requirement tensorflow (from versions: none),ERROR: No matching distribution found for tensorflow:
Check if the python version is a 64-bit python 3.8/3.9 version by typingpython
in the shell. Check python version and whether it runs on win64.