Following the Industrial Revolutions 4.0 and 5.0, the assembly industry faces mounting pressure to reduce costs and boost efficiency using AI‑driven solutions. Modern screwdriver systems generate real‑time angle‑torque data that form tightening curves, which must be frequently recalibrated and inspected to prevent defective assemblies. We propose modeling normal screwing profiles with unsupervised AutoEncoders (AE) to detect deviations indicative of faults, complemented by intuitive visual analytics. Our Python module, Screw Process Anomaly Visualization (SPAV), offers functions for creating four types of plots—Global Error, Local Error, Detected Anomalies and Anomaly Density via KDE—to support operators in understanding and validating anomaly detection. SPAV integrates seamlessly with the Scientific Python ecosystem and is compatible with H2O and Keras AE models.
The quality assessment of tightening curves is especially important in anomaly detection because the screw tightening process is inherently dynamic, requiring frequent updates to defect catalogs and recalibration of screwing zones. Although defects are rare, detailed and automated inspection is essential to prevent faulty assemblies from progressing along the production line.
Screw Process Anomaly Visualization (SPAV) is a Python software module that was recently developed to address the specific challenge of performing a data-driven support to the calibration of screwing machines in manufacturing environments, which is a frequent issue in real-world industrial manufacturing settings. The primary goal of SPAV is to provide a suite of XAI visualization techniques (e.g. density plots) that enable users of all levels of expertise to easily identify critical anomalous points that arise during the screwing process from existing predictive ML models.
An executable example is available on Code Ocean. We invite users to run and verify the reproducible example to better understand how to operate the module and which types of plots can be obtained through its functions, as well as how to customize them.
All files required for running SPAV are under the spav folder of this repository.
First, we recommend installing the dependencies for this project, which are listed in a pip-friendly way in requirements.txt. From within the spav directory, execute in the command line:
pip install requirements.txtFollowing that, users can import spav from within their project directory containing the spav directory, either in full, per-module or per-function:
import spav
from spav import auxiliary functions
from spav.plot_functions import plot_reconstructionPlot functions are available under the plot_functions component of the spav module, while auxiliary_functions contain functions to help users in the data preprocessing stage.
Given a compatible AutoEncoder model and a preprocessed angle-torque pair dataset, users can create a global error plot that shows all screwing processes in the dataset colored by their (by default, normalized) anomaly scores:
from spav.auxiliary_functions import get_anomaly scores
from spav.plot_functions import plot_global_error
anomaly_df = get_anomaly_scores(model, screwing_df)
plot_global_error(test_df, anomaly_df, y="torque")
Marta Moreno