SAIM Distortion Injection
The Debian package ships a test suite that injects synthetic camera faults, such as blur, fog, occlusion or a colour cast, into the camera streams of a running VSS deployment. Use it to check that the Safety AI Monitor (SAIM) reports each fault, that the decision makers react, and that everything recovers when the fault ends. It does not change the VSS configuration or its stored state.
The suite is installed in /opt/nvidia/psf/tests/saim_distortion/.
Use it only on a test deployment. While it runs, VST, perception and SAIM see the relayed and distorted streams instead of the original ones, and both starting and stopping it latch the safe state of every decision maker. Never run it on a site where the safety function is in use.
How it works
An effect ramps in over the attack time, holds, and ramps out over the release time, because a real camera degrades gradually rather than in one step. The defaults are a 10 s effect with 2 s ramps.
The suite works only for cameras that NVStreamer serves from video files, such as the VSS warehouse demo datasets. It reads the ingest port of each camera from NVStreamer’s API and redirects only those ports. Live cameras are not affected.
Requirements
Start
-
Copy the suite to a working directory.
-
Start the relay, the distortion service, the recorder and the redirect.
<video-dir>is the directory of source videos, for example~/video-search-and-summarization/vss-warehouse-app-data_v3.2.0/vss-warehouse-app-data/videos/warehouse-loading-dock-3cams-synthetic.Expected:
UP: <n> cameras distorted, then the control-panel snippet. Allow 1–2 minutes for VST to switch over. If a camera looks corrupted in the VST browser tab, hard-refresh the page: the viewer freezes until the next keyframe after an ingest switch. -
Check the state.
Expected:
distortion service: running,healthy: True, one line per camera withconnected=True, andbbox recorder: running.
Switching VST to the relay reconnects every camera, which SAIM reports as a stream disconnect, and every decision maker latches its safe state. This is expected; release it from the command receiver once the cameras are healthy again, as described in Release a latched safe state.
If up fails part way, it removes everything it has started.
Inject a fault
From the command line:
Examples:
clear ends every active effect at once.
From the browser: open VST, open the browser console on the VST page, and paste the snippet
that up printed:
The panel lets you pick a camera and an effect, trigger it, clear it, and switch recording on
or off (REC).
blur, motion_blur, fog and condensation are held back below full strength, so the frame
still looks like a degraded camera rather than a blank one.
What to expect
- SAIM. A strong enough effect lowers the camera’s frame score. SAIM reports
SENSOR_INVALIDwith causeSAIM_INPUT_DEGRADEDonce its debounce counter fills, after about 0.2 to 7.5 s at 30 frames per second depending on how bad the frames are. After the effect ends, it reportsSENSOR_VALIDafter a run of good frames. Mild effects, or short ones, can pass without a verdict. An effect on part of the frame only, such asocclusion, counts only after the area has stayed changed for about 5 s, so give it 15 s or more. See Verdicts and timing. - Where to see it. SAIM writes no log line for a frame-score verdict. Each reference SDM
logs
safety-sensor health change pipelineID=<id> state=FAILED|RECOVERED cause=<n>for the cameras in its reviewed set. - Decision makers. A single degraded camera marks that camera’s events as untrusted but does
not latch the safe state. When every camera in an SDM’s reviewed set is invalid, for example
after
trigger all, the SDM latches. See Safe-state model. - Perception. Detections can thin out or disappear under a strong effect. That is perception reporting truthfully, not a fault in the suite. The Perception Monitor (PCM) checks the perception output and can report the pipeline invalid as well.
- Detection counts.
./vss_distortion.sh monitor [seconds]reads themdx-rawtopic for 8 s by default and prints, for each camera, the number of detected objects of one class per frame:Pallet, or the class set inVSS_DETECTION_LABEL.
Recordings
up starts the recorder. Each injection is saved in ~/distortion_recordings as
<camera>_<effect>_<timestamp>.mp4, with the perception boxes drawn on and 5 s of footage
before the fault. An injection on several cameras also produces wall_<effect>_<timestamp>.mp4,
with every camera tiled side by side. The oldest injections are deleted whole once the folder
passes 10 GiB.
record off, or REC in the panel, stops saving new injections without stopping the recorder;
a capture already under way still finishes.
Stop
down removes the redirect, stops the recorder and the distortion service, removes the relay
container, and restarts the NVStreamer container (vss-vios-nvstreamer) so that the original
videos play again. It then waits up to 100 s for VST to reconnect.
Expected: DOWN: distortion removed, original videos restored. If it reports that VST has not
reconnected yet, VST keeps retrying on its own.
The switch back also reconnects every camera, so the decision makers latch again. Release the latch once SAIM reports the cameras valid.
Settings
./vss_distortion.sh --help lists every setting and the values in use.