CorkHSI: Hyperspectral Anomaly Detection in Corks Using an Autoencoder

In industrial quality inspection, many cork defects are difficult to detect reliably using standard RGB cameras alone. Scratches, holes, insect damage, glue residues, oil stains, water marks, plastic, sticks, and other foreign materials can appear subtly on the surface or become visible only through material-specific spectral responses. That is where CorkHSI comes in: a hyperspectral dataset and research project for anomaly detection and segmentation in cork sheets. CorkHSI was collected for semi-supervised anomaly detection, where models learn from normal cork samples and identify defects during testing.

Hyperspectral Defect Detection

Traditional machine-vision systems are powerful for visible surface inspection, but they can miss defects that are not clearly visible in RGB images. Cork is a natural material with heterogeneous texture, pores, and spectral variation, which makes defect detection more challenging. Hyperspectral imaging helps by capturing both spatial information and spectral signatures, allowing the system to detect material-level differences that may not be obvious in ordinary images.

This is especially useful for cork sheets, where production-related defects can include both physical anomalies, such as cracks, holes, and scratches, and chemical or contamination-related anomalies, such as glue, oil, water, insects, plastic, sticks, and external materials.

Introducing CorkHSI

CorkHSI is a hyperspectral dataset designed for defect detection, localization, and segmentation in cork sheets. The dataset contains near-infrared hyperspectral images captured using a SPECIM FX17 line-scan camera, with each cork sheet represented as a hyperspectral cube with 224 spectral bands.

The dataset follows a semi-supervised anomaly detection setup. The training set contains only normal cork samples, while the test set contains both normal and anomalous samples. Pixel-level ground-truth masks are also provided for defective regions, making the dataset useful for both image-level anomaly detection and pixel-level anomaly segmentation.

A Reconstruction-Based Method for Cork Defect Detection

Along with the dataset, CorkHSI includes a reconstruction-based hyperspectral anomaly detection method. The model is trained only on normal cork samples and learns to reconstruct defect-free hyperspectral cubes. During testing, defective regions are identified by comparing the original hyperspectral cube with the reconstructed one. Regions that cannot be reconstructed accurately are highlighted as anomalies.

The proposed method uses a UNETR-based autoencoder, combining a Vision Transformer encoder with a 3D convolutional decoder. The model is designed to capture both spectral and spatial information from hyperspectral cork data. A hybrid loss function combining Mean Squared Error, Spectral Angle Mapper, and 3D Structural Similarity is used to improve reconstruction quality and make the anomaly maps more sensitive to both chemical and structural defects.

What Makes CorkHSI Useful?

CorkHSI was created to support research and development in industrial hyperspectral anomaly detection. It is useful because it provides:

  • real cork-sheet defects from production-related scenarios
  • both physical and chemical anomaly types
  • normal-only training data for semi-supervised anomaly detection
  • test samples with anomaly labels and pixel-level ground-truth masks
  • a public benchmark for comparing hyperspectral anomaly detection methods
  • an open-source implementation for training and evaluating reconstruction-based models

This makes CorkHSI relevant not only for academic research, but also for practical industrial inspection systems where collecting all possible defect types in advance is difficult.

Use Cases

CorkHSI can support a wide range of applications:

  • Cork quality inspection: identify defective cork sheets before further processing.
  • Industrial AI research: develop anomaly detection models trained only on normal samples.
  • Hyperspectral defect segmentation: evaluate pixel-level localization of defective areas.
  • Material inspection: study chemical and physical changes in natural materials.
  • Benchmarking: compare classical, deep-learning, and transformer-based anomaly detection methods.

Open and Accessible

The CorkHSI dataset is publicly available on Hugging Face, and the official implementation is available on GitHub. The repository includes the reconstruction-based anomaly detection pipeline, training and inference instructions, sample results, and model-related resources.

Final Thoughts

CorkHSI brings hyperspectral imaging into a practical benchmark for cork-sheet inspection. By combining a public dataset, pixel-level anomaly masks, and a reconstruction-based deep learning method, it provides a useful resource for researchers and engineers working on industrial defect detection, hyperspectral imaging, and unsupervised anomaly segmentation. For real-world inspection tasks where defects may be rare, subtle, or difficult to label, CorkHSI offers a strong starting point for building more reliable AI-based quality control systems.

Scroll to Top