Goals
The final goal is to get the project running on the Jetson.
For this we need to walk a few steps
- Get XAI going on PC using simulation data
- Get XAI going on Jetson with simulation data
- Get XAI going on Jetson with GPC360 connected
- Get Xenomatix5GAlert going on the Jetson
GPC360 simulation data can be found in
D:\Dropbox\C-Tech\Customers\Xenomatix\PROJECTS\01- 5GSafeAlert\Data\3DLidar\GPC360_recording
Virtual environment
In XAI, the folder pedenv is the virtual environment which contains all the necessary dependencies.
There are some which are a bit harder to find like:
- detectron2
- ouster
To make use of the you need to:
- Install python 3.9 in the directory C:\Program Files\Python39
- Set your virtual environment in vs code to .\pedvenv\Scripts\python.exe
Note that on the Dell PC I was at Python 3.11.
At least that removes the squiggles on the imports.
But as a consequence of having the root python in Program Files, you need to start vs code in Administrator mode .....
After installing 3.9 in exactly the same location and trying to run Final I get
The error message ModuleNotFoundError: No module named 'torch.testing' within your PyTorch import chain indicates that a component of PyTorch itself is missing or corrupted within your pedvenv installation.
The subsequent Fatal error in launcher: Unable to create process using '"C:\Users\Jesse Houben\Documents\PedestrianProject\pedvenv\Scripts\python.exe" "C:\XAI\pedvenv\Scripts\pip.exe" install torch.testing': The system cannot find the file specified. is the real problem now.
It seams that pedenv imposes a quite specific environment tied to Jesse's PC.
So continuing down that path is not going to lead me to the Jetson.
I go back to my own virtual environment and try to get that going.
As attempts to get pedenv working fail, I change strategy and will try to recreate a proper created virtual environment and install all dependencies there, and then make a requirements.txt for that.
Recreating a proper virtual environment
I'll first make a normal installation of Python 3.9.13 using all default settings.
JetPack 6 for Jetson Orin devices ships with CUDA 12.6, so we need to backtrack from that.
pip3 install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu126
.\.venv\Scripts\activate pip install --upgrade pip pip install opencv-pyhttps://download.pytorch.org/whl/cu126
pip install ouster-sdk==0.14 --force-reinstall
pip install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu118 --force-reinstallpip install detectron2 -f https://dl.fbaipublicfiles.com/detectron2/wheels/cu118/torch2.0/index.html
pip install 'git+https://github.com/facebookresearch/detectron2.git'
Bottleneck BeamUniformityCorrector
This is a function from an older version of ouster client, no longer there in the actual version. Check with Gemini:
In the Ouster SDK, the BeamUniformityCorrector (often found within internal or "underscore" modules like ouster._utils or related C++ bindings) is a utility designed to address inconsistencies in the signal or reflectivity data across different beams of an Ouster lidar sensor.
Here's a breakdown of what it generally does:
- Corrects Beam-to-Beam Variations: Lidar sensors, including Ouster's, use multiple laser beams to scan an environment. Due to manufacturing tolerances or optical properties, the raw intensity or reflectivity measurements from these individual beams might not be perfectly uniform, even when hitting the same type of surface at the same distance. This can manifest as subtle "striping" or intensity variations in the generated 2D imagery (e.g., reflectivity images).
- Enhances Image Quality: By applying a uniformity correction, the BeamUniformityCorrector aims to equalize these differences. This results in more consistent and visually appealing reflectivity or signal images, which can be beneficial for downstream computer vision or perception tasks that rely on consistent intensity values.
- Improves Data for Algorithms: For algorithms that process the 2D reflectivity or signal data (like object detection, segmentation, or classification), a uniform appearance across beams can lead to better performance and more robust results.
- Internal Preprocessing: While not always explicitly part of the public-facing API, these types of correctors are often used internally by the Ouster SDK, for instance, when generating processed images for visualization or for specific data layers that are meant to be consistent.
In essence, the BeamUniformityCorrector helps to ensure that the data from each laser beam is calibrated and consistent with the others, providing a more normalized and useful representation of the scene's reflectivity or signal.
Updating dependencies
It was a a bit of a challenge to have detectron2 being in harmony with CUDA.
Also Ouster SDK needs to be version 0.14.0.
I managed to create a new virtual environment and create a requirements.txt from that.
We'll need to verify this by deleting pedvenv and adding requirements.txt.
Last hurdle to take is pybind which is used to couple with the GPC360 measurements.
PyBind
Pybind allows to connect to gpc360_py_sdk.cp39-win_amd64.pyd.
Quick and easy way : Add to PYTHONPATH Environment Variable
We can do this by running the next line in terminal after activating the virtual environment
$env:PYTHONPATH = "C:\XAI;" + $env:PYTHONPATH
This allows to test Final.py, it is not a longterm solution as activate.ps1 is not under git.
Longterm GIT robust way