ai-toolbox
deep dive into applications and algorithms
An AI powered vision system for real-time defect detection
Applications in additive manufacturing with Powder Bed Fusion and Direct Energy Deposition
Production Data
Testing Data
Raw Data - Training
High resolution cameras pictures in light enclosures of printed parts. Acquired from the actual production line.
Learn moreRaw Data - Testing/Production
High resolution cameras pictures in light enclosures of printed parts. Acquired from the actual production line.
Preprocessing - Training Data
Feature engineering on the images to extract different color-based features and feature importance test. Once completed, the testing of different model types is executed and selection is based on their metrics. If data clearing is necessary it is executed otherwise the model is ready for deployment.
Learn morePreprocessing - Testing/Production Data
After the initial model is deployed, a new dataset is created involving more shapes, sizes and environmental lighting to test/validate the model in more unseen data.
Dataset - Training
The training dataset consists of JPG images of PBF printed parts in a white background in four different lighting conditions. The labelling was contacted
Learn moreDataset - Testing/Production
The testing/validation dataset consists of JPG images of PBF printed parts in a white background in four different lighting conditions and more variations in shape and size than the training dataset. The labelling was contacted of domain-experts and the instances were categorized as OK and NOT_OK.
Model Training
Initially the data were processed for lighting issues, if the image brightness is below a pre-specified threshold then it was adjusted. After this, different color-based features were extracted and tested based on feature importance tests. Three of them were kept and used for model training. With these features, different model types were trained (e.g. SVMs, KNN, NNs) and the one with the best performance was kept. After the first training and once the testing/validation dataset was completed, a second training phase was done including also this dataset and the model was re-deployed(after the validation was completed).
Learn moreTrained Model
The trained model was a SVM using a RBF kernel and three features, the standard deviation of hue, the standard deviation of saturation and the entropy of hue. It was trained based on 468 instances with 234 of them being OK and the rest 234 as NOT_OK. A 70/30 training/testing ratio was used for overfitting protection. Results showed a 96.32% accuracy and specific low false-positive rate, being important to not pass defective parts down the production line.
Learn moreModel Testing
Once the first model version was completed and a new dataset was created, all the instances were fed and the predictions were acquired. In this dataset the results showed ~86% accuracy with only 2 out of 14 instances being wrong predicted. As the results were satisfactory, the model was re-trained with all the available data and re-deployed
Learn moreTested Model
The final model was trained on 530 instances following the same above-mentioned algorithms and re-deployed in the server. The final algorithm is expects a JPG image as input, checks for brightness issues and corrects if any, extracts features and pass them into the model making a prediction. The overall workflow was calculated at around 500ms time with most of it being the image processing and feature extraction actions.
Learn moreMotivation
The experiment aims to design, implement, and validate an AI-based quality assurance system called ADDIVISION, focused on real-time defect detection in metal additive manufacturing, particularly within Powder Bed Fusion (PBF) and Direct Energy Deposition (DED) processes. The core goal is to improve efficiency, accuracy, and consistency in the inspection process by leveraging computer vision and machine learning, while simultaneously reducing the time required for inspections, minimizing scrap rates, and enhancing the quality of final products.
Objective
Development of a hardware setup, including high-resolution cameras and light-controlled enclosures (inspection kiosk), to capture standardized and repeatable images of printed parts. These will ensure accurate data input for AI analysis and eliminate variability caused by lighting or user interaction.
Training and deployment of classical ML model, such as SVM or Decision Trees, to automatically detect the discoloration defect which is correlated with other structural defects such as cracks and pores. These models will be trained on historical data and refined using new annotated images captured during the experiment.
Different image features will be explored and tested in order to find the most suitable ones for the final model. This approach will achieve both fast prediction times and model transparency and interpretability.Connection with BALMAR’s digital infrastructure, including integration with in-house MES/DigiAM software, enabling seamless data exchange, traceability of inspection results, and long-term dataset generation for further AI training and continuous process improvement.
Deployment and testing of the complete system in a live production environment, with feedback loops between the AI model, operators, and cloud-based analytics to continuously improve defect recognition and minimize false positives.
Use of AI
Development of a hardware setup, including high-resolution cameras and light-controlled enclosures (inspection kiosk), to capture standardized and repeatable images of printed parts. These will ensure accurate data input for AI analysis and eliminate variability caused by lighting or user interaction.
Training and deployment of advanced AI models, such as convolutional neural networks (CNNs), to automatically detect common surface-level defects (e.g. discoloration, cracks, pores, warping). These models will be trained on historical data and refined using new annotated images captured during the experiment.
Integration of IoT and metadata, including luminosity levels, part orientation, and build parameters, to enrich the AI model with contextual data, thereby improving prediction accuracy and supporting traceability.
Connection with BALMAR’s digital infrastructure, including integration with in-house MES/DigiAM software, enabling seamless data exchange, traceability of inspection results, and long-term dataset generation for further AI training and continuous process improvement.
Deployment and testing of the complete system in a live production environment, with feedback loops between the AI model, operators, and cloud-based analytics to continuously improve defect recognition and minimize false positives.
Service reciever company
BALMAR d.o.o
https://balmar.siDescription
Company BALMAR d.o.o. is a privately owned Small and medium-sized enterprise (SME), established in 2008 and located in Celje, Slovenia, Europe. Major scope of company activities is focused into following industry sectors: Aviation sector – airline business, aviation consulting and training in aviation Space sector – space R&D activities, manufacturing and implementation of advanced metal parts Additive manufacturing – technology development and implementation, service provider and technology consulting. Our philosophy is to provide to our customers the most optimal, high-quality solutions, services and products with higher added value.
Company offering
- Additive manufacturing
- Advanced metal parts manufacturing
Project Results
- 30% reduction in manual inspection time
- 15–20% decrease in scrap and rework, and
- a payback period of approximately two years, supported by reduced waste and increased product quality.
Model achieved 96.32% accuracy with <1 sec prediction time.
Model is able to detect discoloration of PBF parts with low prediction times, high accuracy, and independent of the shape and lighting conditions. By utilizing a classical ML model type the predictions can be easily interpretable, supporting decision-making actions.
Figures
Data
Raw Data
Raw data collection
Ensuring a reliable data flow between the camera, the local kiosk, and the remote prediction API was critical. The solution involved automatic transfer of images from the Sony A6400 camera to a designated folder, triggering the API pipeline. The complete round-trip (image capture → upload → AI prediction → result display) was optimized to remain below 3 seconds, ensuring usability on the production line.
Raw data description
JPG images of PBF printed parts in a white background in four different lighting conditions and variations in shape and size of the components.
Data preprocessing
Processing description
To address lighting inconsistencies, the CLAHE algorithm was applied. CLAHE enhances local contrast by performing histogram equalization on small regions while limiting noise amplification, making it effective for uneven illumination and subtle surface variations. Importantly, it preserves hue and saturation relationships, which are critical for subsequent feature engineering. To further reduce image noise, the brightness-enhanced samples were processed using edge detection. A Gaussian blur was first applied to suppress noise, followed by Canny edge detection. The largest connected component was retained and used as a binary mask for the original image.
Feature engineering
Hue, saturation, and RGB values were selected as primary features due to their direct relation to discoloration. In addition to raw pixel values, descriptive colour features such as hue distributions and colour histograms were extracted to capture chromatic variations associated with oxidation or thermal effects. To better represent global sample characteristics, statistical descriptors including the mean and standard deviation of each colour channel were computed. Additionally, hue entropy was used as a higher-level metric to quantify colour variability, where higher entropy indicates greater surface irregularity or potential discoloration. To retain the most discriminative features, a feature selection strategy was applied based on variance, correlation with defect labels, and impact on model performance. This process resulted in a compact and interpretable feature set with strong predictive capability, consisting of the standard deviation of hue, the standard deviation of saturation, and hue entropy.
Algorithms
Contrast enhancement
Enhances local contrast by performing histogram equalization on small regions while limiting noise amplification, making it effective for uneven illumination and subtle surface variations
Raw Data
Data preprocessing
Datasets
Image data of PBF printed parts
License:
Unknown
Size
468 JPG images
Trained model/s
Model types
Model selection
Fast and explainable model type with easy train and deployment steps.
Hardware used for training
PC with Inter i5 10th gen processor and 2070RTX GPU trained using Python and Matlab.
Model training
Using the first version of the dataset, the model was trained on 468 instances using different model types. As the SVM showed the best performance, it was exported and deployed in the cloud server.
Loss function
- Hinge Loss, penalizes the model when it puts a data point on the wrong side of the boundary.
- Log Loss, penalizes predictions that are correct but uncertain (e.g., "51% sure"), and heavily penalizes the model if it is highly confident but completely wrong
Model testing
- Using the new dataset that was created the model was tested on 62 images and the results showed a ~86% accuracy. This dataset was implemented on the initial one and then the final model was re-trained and re-deployed using 530 instances.
Testing metrics
The testing of the model showed 2 out of 14 false predicted samples both for OK and NOT_OK classes indicating a 85.71% accuracy, precision and F1-score.
Tested model
The final was is light and fast, with 7kB overall size and 200ms inference time. Additionally, it achieved a 96% accuracy during the training phase while the overall feature engineering and prediction time was calculated <1 second.