Live data from Hacker News

By the Power of Grayscale

zserge.com

31–40 of 56 posts

Re: By the Power of Grayscale

#31
post #11

Earlier quoted context omitted.

But have a look at the "Thresholding" section. It appears to me that AI would be much better at this operation.

It indeed would be much better. There’s a reason the old CV methods aren’t used much anymore. If you want to anything even moderately complex, deep learning is the only game in town.

I’ve found exactly the opposite. In domain after domain the performance of a pure deep learning method is orders of magnitude less than that of either a traditional algorithm or a combination.

And often the CNNs are so finicky about noise or distortion that you need something as an input stage to clean up the data.

Re: By the Power of Grayscale

#32

Earlier quoted context omitted.

sure, if you don't mind it hallucinating different numbers into your image

Right, but the non-deep learning OCR methods also do that. And they have a much much lower overall accuracy. There’s a reason deep learning took over computer vision.

OCR is one of those places where you can just skip algorithm discovery and go straight to deep learning. But there are precious few of those kinds of places actually.

Re: By the Power of Grayscale

#33
post #22

If you enjoyed this post you may also like the 2024 book foundations of computer vision: https://visionbook.mit.edu/ prior hn thread: https://news.ycombinator.com/item?id=44281506 i don't have any background in computer vision but enjoyed how the introductory chapter gets right into it illustrating how to build a limited but working simple vision system

Thanks for the reference. Looks very from-the-ground-up and comprehensive.

Re: By the Power of Grayscale

#34
post #27

Earlier quoted context omitted.

It really depends on the application. If the illumination is consistent, such as in many machine vision tasks, traditional thresholding is often the better choice. It’s straightforward, debuggable, and produces consistent, predictable results. On the other hand, in more complex and unpredictable scenes with variable lighting, textures, or object sizes, AI-based thresholding can perform better. That said, I still pref…

Not to mention performance. So often, the traditional method is the only thing that can keep up with performance requirements without needing massive hardware upgrades. Counter intuitively, I’ve often found that CNNs are worse at thresholding in many circumstances than a simple otsu or adaptive threshold. My usual technique is to use the least complex algorithm and work my way up the ladder only when needed.

I am usually working with historical documents, where both Otsu and adaptive thresholding are frustratingly almost but not quite good enough. My go-to approach lately is "DeepOtsu" [1]. I like that it combines the best of both the traditional and deep learning worlds: a deep neural net enhances the image such that Otsu thresholding is likely to work well.

[1] https://arxiv.org/abs/1901.06081

Re: By the Power of Grayscale

#35
post #27

Earlier quoted context omitted.

Not to mention performance. So often, the traditional method is the only thing that can keep up with performance requirements without needing massive hardware upgrades. Counter intuitively, I’ve often found that CNNs are worse at thresholding in many circumstances than a simple otsu or adaptive threshold. My usual technique is to use the least complex algorithm and work my way up the ladder only when needed.

I am usually working with historical documents, where both Otsu and adaptive thresholding are frustratingly almost but not quite good enough. My go-to approach lately is "DeepOtsu" [1]. I like that it combines the best of both the traditional and deep learning worlds: a deep neural net enhances the image such that Otsu thresholding is likely to work well. [1] https://arxiv.org/abs/1901.06081

Ok. Those are impressive results. Nice addition to the toolbox

Re: By the Power of Grayscale

#36

It may come as a surprise to some that a lot of industrial computer vision is done in grayscale. In a lot of industrial CV tasks, the only things that matter are cost, speed, and dynamic range. Every approach we have to making color images compromises on one of those three characteristics. I think this kind of thing might have real, practical use cases in industry if it's fast enough.

Ah, I think you work in the same industry as me, machine vision. I completely agree with you, most applications use grayscale images unless it’s color-based application. Which vision library are you using? I’m using Halcon by MVTec.

I used to work in industrial automation, I was mostly making the process control equipment that your stuff would plug into. PLCs and whatnot. We had a close relationship with Cognex, I don't remember the exact details of their software stack.

Re: By the Power of Grayscale

#37
post #27

Earlier quoted context omitted.

It really depends on the application. If the illumination is consistent, such as in many machine vision tasks, traditional thresholding is often the better choice. It’s straightforward, debuggable, and produces consistent, predictable results. On the other hand, in more complex and unpredictable scenes with variable lighting, textures, or object sizes, AI-based thresholding can perform better. That said, I still pref…

Not to mention performance. So often, the traditional method is the only thing that can keep up with performance requirements without needing massive hardware upgrades. Counter intuitively, I’ve often found that CNNs are worse at thresholding in many circumstances than a simple otsu or adaptive threshold. My usual technique is to use the least complex algorithm and work my way up the ladder only when needed.

Something I've had a lot of success with (in cases where you're automating the same task with the same lighting) is having a human operator manually choose a variety of in-sample and out-of-sample regions, ideally with some of those being near real boundaries. Then train a (very simple -- details matter, but not a ton) local model to operate on small image patches and output probabilities for each pixel.

One fun thing is that with a simple model it's not much slower than techniques like otsu (you're still doing a roughly constant amount of vectorized, fast math for each pixel), but you can grab an alpha channel for free even when working in colored spaces, allowing you to near-perfectly segment the background out from an image.

The UX is also dead-simple. If a human operator doesn't like the results, they just click around the image to refine the segmentation. They can then apply directly to a batch of images, or if each image might need some refinement then there are straightforward solutions for allowing most of the learned information to transfer from one image to the next, requiring much less operator input for the rest of the batch.

As an added plus, it also works well even for gridlines and other stranger backgrounds, still without needing any fancy algorithms.

Re: By the Power of Grayscale

#38
post #11
post #8

Appreciate the old school non-AI approach.

But have a look at the "Thresholding" section. It appears to me that AI would be much better at this operation.

It can benefit from more complex algorithms, but I would stay away from "AI" as much as possible unless there is indeed need of it. You can analyse your data and make some dynamic thresholds, you can make some small ML models, even some tiny DL models, and I would try the options in this order. Some cases do need more complex techniques, but more often than not, you can solve most of your problems by preprocessing your data. I've seen too many solutions where a tiny algorithm could do exactly what a junior implemented using a giant model that takes forever to run.
Post reply on HN