ADVIS_UniGra is a research repository for reconstruction-based visual anomaly detection in collaborative robotic environments. It supports safety-area training, threshold calibration, and inference using VAE-GAN models.
This repository provides the anomaly detection pipeline developed for DistriMuSe UC3: Safe Interaction with Robots. The system monitors predefined safety areas such as the robot arm, conveyor belt, and personnel zones. A VAE-GAN model is trained on normal data, and unexpected conditions are detected using reconstruction-based anomaly scores.
Raw Frames / Video
↓
Safety-area preprocessing
↓
VAE-GAN training
↓
Threshold calibration
↓
Inference and evaluation
- VAE-GAN based visual anomaly detection
- Per-safety-area model training
- Validation-based and labelled-test threshold calibration
- Config-driven experiments using
configs/config.yaml - Installable Python package named
advis - CLI commands for training, calibration, and inference
- Support for preprocessed frames, raw frames, videos, and camera streams
- Folder-level README files for easier navigation
| Area | Description |
|---|---|
RoboArm |
Robot arm safety region |
ConvBelt |
Conveyor belt safety region |
PLeft |
Left personnel safety region |
PRight |
Right personnel safety region |
ALL |
Run all available safety areas |
ADVIS_UniGra/
├── advis/
│ ├── config.py
│ ├── data.py
│ ├── models.py
│ ├── scoring.py
│ ├── utils.py
│ └── cad_utils.py
├── configs/
│ └── config.yaml
├── scripts/
│ ├── train.py
│ ├── calibrate_threshold.py
│ └── inference.py
├── docs/
├── data/
├── results/
├── pyproject.toml
├── requirements.txt
└── README.md
git clone https://github.com/rashidrao-pk/advis_distrimuse_unito.git
cd advis_distrimuse_unitoconda create -n advis python=3.9 -y
conda activate advisFor CUDA 11.8:
conda install pytorch torchvision torchaudio pytorch-cuda=11.8 -c pytorch -c nvidia -yFor CPU only:
conda install pytorch torchvision torchaudio cpuonly -c pytorch -ypip install -e .This installs the package name advis and provides these CLI commands:
advis-train
advis-calibrate
advis-inferAll default paths and parameters are stored in:
configs/config.yaml
Important fields:
data:
dataset_version: V6
dataset_type: fronttop
model:
latent_dim: 64
training:
epochs: 1000
batch_size: 32
threshold:
score_method: max
offset: 1
sigma: 1.0
quantile: 1.0You can still override most values from the command line.
Train one safety area:
advis-train --config configs/config.yaml --safety_area RoboArmTrain all safety areas:
advis-train --config configs/config.yaml --safety_area ALLOverride parameters:
advis-train \
--config configs/config.yaml \
--safety_area PLeft \
--epochs 500 \
--batch_size 32Equivalent script command:
python scripts/train.py --config configs/config.yaml --safety_area RoboArmUse this when only normal validation data is available.
advis-calibrate \
--config configs/config.yaml \
--mode val \
--safety_area ALLUse this when labelled normal/anomalous test data is available.
advis-calibrate \
--config configs/config.yaml \
--mode test \
--safety_area ALL \
--gt_csv scripts/data/annotations/anom_metadata_unexpected_person.csvCalibration outputs are saved under:
results/thresholds/
Run inference on preprocessed frames:
advis-infer \
--config configs/config.yaml \
--data_source preprocessed \
--input_dir data/test_processed/unexpected_person \
--safety_area RoboArmRun inference on all safety areas:
advis-infer \
--config configs/config.yaml \
--data_source preprocessed \
--input_dir data/test_processed/unexpected_person \
--safety_area ALLRun inference on video:
advis-infer \
--config configs/config.yaml \
--data_source video \
--input_video data/videos/test_video.mp4 \
--safety_area ALLRun inference and save figures:
advis-infer \
--config configs/config.yaml \
--data_source preprocessed \
--input_dir data/test_processed/unexpected_person \
--safety_area ALL \
--save_figures| Dataset | Source | Description |
|---|---|---|
| Synthetic Palletizing | University of Granada, Valeria Lab | Synthetic collaborative robotics dataset for DistriMuSe UC3 |
Dataset generation tool:
https://github.com/valerialabugr/SimIndus-Dataset
results/
├── models/
├── thresholds/
├── training/
├── inference/
└── logs/
Large checkpoints and generated outputs should not be committed to Git.
The active scripts now import only from the installable advis package. The old notebook utility files are removed from the runtime path. Reusable code is organized into advis.models, advis.cad_utils, advis.scoring, advis.data, and advis.config.
Coming Soon
This work is developed in the context of the DistriMuSe project on distributed multi-sensor systems for human safety and health.
Anomaly Detection · VAE-GAN · Explainable AI · Industrial Safety · Collaborative Robotics · Computer Vision · Human-Robot Interaction