Structural Knowledge-Based Anomaly Detection to Inspect Ball-Based Lens Actuators
https://doi.org/10.1109/ACCESS.2025.3622686
IEEE Access 2025, 13, 184110-184121
ISSN:2169-3536
eISSN:2169-3536
The repository is organized as follows:
custom/: custom defined moduledetector: proposal Structural AD model
datasets/: dataset folderBALL: Structural AD datasets; https://doi.org/10.21227/mysd-9b62ball: default datasetsenhanced_ball: Augmented dataset
results/: results storage folderanomaly_detection.ipynb: training and testing all modelsimg_enhancing.ipynb: Create enhanced image datasetsenhanced_ballfordetector
Image of faulty modules target to ball missing inspection collected at the optical cross-section inspection site:
| Dataset | Task | Size | Normal | Anomalies |
|---|---|---|---|---|
| BaLL | Anomaly Detection | 2352 x 2944 | 10,183 | 1,755 |
from custom.data import Ball, MVTec
from custom.models import Patchcore, EfficientAd, Detector
from custom.engine import Engine
options = {}
method = 'Detector' # EfficientAd Patchcore EfficientAd Dinomaly
if method != 'Patchcore':
options['train_batch_size'] = 1
category = 'ball' # enhanced_ball
if 'ball' in category:
options['category'] = category
datamodule = Ball(**options) if category == 'ball' or category == 'enhanced_ball' else MVTec(**options)
model = Patchcore() if method == 'Patchcore' else EfficientAd() if method == 'EfficientAd' else Detector
engine = None
if method == 'patchcore':
engine = Engine()
elif method == 'Detector':
engine = Engine(is_detector=True)
elif method == 'EfficientAd':
engine = Engine(max_epochs=10)
engine.fit(datamodule=datamodule, model=model)
if 'ball' in category:
datasets_name = 'Ball'
else:
datasets_name = 'Mvtec'
predictions = engine.predict(
datamodule=datamodule,
model=model,
ckpt_path=f'./results/{method}/{datasets_name}/{category}/lastest/weights/lightning/model.ckpt',
return_predictions=True,
)
engine.report()* To run the code, you need to have Python 3.10.
If you use our code, please cite the paper below:
@article{jeon2025structural,
title={Structural Knowledge-based Anomaly Detection to inspect Ball-based Lens Actuators},
author={Jeon, Janggun and Ahn, Junho and Kim, Namgi},
journal={IEEE Access},
volume={13},
number={},
pages={184110-184121},
year={2025},
publisher={IEEE}
}