Hey everyone!
A little update on VisionQC!
If you've come across my previous post, you'll know that I started this project with a simple idea: build an AI-based system that can detect defective bottles using computer vision.
At the time, I was experimenting with convolutional autoencoders, training them on normal bottle images and using reconstruction errors to identify defects.
Well, things have moved forward a bit since then!
So, what changed?
After spending more time researching anomaly detection approaches and experimenting with the initial model, I decided to give PatchCore a shot.
I'm using the MVTec AD Bottle dataset, and PatchCore seemed like a promising approach for this particular problem.
Without getting too deep into the technical details, PatchCore works by extracting features from image patches and building a memory bank of normal patterns. During inference, it compares the features of a new image against those stored patterns to identify anything unusual.
Getting it implemented and running took some experimenting, but I finally got it working!
And how are the results looking?
Honestly, much better than I initially expected.
I evaluated the model on 83 test images:
20 normal bottle images
63 defective bottle images across different defect categories
Here are the image-level evaluation results:
Metric Result
Accuracy 100%
Precision 100%
Recall 100%
F1-score 100%
ROC-AUC 1.00
All 83 test images were classified correctly, with no false positives or false negatives.
I've attached a few screenshots showing the predictions, anomaly maps and evaluation results.
But there's still work to do.
While the image-level classification results are looking really promising, I'm still working on improving defect localisation.
Identifying whether a bottle is defective is one thing. Getting the model to accurately highlight exactly where the defect is, especially around the edges and rim of the bottle, is another challenge.
That's something I want to spend more time on before moving forward.
I'm also aware that getting 100% on this particular test set doesn't mean the system is ready for real-world industrial use. There's still a lot to explore in terms of generalisation, different defect types and testing under more realistic conditions.
What's next?
I want to spend more time on pixel-level localisation, experiment with feature extraction and see how much further I can push the results.
I'm also keen to explore what it would take to make this a more practical quality inspection system rather than just a model that performs well on a dataset.
I'd love to hear your thoughts!
For those who've worked with PatchCore or industrial anomaly detection:
What would you suggest trying to improve localisation around edges?
Would experimenting with higher-resolution feature layers or overlapping crops be a good next step?
What else would you focus on before considering something like this for an actual production environment?
I'm still learning a lot through this project, so any suggestions, criticism or ideas are more than welcome.
GitHub repository: https://github.com/anupam-17/VisionQC



