识别数据模式的最佳方法是什么?了解该主题更多信息的最佳方法是什么?
与我合作的一位开发人员正在开发一个程序,该程序可以分析路面图像以查找路面裂缝。对于他的程序发现的每个裂缝,它都会在文件中生成一个条目,告诉我哪些像素构成了该特定裂缝。但他的软件有两个问题:
1)它会产生几个误报
2)如果他发现裂缝,他只能找到裂缝的一小部分,并将这些部分表示为单独的裂缝。
我的工作是编写软件来读取这些数据,对其进行分析,并区分误报和实际破解之间的区别。我还需要确定如何将裂缝的所有小部分组合在一起。
我尝试了各种过滤数据的方法来消除误报,并且使用神经网络将裂缝分组在一起,取得了有限的成功。我知道会有错误,但到目前为止,错误太多了。有谁对非人工智能专家有关于完成我的任务的最佳方式的见解或了解更多信息吗?我应该读什么类型的书,或者我应该参加什么类型的课程?
编辑 我的问题更多是关于如何注意到同事数据中的模式并将这些模式识别为实际的裂缝。我关心的是高级逻辑,而不是低级逻辑。
编辑 实际上,至少需要 20 张样本图像才能准确表示我正在使用的数据。变化很大。但我确实有一个示例这里,此处,以及这里。这些图像已经经过我同事的处理。红色、蓝色和绿色数据是我必须分类的数据(红色代表暗裂纹,蓝色代表浅裂纹,绿色代表宽/密封裂纹)。
A developer I am working with is developing a program that analyzes images of pavement to find cracks in the pavement. For every crack his program finds, it produces an entry in a file that tells me which pixels make up that particular crack. There are two problems with his software though:
1) It produces several false positives
2) If he finds a crack, he only finds small sections of it and denotes those sections as being separate cracks.
My job is to write software that will read this data, analyze it, and tell the difference between false-positives and actual cracks. I also need to determine how to group together all the small sections of a crack as one.
I have tried various ways of filtering the data to eliminate false-positives, and have been using neural networks to a limited degree of success to group cracks together. I understand there will be error, but as of now, there is just too much error. Does anyone have any insight for a non-AI expert as to the best way to accomplish my task or learn more about it? What kinds of books should I read, or what kind of classes should I take?
EDIT My question is more about how to notice patterns in my coworker's data and identify those patterns as actual cracks. It's the higher-level logic that I'm concerned with, not so much the low-level logic.
EDIT In all actuality, it would take AT LEAST 20 sample images to give an accurate representation of the data I'm working with. It varies a lot. But I do have a sample here, here, and here. These images have already been processed by my coworker's process. The red, blue, and green data is what I have to classify (red stands for dark crack, blue stands for light crack, and green stands for a wide/sealed crack).
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(12)
除了有关图像处理的有用评论之外,听起来您正在处理聚类问题。
聚类算法来自机器学习文献,特别是无监督学习。顾名思义,基本思想是尝试在一些大型数据集中识别数据点的自然聚类。
例如,下图显示了聚类算法如何将一堆点分为 7 个簇(用圆圈和颜色表示):
(来源:natekohl.net)
在您的情况下,聚类算法会尝试重复合并小裂缝以形成更大的裂缝,直到满足某些停止条件。最终结果将是一组较小的连接裂缝。当然,裂缝与二维点略有不同——让聚类算法在这里发挥作用的部分技巧是定义两个裂缝之间的有用距离度量。
流行的聚类算法包括 k-means 聚类 (演示)和分层聚类。第二个链接还对 k 均值的工作原理进行了很好的分步解释。
编辑:菲利普斯的一些工程师撰写的这篇论文看起来与您想要做的事情相关:
他们正在对硅晶圆上的缺陷进行目视检查,并使用 中值滤波器,用于在使用最近邻聚类算法检测缺陷之前消除噪声。
以下是他们引用的一些可能有用的相关论文/书籍:
In addition to the useful comments about image processing, it also sounds like you're dealing with a clustering problem.
Clustering algorithms come from the machine learning literature, specifically unsupervised learning. As the name implies, the basic idea is to try to identify natural clusters of data points within some large set of data.
For example, the picture below shows how a clustering algorithm might group a bunch of points into 7 clusters (indicated by circles and color):
(source: natekohl.net)
In your case, a clustering algorithm would attempt to repeatedly merge small cracks to form larger cracks, until some stopping criteria is met. The end result would be a smaller set of joined cracks. Of course, cracks are a little different than two-dimensional points -- part of the trick in getting a clustering algorithm to work here will be defining a useful distance metric between two cracks.
Popular clustering algorithms include k-means clustering (demo) and hierarchical clustering. That second link also has a nice step-by-step explanation of how k-means works.
EDIT: This paper by some engineers at Phillips looks relevant to what you're trying to do:
They're doing a visual inspection for defects on silicon wafers, and use a median filter to remove noise before using a nearest-neighbor clustering algorithm to detect the defects.
Here are some related papers/books that they cite that might be useful:
您的问题属于非常广泛的图像分类领域。这些类型的问题可能非常困难,归根结底,解决这些问题是一门艺术。您必须利用您所掌握的有关问题领域的每一条知识,使其易于处理。
一个根本问题是正常化。您希望相似分类的对象在数据表示方面尽可能相似。例如,如果您有裂纹图像,所有图像是否具有相同的方向?如果没有,那么旋转图像可能有助于您的分类。同样,缩放和平移(请参阅此)
您也希望删除尽可能多的不相关内容尽可能从训练集中获取数据。您也许可以使用 边缘提取(例如 Canny 边缘检测),而不是直接处理图像)。这将从图像中消除所有“噪音”,只留下边缘。然后,练习减少到识别哪些边缘是裂缝,哪些是天然路面。
如果您想快速找到解决方案,那么我建议您首先使用 卷积神经网络 碰碰运气,它可以通过最少的预处理和标准化来执行相当好的图像分类。它在手写识别方面非常出名,并且可能适合您正在做的事情。
Your problem falls in the very broad field of image classification. These types of problems can be notoriously difficult, and at the end of the day, solving them is an art. You must exploit every piece of knowledge you have about the problem domain to make it tractable.
One fundamental issue is normalization. You want to have similarly classified objects to be as similar as possible in their data representation. For example, if you have an image of the cracks, do all images have the same orientation? If not, then rotating the image may help in your classification. Similarly, scaling and translation (refer to this)
You also want to remove as much irrelevant data as possible from your training sets. Rather than directly working on the image, perhaps you could use edge extraction (for example Canny edge detection). This will remove all the 'noise' from the image, leaving only the edges. The exercise is then reduced to identifying which edges are the cracks and which are the natural pavement.
If you want to fast track to a solution then I suggest you first try the your luck with a Convolutional Neural Net, which can perform pretty good image classification with a minimum of preprocessing and noramlization. Its pretty well known in handwriting recognition, and might be just right for what you're doing.
我对你选择分解问题的方式感到有点困惑。如果你的同事没有识别出完整的裂缝,而这就是规范,那么这就是你的问题。但如果你设法将所有的裂缝缝合在一起,并避免他的误报,那么你不是已经完成了他的工作吗?
除此之外,我认为这是一个 边缘检测 问题,而不是分类问题。如果边缘检测器良好,那么您的问题就会消失。
如果您仍然进行分类,那么您将需要一个具有已知答案的训练集,因为您需要一种方法来量化区分误报和真实破解的因素。然而,我仍然认为你的分类器不太可能能够连接裂缝,因为这些裂缝是针对每个单独的铺路板的。
I'm a bit confused by the way you've chosen to break down the problem. If your coworker isn't identifying complete cracks, and that's the spec, then that makes it your problem. But if you manage to stitch all the cracks together, and avoid his false positives, then haven't you just done his job?
That aside, I think this is an edge detection problem rather than a classification problem. If the edge detector is good, then your issues go away.
If you are still set on classification, then you are going to need a training set with known answers, since you need a way to quantify what differentiates a false positive from a real crack. However I still think it is unlikely that your classifier will be able to connect the cracks, since these are specific to each individual paving slab.
我必须同意 ire_and_curses 的观点,一旦你进入边缘检测领域来修补你的共同开发人员的破解检测,并消除他的误报,似乎你就在做他的工作。如果你可以修补他的软件未检测到的内容,并消除他给你的内容的误报。看来您可以对完整图像执行此操作。
如果规格是让他检测裂缝,并且您对它们进行分类,那么他的工作就是进行边缘检测并消除误报。而你的工作就是接受他给你的信息并对其进行分类。如果您必须进行边缘检测才能做到这一点,那么听起来您离让您的合作开发人员失业不远了。
I have to agree with ire_and_curses, once you dive into the realm of edge detection to patch your co-developers crack detection, and remove his false positives, it seems as if you would be doing his job. If you can patch what his software did not detect, and remove his false positives around what he has given you. It seems like you would be able to do this for the full image.
If the spec is for him to detect the cracks, and you classify them, then it's his job to do the edge detection and remove false positives. And your job to take what he has given you and classify what type of crack it is. If you have to do edge detection to do that, then it sounds like you are not far from putting your co-developer out of work.
这里有一些非常好的答案。但如果你无法解决问题,你可以考虑 Mechanical Turk。在某些情况下,对于顽固问题来说,它可能非常划算。我知道有人将它用于各种类似的事情(验证人类可以轻松完成但很难编码)。
https://www.mturk.com/mturk/welcome
There are some very good answers here. But if you are unable to solve the problem, you may consider Mechanical Turk. In some cases it can be very cost-effective for stubborn problems. I know people who use it for all kinds of things like this (verification that a human can do easily but proves hard to code).
https://www.mturk.com/mturk/welcome
无论如何,我都不是专家,但请尝试查看 Haar Cascades。您可能还希望尝试使用 OpenCV 工具包。这两件事一起完成人脸检测和其他物体检测任务。
您可能需要进行“培训”来开发针对路面裂缝的 Haar Cascade。
I am no expert by any means, but try looking at Haar Cascades. You may also wish to experiment with the OpenCV toolkit. These two things together do face detection and other object-detection tasks.
You may have to do "training" to develop a Haar Cascade for cracks in pavement.
最好的方法是研究模式识别和机器学习。我将从 Duda 的 模式分类 开始,并使用 Bishop 的 模式识别和机器学习作为参考。理解这些材料需要很长时间,但是获得模式识别的基本意识和分类问题的主要方法应该会给你指导。我可以坐在这里对您的数据做出一些假设,但老实说,您可能对数据集有最好的了解,因为您比任何人都更多地处理它。例如,一些有用的技术可能是支持向量机和提升。
编辑:增强的一个有趣的应用是实时人脸检测。请参阅 Viola/Jones 的 使用简单的增强级联进行快速对象检测
特点 (pdf)。另外,看看示例图像,我想说你应该尝试稍微改进边缘检测。也许用高斯平滑图像并运行更积极的边缘检测可以增加对较小裂缝的检测。
The best approach is to study pattern recognition and machine learning. I would start with Duda's Pattern Classification and use Bishop's Pattern Recognition and Machine Learning as reference. It would take a good while for the material to sink in, but getting basic sense of pattern recognition and major approaches of classification problem should give you the direction. I can sit here and make some assumptions about your data, but honestly you probably have the best idea about the data set since you've been dealing with it more than anyone. Some of the useful technique for instance could be support vector machine and boosting.
Edit: An interesting application of boosting is real-time face detection. See Viola/Jones's Rapid Object Detection using a Boosted Cascade of Simple
Features (pdf). Also, looking at the sample images, I'd say you should try improving the edge detection a bit. Maybe smoothing the image with Gaussian and running more aggressive edge detection can increase detection of smaller cracks.
我建议您拿起任何图像处理教科书并阅读该主题。
特别是,您可能对 形态学 操作 像 扩张和 Erosion,它补充了 边缘检测器。网上有很多材料...
I suggest you pick up any image processing textbook and read on the subject.
Particularly, you might be interested in Morphological Operations like Dilation and Erosion, which complements the job of an edge detector. Plenty of materials on the net...
这是一个图像处理问题。关于这个主题有很多书,这些书中的大部分材料都超出了像这样的线检测问题。以下是解决该问题的一种技术的概述。
当你发现裂缝时,你会发现一些弥补裂缝的像素。为此,可以使用边缘检测滤镜或其他边缘检测方法。
从裂缝中的一个(任意)像素开始,然后“跟随”它从裂缝中形成一条多点线 - 保存组成线的点。如果一些中间点靠近直线,您可以删除它们。对所有裂纹像素执行此操作。如果您有星形裂纹,请不要担心。只需沿着一个(或两个)方向的像素组成一条线,然后从裂纹像素集中删除这些像素即可。星形的其他腿将被识别为单独的线(暂时)。
您可以在步骤 1 之前对裂纹像素执行一些细化操作。换句话说,检查像素的邻居,如果数量太多,则忽略该像素。 (这是一种简化——您可以找到几种算法。)另一个预处理步骤可能是删除所有太细或两条微弱的线条。这可能有助于消除误报。
现在您有很多短的多点线路。对于每条线的端点,找到最近的线。如果这些线在容差范围内,则“连接”这些线——链接它们或将它们添加到相同的结构或数组中。这样,您就可以连接紧密的裂缝,这可能是混凝土中的同一裂缝。
似乎无论哪种算法,为了获得良好的性能,一些参数调整都是必要的。编写它,以便可以轻松地对强度阈值、最小和最大厚度等进行细微更改。
根据使用环境,您可能希望允许用户判断来确定有问题的情况,和/或允许用户查看所有裂缝,然后单击以合并、分割或删除检测到的裂缝。
This is an image processing problem. There are lots of books written on the subject, and much of the material in these books will go beyond a line-detection problem like this. Here is the outline of one technique that would work for the problem.
When you find a crack, you find some pixels that make up the crack. Edge detection filters or other edge detection methods can be used for this.
Start with one (any) pixel in a crack, then "follow" it to make a multipoint line out of the crack -- save the points that make up the line. You can remove some intermediate points if they lie close to a straight line. Do this with all the crack pixels. If you have a star-shaped crack, don't worry about it. Just follow the pixels in one (or two) directions to make up a line, then remove these pixels from the set of crack pixels. The other legs of the star will recognized as separate lines (for now).
You might perform some thinning on the crack pixels before step 1. In other words, check the neighbors of the pixels, and if there are too many then ignore that pixel. (This is a simplification -- you can find several algorithms for this.) Another preprocessing step might be to remove all the lines that are too thin or two faint. This might help with the false positives.
Now you have a lot of short, multipoint lines. For the endpoints of each line, find the nearest line. If the lines are within a tolerance, then "connect" the lines -- link them or add them to the same structure or array. This way, you can connect the close cracks, which would likely be the same crack in the concrete.
It seems like no matter the algorithm, some parameter adjustment will be necessary for good performance. Write it so it's easy to make minor changes in things like intensity thresholds, minimum and maximum thickness, etc.
Depending on the usage environment, you might want to allow user judgement do determine the questionable cases, and/or allow a user to review the all the cracks and click to combine, split or remove detected cracks.
你得到了一些非常好的答案,尤其是。 @Nate's,所有建议的链接和书籍都是值得的。然而,令我惊讶的是没有人推荐一本我的首选书 - O'Reilly 的 集体智慧编程。标题可能看起来与您的问题无关,但是,相信我,内容是:我所见过的最实用的、面向程序员的数据挖掘和“机器学习”报道之一。试一试!-)
You got some very good answer, esp. @Nate's, and all the links and books suggested are worthwhile. However, I'm surprised nobody suggested the one book that would have been my top pick -- O'Reilly's Programming Collective Intelligence. The title may not seem germane to your question, but, believe me, the contents are: one of the most practical, programmer-oriented coverage of data mining and "machine learning" I've ever seen. Give it a spin!-)
这听起来有点像岩石力学中的一个问题,岩体中有节理,这些节理必须按方向、长度和其他属性分为“集合”。在这种情况下,一种效果很好的方法是聚类,尽管经典的 K 均值似乎确实存在一些问题,我过去已经使用遗传算法来运行交互式解决方案来解决这些问题。
在这种情况下,我怀疑它可能不会以完全相同的方式工作。在这种情况下,我怀疑您需要创建组,从纵向、横向等开始,并准确定义每个组的行为,即单个纵向裂纹分支是否可以沿其长度部分延伸,如果它做了什么这与其分类有关。
一旦你有了这个,那么对于每个裂缝,我会根据你创建的分类生成随机裂缝或裂缝模式。然后,您可以使用最小二乘法之类的方法来查看您正在检查的裂纹与您生成的随机裂纹的吻合程度。您可以以蒙特卡罗分析的方式多次重复此分析,以确定随机生成的裂纹中哪一个最适合您正在检查的裂纹。
为了处理误报,您需要为每种不同类型的误报创建一个模式,即路缘的边缘是一条直线。然后,您将能够运行分析,选出您分析的每个裂纹最有可能的组。
最后,您需要“调整”不同裂纹类型的定义,以尝试获得更好的结果。我想这可以使用自动方法或手动方法,具体取决于您如何定义不同的裂纹类型。
当我解决这样的问题时,有时会有所帮助的另一种修改是有一个随机组。通过调整随机组的灵敏度,即随机组中包含裂纹的可能性有多大,有时您可以调整模型对不适合任何地方的复杂模式的灵敏度。
祝你好运,在我看来你面临着真正的挑战。
It sounds a little like a problem there is in Rock Mechanics, where there are joints in a rock mass and these joints have to be grouped into 'sets' by orientation, length and other properties. In this instance one method that works well is clustering, although classical K-means does seem to have a few problems which I have addressed in the past using a genetic algorithm to run the interative solution.
In this instance I suspect it might not work quite the same way. In this case I suspect that you need to create your groups to start with i.e. longitudinal, transverse etc. and define exactly what the behviour of each group is i.e. can a single longitudinal crack branch part way along it's length, and if it does what does that do to it's classification.
Once you have that then for each crack, I would generate a random crack or pattern of cracks based on the classification you have created. You can then use something like a least squares approach to see how closely the crack you are checking fits against the random crack / cracks you have generated. You can repeat this analysis many times in the manner of a Monte-Carlo analysis to identify which of the randomly generated crack / cracks best fits the one you are checking.
To then deal with the false positives you will need to create a pattern for each of the different types of false positives i.e. the edge of a kerb is a straight line. You will then be able to run the analysis picking out which is the most likely group for each crack you analyse.
Finally, you will need to 'tweak' the definition of different crack types to try and get a better result. I guess this could either use an automated approach or a manual approach depending on how you define your different crack types.
One other modification that sometimes helps when I'm doing problems like this is to have a random group. By tweaking the sensitivity of a random group i.e. how more or less likely a crack is to be included in the random group, you can sometimes adjust the sensitivty of the model to complex patterns that don't really fit anywhere.
Good luck, looks to me like you have a real challenge.
您应该阅读数据挖掘,特别是模式挖掘。
关于这个主题的一本好书是 数据挖掘:实用机器学习工具和技术
(来源:waikato.ac.nz ) ](http://www.amazon.com/Data-Mining -Ian-H-Witten/dp/3446215336“ISBN 0-12-088407-0”)
基本上,您要做的就是将统计工具和方法应用于数据集。最常用的比较方法是学生的t 检验 和卡方检验,以查看两个不相关的变量是否具有一定的置信度。
You should read about data mining, specially pattern mining.
A good book on the subject is Data Mining: Practical Machine Learning Tools and Techniques
(source: waikato.ac.nz) ](http://www.amazon.com/Data-Mining-Ian-H-Witten/dp/3446215336 "ISBN 0-12-088407-0")
Basically what you have to do is apply statistical tools and methodologies to your datasets. The most used comparison methodologies are Student's t-test and the Chi squared test, to see if two unrelated variables are related with some confidence.