FME 2019可以识别图像中的对象,由于to a new set of computer vision transformers. Here’s how you can train FME to recognize custom objects in large volumes of incoming raster data, with a downloadable example using stop signs.

你在这张照片上看到了什么?你可能更困惑的问题而不是图像 - 你在这里看到一只狗,所以为什么我问这么简单的问题?

It is so easy for us to see the objects on images, which are just combinations of differently coloured pixels. Our brains do an excellent job in making sense out of these combinations.

Teaching machines to find objects on images is a complicated process, but there has been a lot of research in the area of computer vision happening in the last decades. Currently, specialized software libraries are able to do many tasks that the human visual system can do, such as object recognition and identification, condition detection,文字阅读, and so on.

现在,通过FME 2019,您也可以尝试您的教学人才,并展示您最喜欢的计划如何识别狗,猫或可能在图像上的道路标志。这听起来令人兴奋吗?让我们潜入细节。

培训FME进行对象识别

Under the hood, FME usesOpenCV.,计算机视觉和机器学习软件库。对于FME 2019,我们实现了对象检测功能,它作为RasterObjectDetector *变形金刚的家庭包装:

The idea of machine learning here is to supply the program with training data—photos, in this case—on which we would identify the objects we are interested in. We also will show FME the photos that don’t have the objects we are looking for. The program, after studying the data, will learn to make decisions about a possible presence or absence of the objects on new photos that were never used during training.

教导机器识别物体的过程有点类似于教学的幼儿关于世界:“这是一只猫,这是一只猫,是的,这也是一只猫。不,这不是猫。“

The RasterObjectDetector transformer comes with a few predefined detection models for faces, body parts, cats, and some other uses, but it would be really interesting to train the model ourselves for recognizing something applicable to geospatial industry so that the results could appear on a map.

Example: Identifying Stop Signs

实际上,找到合适的数据集可能是最大的问题。大多数人没有他们想检测到的对象的数百或数千个图像(除非它是他们最喜欢的动物的图片)。

I have 500 photos of theFME COI.N这是在2016年提交的比赛,但在认识到这一有价值的FME纪念品方面没有太大的实用性。

另一个好的图像来源是视频。A single recording can supply hundreds and thousands of images, and if there is something interesting on them, we can try to extract it. A year ago, when I made a lot of experiments with video using FME, I took some video footage while driving. I also recorded the GPS tracks during those trips, so a geospatial component was there, and what can be more exciting than finding stop signs along the route? (Well, actually a lot of things can be more exciting, but stop signs are logical candidates to appear on a map.)

我找到了一个良好的训练数据集的停车标志here。It consists of one hundred photos of the road scenes with the stop signs (positives), and one hundred similar road photos with no signs (negatives). With all the necessary components for my scenario, I could teach FME to recognize the new object.

制备

第一步:绘图矩形指示对象

The initial part is, to be honest, boring and tedious. I had to go through one hundred images and draw a rectangle around every single stop sign. FME 2019 comes with a utility called opencv_annotation.exe (part of the OpenCV library) that runs from a command line and gives a simple GUI for specifying the location of a sign (or several signs) on a photo. The utility is located in the plugins\opencv\ folder of the FME 2019 installation.

此实用程序非常令人垂涎,并使正确的命令行需要一些关注。以下是工作命令行的示例:

C:\ apps \ fme2019 \ plugins \ opencv \ opencv_annotation.exe --annotations =“c:\ temp \ stopsigndataset \ annotations.txt”--images =“c:\ temp \ stopsignigndataset \ sonder”--maxwindowheight = 1000

“注释”参数指示输出文件的位置。“图像”指定具有正面照片的文件夹。最后一个参数表示显示图像的最大高度,这对于高分辨率照片很有用。

此工作的结果是包含图像名称的注释文件(请注意,映像的路径必须相对于注释文件 - 您可能需要在步骤二(步骤)之前编辑文件)和它们上标志的像素坐标:

正\ 1.jpg 1 217 2 114 110正\ 10.jpg 1 288 352 552 546阳性\ 11.jpg 1 330 60 40 40 418阳性\ 38.jpg 2 511 64 58 70 849 199 146 147

Step Two: Preparing training dataset

With the next step, we prepare the data for training. RasterObjectDetectorSamplePreparer uses the photos with and without the signs, and the annotation file for creating two new files that actually will participate in training – the Prepared Positives File and the Background Description File.

第三步:培训

The final step of the training includes sending these files to RasterObjectDetectionModelTrainer and setting up parameters of the training – model type (HAAR or LBP), number of stages, parallelism and some other parameters. ‘Number of Stages’ parameter increases the time needed for processing the dataset. With its value set to 20, the training on our dataset was almost instant, whereas with 24, it took about 30 minutes. Setting the value to higher numbers leads to extremely long processing with not much improvement.

The output is an XML file, which is the trained model that is smart enough to detect stop signs on photos.

分析

最令人兴奋的部分是分析本身。现在我们可以将照片提供给FME,看看它可以处理它们的程度。

将视频分解为帧,我使用SystemCaller运行FFMPEG程序(查看此博客文章有关使用FME处理视频的博客文章)。设置图像的质量是很重要的s to the high (-qscale:v 2 parameter) for JPEG images, which use a lossy compression algorithm.

“”ffmpeg.exe“-i”c:\ temp \ video \ trive.mp4“-qscale:v 2 -vf fps = 1”c:\ temp \ iciles \ img_%05d.jpg“”

然后,图像可以直接到RasterObjectDetector,这将尝试找到对象。

如果找到了一个对象,则变压器将围绕它呈现矩形,这是变压器的输出。

增强输出

主要目标是实现:FME认识到大部分照片上的停车标志。我不选择收集数据的最佳时间,因为违反日落的镜头不会给标志的清洁对比图片,所以在中午或在多云的天空下驾驶应该恢复更好的结果。没有误报,有时会发生这种情况。In this case, setting the “Minimum number of Neighbors” parameter to a higher value will reduce the number of errors (it also might return fewer correct results).

要从此过程中获取一些真正的价值,很高兴知道所有这些已识别的迹象所在的位置。为此,我用了我的全球定位系统track。有关工作流程的更多详细信息,请检查亚搏在线关于视频的博客文章但是,主要思想是,基于视频创建的时间,我们可以计算拍摄每个帧并将其匹配到两个最近的GPS航点(之前和之后)的时间,然后插入该位置。当检测到数次标志时,我们可以通过测量检测到的多边形的区域来选择最接近其实际位置的图像 - 最大的多边形更接近符号位置而不是较小的多边形。

The final step of the process is placing the signs on aWeb地图。I talked about creating simple web maps with FME and LeafletJS library during the “用于在Web浏览器中可视化地理空间数据的工具“网络研讨会。简而言之,每个功能都为自己写入代码片段,然后使用聚合器和atttirButecreator,FME创建完整的HTML文件。这是整个过程的结果。

Try it Yourself

工作区,培训的模型识别停止标志,GPS轨道和从视频中提取的图像可用于下载on FME Hub. Note that the training template (StopSignModelTrainer.fmwt) is included into the main template StopSignDetector.fmwt.

FME社区的作用亚搏国际在线官网

One of the main obstacles to a quick and effective deployment of this technology is the need for large datasets of positives, and ideally, similarly looking negatives, to train FME. There is no need anymore to teach FME what stop signs look like – my training model is available to everyone – download, try it, and let me know about the results (or repeat the whole process again and maybe be a better teacher by making a model that works more reliably than mine).But there are, of course, a lot more objects that FME users will want to find in their images.

Together, the FME community can expand FME’s knowledge about the world by training it to recognize more road signs, roofs, poles, ships, or maybe cartoon characters. So if you have a good dataset and can train FME to detect new objects, how about sharing your model with every FMEer in world? Create an FME workspace template (*.fmwt) with your trained model included and upload toFME枢纽

我认为对象检测是2019年FME的新功能。与大多数其他变压器不同,这家新款的变压器家庭需要一些手动准备,但这种解决方案在许多领域的有效性可能是巨大的。你有关于FME应该能够检测到什么的想法吗?你想用自己的数据集训练FME吗?让我们知道你想做什么样的侦探工作!

关于fme. 计算机视觉 FME 2019. FME社亚搏国际在线官网区 FME Desktop 全球定位系统 对象数据 对象检测 对象识别 Raster Rasterobjectdetector

Dmitri巴库克

DMitri是安全软件的情景创作专家,这意味着他花了他的日子玩FME并测试它可以做的亚搏在线惊人的事情。

Comments

14 Responses to “FME Does Computer Vision”

  1. Olivier Lambert. says:

    Thank you Dmitri! Do you see any potential for automatic feature extraction from satellite imagery? For example parking lots, stadium grounds, playing fields (tennis courts,…), helicopter landing sites with an “H”, pedestrian crossings,…

  2. Dmitri巴库克 says:

    嗨olivier,

    I think it is reasonable to expect that things like helicopter landing sites with their clearly visible H or crosswalks can be found using this technology. I don’t have too much experience with this yet, but my feeling is that things with more fine details might work not as good. I mention the FME coin in the article – I actually tried to train FME with that dataset, and the result wasn’t that great compared to Stop or Fire Escape signs. So, ideally, we should try to train FME with the features you mention and see what works well. Collecting enough samples might be quite time consuming, and that I see as a serious obstacle for the testing process.

    Dmitri

  3. 干燥 says:

    Hi Dimitri,
    I did play around with these new transformers. I did try to detect faces in some images but i stumbled upon finding too much “faces”. I know you play around with models and settings, but hard to find a balance in either finding all of the faces or either half of the image (and 100 positives). Most of the faces are not in a ideal position or either wear a scarf…
    是否有一种方法可以仅在图像的一小部分中限制ObjectDetector(PixElwise)?(和考虑成千上万的图像必须扫描的资源友好)?
    在未来添加字母/数字的检测的任何计划?
    干燥

    • Dmitri巴库克 says:

      嗨干,

      该算法如下所示 - 它将包含一个窗口,其中包含对象签名的窗口,并查找匹配模式。如果发现,它将它们标记为阳性。我们可以要求将其考虑在一个问题的某个特征周围没有单一的匹配时,但更多 - 该数字由“最小邻居数”参数定义。如果您增加它,您将获得较少的误报,但也可能会丢失一些真实的对象。更好的培训可能有所帮助。

      如果您知道数据允许,则可以在图像上限制搜索区域。例如,通过我的停止符号示例 - 在大多数情况下,我可以保留原始图像的右上角。脸上,您可能只能拍摄照片的上半部分等。

      We don’t think we will add a lot of new detection models in the future – whatever you see in the transformer comes with OpenCV library. The only model I created was this stop sign model. We might have more in the future if we see the need, but rather we were hoping that our users would train FME and share their models with the world.

      目前,我只计划添加消防栓模型,后来在这个春天,我会看到我们可以用空中摄影做些什么,例如我们是否能找到屋顶。

      Dmitri

  4. […] 2019 is getting object detection functionality. Users will be able to train a machine to recognise objects of interest in images […]

  5. 奶奶 says:

    是否有一种方法可以仅在图像的一小部分中限制ObjectDetector(PixElwise)?(和考虑成千上万的图像必须扫描的资源友好)?

    • Ada Lee says:

      来自DMitri:在在ObjectDetector中使用它之前,我会剪辑图像。因此,基本上,一些地区将是快船(例如,停车场) - 我们会剪辑光栅,以便我们只有停车场并将它们发送到对象探测器。我希望能帮助!

  6. 安德森韦伯 says:

    Instead of annotating each photo individually in step 1, would it work to simply use a data set of sign faces, or closes ups if this data set could be obtained?

    • Stephanie Warner says:

      From Dmitri: For some road signs, it might be possible, even without CV tools. Stop signs, for example, can be extracted by finding very red areas, and estimating the shapes of the extracted red areas. But in general, objects we might want to detect can be very different on very different backgrounds – imagine, for example, cats, with all the environments they live in, and all the colours they may have, and all the poses they can take. So for a proper CV training we need as many samples as possible – after all, currently, CV is a pure statistics, and a brute force to process the numbers.
      顺便说一句,这里可以找到很多ML数据集 -https://www.datasetlist.com/

  7. Alan Klys says:

    Hi Dmitri,
    我已经播放了所有工作区和技术,并观看了您的伟大视频。
    虽然我可以获得所有示例来工作和生成VEC文件,但我的所有XML文件都结束了17KB以获得一些奇怪的原因?
    我对此感到困惑,因为即使我自己的数据集变得相当大,VEC文件也会变大,但XML文件(知识文件)仍然是一个常量的17KB。
    Looking at your XML files in the Knowledge folder they are 33, 63 and 100kb so I’m wondering if I’m doing something wrong perhaps ?

    在一个非常伟大的教程和示例中欢呼声和荣誉。

  8. If you are having issue launching the OpenCV Based Annotation Tool GUI, I found an issue in the command prompt under images para. The backslash ‘\’ prefixed after \Positive should be removed.

    C:\apps\FME2019\plugins\opencv\opencv_annotation.exe –annotations=”C:\Temp\StopSignDataset\annotations.txt” –images=”C:\Temp\StopSignDataset\Positive” –maxWindowHeight=1000

    • Dmitri巴库克 says:

      嗨亚历山大,

      这是一个正确的观察,谢谢。如果我们使用Windows cmd.exe,那么是的,呈现阳性末尾的反斜杠不允许使用该实用程序打开照片窗口。这不适用于Windows PowerShell,它是此操作系统的默认命令行工具,以及我做出的测试 - 它是否正确工作了反斜杠。

      We will remove the backslash from the line above to make the syntax universal for both Windows command line tools.

      Dmitri

Leave a Reply toAnonymousCancel reply

您的电子邮件地址不会被公开。必需的地方已做标记*

相关文章