Close Menu
    Trending
    • Dispatch: Partying at one of Africa’s largest AI gatherings
    • Topp 10 AI-filmer genom tiderna
    • OpenAIs nya webbläsare ChatGPT Atlas
    • Creating AI that matters | MIT News
    • Scaling Recommender Transformers to a Billion Parameters
    • Hidden Gems in NumPy: 7 Functions Every Data Scientist Should Know
    • Is RAG Dead? The Rise of Context Engineering and Semantic Layers for Agentic AI
    • ChatGPT Gets More Personal. Is Society Ready for It?
    ProfitlyAI
    • Home
    • Latest News
    • AI Technology
    • Latest AI Innovations
    • AI Tools & Technologies
    • Artificial Intelligence
    ProfitlyAI
    Home » How Do Grayscale Images Affect Visual Anomaly Detection?
    Artificial Intelligence

    How Do Grayscale Images Affect Visual Anomaly Detection?

    ProfitlyAIBy ProfitlyAIJuly 24, 2025No Comments7 Mins Read
    Share Facebook Twitter Pinterest LinkedIn Tumblr Reddit Telegram Email
    Share
    Facebook Twitter LinkedIn Pinterest Email


    1. Introduction: Why grayscale pictures would possibly have an effect on anomaly detection.
    2. Anomaly detection, grayscale pictures: Fast recap on the 2 major topics mentioned on this article.
    3. Experiment setting: What and the way we evaluate.
    4. Efficiency outcomes: How grayscale pictures have an effect on mannequin efficiency.
    5. Pace outcomes: How grayscale pictures have an effect on inference pace.
    6. Conclusion

    1. Introduction

    On this article, we’ll discover how grayscale pictures have an effect on the efficiency of anomaly detection fashions and study how this selection influences inference pace.

    In laptop imaginative and prescient, it’s properly established that fine-tuning pre-trained classification fashions on grayscale pictures can lead to degraded performance. However what about anomaly detection models? These fashions don’t require fine-tuning, however they use pre-trained classification fashions akin to WideResNet or EfficientNet as characteristic extractors. This raises an vital query: do these characteristic extractors produce much less related options when utilized to a grayscale picture?

    Picture taken from the VisA dataset (CC-BY-4.0) and processed utilizing Anomalib library

    This query isn’t just educational, however one with real-world implications for anybody engaged on automating industrial visible inspection in manufacturing. For instance, you would possibly end up questioning if a shade digital camera is important or if a less expensive grayscale one might be adequate. Or you may have issues relating to the inference pace and need to use any alternative to extend it.

    2. Anomaly detection, grayscale pictures

    If you’re already conversant in each anomaly detection in laptop imaginative and prescient and the fundamentals of digital picture illustration, be at liberty to skip this part. In any other case, it gives a short overview and hyperlinks for additional exploration.

    Anomaly detection

    In laptop imaginative and prescient, anomaly detection is a fast-evolving discipline inside deep studying that focuses on figuring out uncommon patterns in pictures. Sometimes, these fashions are skilled utilizing solely pictures with out defects, permitting the mannequin to be taught what “regular” appears like. Throughout inference, the mannequin can detect pictures that deviate from this discovered illustration as irregular. Such anomalies usually correspond to numerous defects that will seem in a manufacturing surroundings however weren’t seen throughout coaching. For a extra detailed introduction, see this link.

    Grayscale pictures

    For people, shade and grayscale pictures look fairly comparable (except for the dearth of shade). However for computer systems, a picture is an array of numbers, so it turns into a little bit bit extra sophisticated. A grayscale picture is a two-dimensional array of numbers, usually starting from 0 to 255, the place every worth represents the depth of a pixel, with 0 being black and 255 being white.

    In distinction, shade pictures are usually composed of three such separate grayscale pictures (known as channels) stacked collectively to type a three-dimensional array. Every channel (red, green, and blue) describes the depth of the respective shade, and its mixture creates a shade picture. You may be taught extra about this here.

    3. Experiment setting

    Fashions

    We’ll use 4 state-of-the-art anomaly detection fashions: PatchCore, Reverse Distillation, FastFlow, and GLASS. These fashions characterize several types of anomaly detection algorithms and, on the similar time, they’re extensively utilized in sensible functions resulting from quick coaching and inference pace. The primary three fashions use the implementation from the Anomalib library, for GLASS we make use of the official implementation.

    Picture by creator

    Dataset

    For our experiments, we use the VisA dataset with 12 classes of objects, which gives a wide range of pictures and has no color-dependent defects.

    Picture taken from the VisA dataset (CC-BY-4.0)

    Metrics

    We’ll use image-level AUROC to see if the entire picture was categorized appropriately with out the necessity to choose a specific threshold, and pixel-level AUPRO, which exhibits how good we’re at localizing faulty areas within the picture. Pace might be evaluated utilizing the frames-per-second (FPS) metric. For all metrics, larger values correspond to raised outcomes.

    Grayscale conversion

    To make a picture grayscale, we are going to use torchvision transforms.

    Picture by creator

    For one channel, we additionally modify characteristic extractors utilizing the in_chans parameter within the timm library.

    Picture by creator

    The code for adapting Anomalib to make use of one channel is offered here.

    4. Efficiency outcomes

    RGB

    These are common pictures with crimson, blue, and inexperienced channels.

    Picture by creator

    Grayscale, three channels

    Pictures had been transformed to grayscale utilizing torchvision remodel Grayscale with three channels.

    Picture by creator

    Grayscale, one channel

    Pictures had been transformed to grayscale utilizing the identical torchvision remodel Grayscale with one channel.

    Picture by creator

    Comparability

    We are able to see that PatchCore and Reverse Distillation have shut outcomes throughout all three experiments for each picture and pixel-level metrics. FastFlow turns into considerably worse, and GLASS turns into noticeably worse. Outcomes are averaged throughout the 12 classes of objects within the VisA dataset.

    What about outcomes per class of objects? Perhaps a few of them carry out worse than others, and a few higher, inflicting the common outcomes to seem the identical? Right here is the visualization of outcomes for PatchCore throughout all three experiments exhibiting that outcomes are fairly secure inside classes as properly.

    Picture by creator

    The identical visualization for GLASS exhibits that some classes may be barely higher whereas some may be strongly worse. Nonetheless, this isn’t essentially brought on by grayscale transformation solely; a few of it may be common end result fluctuations resulting from how the mannequin is skilled. Averaged outcomes present a transparent tendency that for this mannequin, RGB pictures produce the very best end result, grayscale with three channels considerably worse, and grayscale with one channel the worst end result.

    Picture by creator

    Bonus

    How do outcomes change per class? It’s doable that some classes are merely higher fitted to RGB or grayscale pictures, even when there are not any color-dependent defects.

    Right here is the visualization of the distinction between RGB and grayscale with one channel for all of the fashions. We are able to see that solely pipe_fryum class turns into barely (or strongly) worse for each mannequin. The remainder of the classes turn into worse or higher, relying on the mannequin.

    Picture by creator

    Further bonus

    If you’re all for how this pipe_fryum appears, listed below are a few examples with GLASS mannequin predictions.

    Pictures taken from the VisA dataset (CC-BY-4.0) and processed utilizing GLASS and Anomalib library

    5. Pace outcomes

    The variety of channels impacts solely the primary layer of the mannequin, the remainder stays unchanged. The pace enchancment appears to be negligible, highlighting how the primary layer characteristic extraction is only a small a part of the calculations carried out by the fashions. GLASS exhibits a considerably noticeable enchancment, however on the similar time, it exhibits the worst metrics decline, so it requires warning if you wish to pace it up by switching to at least one channel.

    Picture by creator

    6. Conclusion

    So how does utilizing grayscale pictures have an effect on visible anomaly detection? It relies upon, however RGB appears to be the safer guess. The affect varies relying on the mannequin and information. PatchCore and Reverse Distillation usually deal with grayscale inputs properly, however you should be extra cautious with FastFlow and particularly GLASS, which exhibits some pace enchancment but additionally probably the most vital drop in efficiency metrics. If you wish to use grayscale enter, you should check and evaluate it with RGB in your particular information.

    The jupyter pocket book with the Anomalib code: link.

    Observe creator on LinkedIn for extra on industrial visible anomaly detection.

    References

    1. C. Hughes, Transfer Learning on Greyscale Images: How to Fine-Tune Pretrained Models (2022), towardsdatascience.com

    2. S. Wehkamp, A practical guide to image-based anomaly detection using Anomalib (2022), weblog.ml6.eu

    3. A. Baitieva, Y. Bouaouni, A. Briot, D. Ameln, S. Khalfaoui, and S. Akcay. Beyond Academic Benchmarks: Critical Analysis and Best Practices for Visual Industrial Anomaly Detection (2025), CVPR Workshop on Visible Anomaly and Novelty Detection (VAND)

    4. Y. Zou, J. Jeong, L. Pemula, D. Zhang, and O. Dabeer, SPot-the-Difference Self-Supervised Pre-training for Anomaly Detection and Segmentation (2022), ECCV

    5. S. Akcay, D. Ameln, A. Vaidya, B. Lakshmanan, N. Ahuja, and U. Genc, Anomalib (2022), ICIP



    Source link

    Share. Facebook Twitter Pinterest LinkedIn Tumblr Email
    Previous ArticleGetting AI Discovery Right | Towards Data Science
    Next Article Robot, know thyself: New vision-based system teaches machines to understand their bodies | MIT News
    ProfitlyAI
    • Website

    Related Posts

    Artificial Intelligence

    Creating AI that matters | MIT News

    October 21, 2025
    Artificial Intelligence

    Scaling Recommender Transformers to a Billion Parameters

    October 21, 2025
    Artificial Intelligence

    Hidden Gems in NumPy: 7 Functions Every Data Scientist Should Know

    October 21, 2025
    Add A Comment
    Leave A Reply Cancel Reply

    Top Posts

    Evaluation-Driven Development for LLM-Powered Products: Lessons from Building in Healthcare

    July 10, 2025

    What misbehaving AI can cost you

    April 5, 2025

    Strength in Numbers: Ensembling Models with Bagging and Boosting

    May 15, 2025

    Beyond KYC: AI-Powered Insurance Onboarding Acceleration

    August 21, 2025

    What’s next for AI and math

    June 4, 2025
    Categories
    • AI Technology
    • AI Tools & Technologies
    • Artificial Intelligence
    • Latest AI Innovations
    • Latest News
    Most Popular

    How to Ensure Reliability in LLM Applications

    July 15, 2025

    DeepVerse 4D – AI som förstår världen i fyra dimensioner

    June 10, 2025

    AI Films Can Now Win Oscars, But Don’t Fire Your Screenwriter Yet

    April 23, 2025
    Our Picks

    Dispatch: Partying at one of Africa’s largest AI gatherings

    October 22, 2025

    Topp 10 AI-filmer genom tiderna

    October 22, 2025

    OpenAIs nya webbläsare ChatGPT Atlas

    October 22, 2025
    Categories
    • AI Technology
    • AI Tools & Technologies
    • Artificial Intelligence
    • Latest AI Innovations
    • Latest News
    • Privacy Policy
    • Disclaimer
    • Terms and Conditions
    • About us
    • Contact us
    Copyright © 2025 ProfitlyAI All Rights Reserved.

    Type above and press Enter to search. Press Esc to cancel.