sbc8600
by Tait Brown
泰特·布朗(Tait Brown)
A few weeks ago, I published what I thought at the time was a fairly innocuous article: How I replicated an $86 million project in 57 lines of code.
几周前,我发表了当时的想法,这篇文章相当无害: 我如何用57行代码复制了一个价值8600万美元的项目 。
I’ll admit — it was a rather click-bait claim. I was essentially saying that I’d reproduced the same license plate scanning and validating technology that the police in Victoria, Australia had just paid $86 million for.
我承认-这是一个相当诱人的说法。 我本质上是说,我将复制与澳大利亚维多利亚州警察刚刚支付的8600万美元相同的车牌扫描和验证技术。
Since then, the reactions have been overwhelming. My article received over 100,000 hits in the first day, and at last glance sits somewhere around 450,000. I’ve been invited to speak on local radio talk shows and at a conference in California. I think someone may have misread Victoria, AU as Victoria, BC.
从那以后,React一直是压倒性的。 我的文章在第一天获得了100,000次点击,而最后一看就位于450,000左右。 我已受邀在当地电台脱口秀节目和加利福尼亚的一次会议上发言。 我认为有人可能误读了非盟维多利亚州和不列颠哥伦比亚省维多利亚市。
Although I politely declined these offers, I have met for coffee with various local developers and big name firms alike. It’s been incredibly exciting.
尽管我礼貌地拒绝了这些要约,但我还是与多家本地开发商和知名公司见面喝咖啡。 真是令人兴奋。
Most readers saw it for what it was: a proof of concept to spark discussion about the use of open source technology, government spending, and one man’s desire to build cool stuff from his couch.
大多数读者看到了它的含义:一个概念证明,引发了关于开源技术的使用,政府支出以及一个人渴望从沙发上制造凉爽物品的讨论。
Pedants have pointed out the lack of training, support, and usual enterprise IT cost padders, but it’s not worth anyone’s time exploring these. I’d rather spend this post looking at my results and how others can go about shoring up their own accuracy.
讨价还价者指出缺乏培训,支持和通常的企业IT成本填充程序,但是没有人花时间去探索这些内容。 我宁愿用这篇文章来看看我的结果以及其他人如何提高自己的准确性。
Before we get too deep into the results, I’d like to go over one thing that I feel was lost in the original post. The concept for this project started completely separate from the $86 million BlueNet project. It was by no means an attempt to knock it off.
在我们深入了解结果之前,我想谈一谈我觉得在原始帖子中迷失的一件事。 这个项目的概念与价值8600万美元的BlueNet项目完全分开。 这绝不是试图将其淘汰。
It started with the nagging thought that since OpenCV exists and the VicRoads website has license plate checks, there must be a way to combine the two or use something better.
从the的想法开始,因为OpenCV存在并且VicRoads网站具有车牌检查功能,所以必须有一种将两者结合或使用更好的方法。
It was only when I began my write-up that I stumbled upon BlueNet. While discovering BlueNet and its price tag gave me a great editorial angle, with the code already written. There were bound to be some inconsistencies between the projects.
直到我开始撰写文章时,我才偶然发现BlueNet。 在发现BlueNet及其价格标签的同时,已经编写了代码,这给了我很大的编辑角度。 这些项目之间必然存在一些不一致之处。
I also believe part of the reason this blew up was the convenient timing of a report on wasteful government IT spending in Australia. The Federal Government’s IT bill has shot up from $5.9 billion to $10 billion, and it delivered dubious value for that blow out. Media researchers who contacted me were quick to link the two, but this is not something I am quick to encourage.
我还认为,造成这种爆炸的部分原因是有关澳大利亚政府IT浪费的浪费报告的便利时机。 联邦政府的IT账单已从59亿美元飙升至100亿美元,并且为这场爆炸案带来了可疑的价值。 与我联系的媒体研究人员很快将两者联系在一起,但这并不是我所鼓励的。
In the spirit of transparency, I must declare something that was also missing from the original post. My previous employer delivered smaller (less than $1 million) IT projects for Victoria Police and other state bodies. As a result, I’ve undergone police checks and completed the forms required to become a VicPol contractor.
本着透明的精神,我必须声明原始帖子中也缺少的内容。 我的前任雇主为维多利亚州警察局和其他州机构提供了规模较小(不到100万美元)的IT项目。 结果,我接受了警察检查,并填写了成为VicPol承包商所需的表格。
This may imply I have an axe to grind or have some specific insider knowledge, but instead I am proud of the projects we delivered. They were both on time and on budget.
这可能意味着我需要精打细算或有一些特定的内幕知识,但是我为我们交付的项目感到自豪。 他们既按时又按预算进行。
The following is a video representation of my results, composited in After Effects for a bit of fun. I recorded various test footage, and this was the most successful clip.
以下是我的结果的视频表示,在After Effects中合成了一些乐趣。 我录制了各种测试镜头,这是最成功的剪辑。
I will go into detail about ideal camera setups, detection regions, and more after the video. It will help you better understand what made this iPhone video I took from through the windscreen a better video than a Contour HD angled out the side window.
视频结束后,我将详细介绍理想的相机设置,检测区域等。 与从侧面玻璃窗倾斜的Contour HD相比,它可以帮助您更好地了解使从挡风玻璃上拍摄的iPhone视频成为更好的视频的原因。
If you saw the hero graphic of this article or watched the video above, you may have noticed a very interesting development: I caught someone.
如果您看到本文的英雄图片或观看上面的视频,您可能已经注意到了一个非常有趣的发展: 我抓到了某人 。
Specifically, I caught someone driving a vehicle with a canceled registration from 2016. This could have happened for many reasons, the most innocent of which is a dodgy resale practice.
具体来说,我发现有人从2016年开始驾驶已取消注册的车辆。这可能由于多种原因而发生,其中最无辜的是狡猾的转售行为。
Occasionally, when the private sale of a vehicle is not done by the book, the buyer and seller may not complete an official transfer of registration. This saves the buyer hundreds of dollars, but the vehicle is still registered to the seller. It’s not unheard of for a seller to then cancel the registration and receive an ad hoc refund of remaining months, also worth hundreds of dollars.
有时,如果未按书规定私下出售车辆,则买卖双方可能未完成正式的注册转让。 这样可以为买方节省数百美元,但车辆仍向卖方注册。 卖方随后取消注册并获得剩余月份的特别退款(也值数百美元)的情况并非鲜见。
Alternatively, the driver of the vehicle could well be the criminal we suspect that they are.
另外,车辆的驾驶员很可能是我们怀疑他们是罪犯的人。
So, although I jokingly named the project plate-snitch when I set it up on my computer, I’m now faced with the conundrum of whether to report what I saw.
因此,尽管当我在计算机上进行设置时,我开玩笑地命名了该项目的标语,但现在我面临着是否报告我所看到的难题。
Ultimately, the driver was detected using a prototype of a police-only device. But driving on a 2016 registration (canceled, not expired) is a very deliberate move. Hmm.
最终,使用仅警用设备的原型检测到驾驶员。 但是,开车去2016年注册(取消,未过期)是一个非常刻意的举动。 嗯
Of the many reactions to my article, a significant amount were quite literal and dubious. Since I said I replicated the software, they asserted that I must have a support center, warranties, and training manuals. One even attempted to replicate my results and hit the inevitable roadblocks of image quality and source material.
在我的文章的许多React中,很大一部分是字面意义和可疑的。 自从我说过我复制了该软件以来,他们断言我必须有一个支持中心,保修和培训手册。 甚至有人试图复制我的结果,并遇到了不可避免的图像质量和原始资料障碍。
Because of this, some implied that I cherry-picked my source images. To that I can only say, “Well, duh.”
因此,有人暗示我选择了源图像。 为此,我只能说:“恩,嗯。”
When I built my initial proof of concept (again, focusing on validating an idea, not replicating BlueNet), I used a small sample set of less than ten images. Since camera setup is one of, if not the most, important factors in ALPR, I selected them for ideal characteristics that enhance recognition.
当我建立概念的初步证明时(再次,专注于验证一个想法,而不是复制BlueNet),我使用了少于10张图像的小样本集。 由于相机设置是ALPR的重要因素之一,即使不是最重要的因素, 因此我选择它们是为了增强识别能力的理想特性。
At the end of the day, it is very simple to take a fragile proof of concept and break it. The true innovation and challenge comes from taking a proof of concept, and making it work. Throughout my professional career, many senior developers have told me that things can’t be done or at least can’t be done in a timely manner. Sometimes they were right. Often, they were just risk averse.
归根结底,获取脆弱的概念证明并打破它很简单。 真正的创新和挑战来自对概念的证明并使其发挥作用 。 在我的整个职业生涯中,许多高级开发人员告诉我,事情无法及时完成,或者至少不能及时完成。 有时候他们是对的。 通常,他们只是规避风险。
“Nothing is impossible until it is proven to be.”
“除非被证明是不可能的,否则一切都是不可能的。”
Many people bastardize this quote, and you may have seen or heard one of it’s incarnations before. To me, it neatly summarizes a healthy development mindset, in which spiking and validating ideas is almost mandatory to understanding them.
很多人对此报价不屑一顾,并且您可能以前曾经看过或听到过其中一种化身。 对我来说,它巧妙地总结了一个健康的发展心态,其中突出和验证想法对于理解它们几乎是必不可少的。
This project is so exciting and different for me because it has a clear success metric — whether the software recognizes the plate. This can only happen with a combination of hardware, software, and networking solutions. After posting my original article, people who sell ALPR cameras quickly offered advice.
这个项目对我来说是如此令人兴奋且与众不同,因为它具有明确的成功指标-软件是否识别印版。 只有将硬件,软件和网络解决方案结合起来才能实现。 发布我的原始文章后,销售ALPR相机的人Swift提供了建议。
The most obvious solution in hindsight is the use of an optical zoom. Though I explore other important factors below, none lead to such a sheer increase in recognition as this. In general, professional ALPR solutions are offset at an angle, trained on where the license plate will be, and zoomed into the area to maximize clarity.
事后看来,最明显的解决方案是使用光学变焦 。 尽管我在下面探讨了其他重要因素,但没有一个因素能导致如此广泛的认可。 通常,专业的ALPR解决方案以一定角度偏移,在车牌位置上进行训练并放大到该区域以最大程度地提高清晰度。
This means the more zoom, more pixels to play with.
这意味着变焦更大,可以播放更多像素 。
All the cameras I had at my disposal were of a fixed lens. They included:
我所拥有的所有相机都是固定镜头。 其中包括:
The featured test run was recorded on my phone. My only method of replicating an optical zoom was using an app to record at 3K instead of 1080p, and then digitally zooming and cropping. Again, more pixels to play with.
特色测试运行记录在我的手机上。 复制光学变焦的唯一方法是使用应用以3K(而不是1080p)记录,然后进行数字变焦和裁切。 同样,还有更多像素可玩。
The viewing angle of 30° is often referenced as the standard for ideal plate recognition. This is incredibly important when you learn that BlueNet uses an array of cameras. It also makes sense when you consider what a front facing camera would generally see — not very much.
30 °的视角通常被称为理想板识别的标准。 当您了解到BlueNet使用了一系列摄像机时,这非常重要。 当您考虑前置摄像头通常会看到的内容时,这也很有意义-并不是很多。
If I had to guess I’d say a mostly forward-facing array would be the ideal setup. It would consist of a single camera pointed dead center as above, two off-center at 30° each side, and a single rear-facing camera. The value in having most of the cameras pointed forward would come from the increased reaction time if the vehicle is traveling in the opposite direction. This would allow a quicker scan, process, and U-turn than if the rear facing cameras picked up a suspect vehicle already ten meters past the police vehicle.
如果我不得不猜测,我会说一个面向前的阵列将是理想的设置。 它包括一个如上所述的指向死点的相机,两个偏心(每侧30 °)和一个后置相机。 如果车辆向相反方向行驶,则使大多数摄像机指向前方的价值将来自增加的React时间。 与后置摄像头在警车上方十米处捡起可疑车辆相比,这将允许更快的扫描,处理和掉头。
When compositing the video, I thought about stabilizing the footage. Instead I opted to show the bumpy ride for what it was. What you saw was me holding my phone near the windscreen while my wife drove. Check out that rigorous scientific method.
在合成视频时,我考虑过要稳定镜头。 相反,我选择显示颠簸的旅程。 您所看到的是我妻子开车时我将手机握在挡风玻璃附近。 检查出严格的科学方法。
Both the attempt to replicate my project and my recordings since then explored the same misconception that ALPR sampling frame rate may be linked to success. In my experience, this did nothing but waste cycles. Instead, what is incredibly important is the shutter speed creating clean, crisp footage that feeds well into the algorithm.
此后尝试复制我的项目和录音的尝试都发现了一个误解,即ALPR采样帧速率可能与成功有关。 以我的经验,这只是浪费周期。 取而代之的是,极其重要的是快门速度可产生清晰,清晰的画面,并将其很好地馈入算法中。
But I was also testing fairly low-speed footage. At most, two vehicles passing each other in a 60km/h zone created a 120km/h differential. BlueNet, on the other hand, can work up to an alleged 200km/h.
但是我也在测试相当低速的镜头。 至多,两辆汽车在60 km / h的区域内相互经过,产生了120 km / h的时差 。 另一方面,BlueNet可以达到每小时200公里的速度。
As a way of solving this, a colleague suggested object detection and out-of-band processing. Identify a vehicle and draw a bounding box. Wait for it to come into the ideal recognition angle and zoom. Then shoot a burst of photos for asynchronous processing.
作为解决此问题的方法,一位同事建议进行对象检测和带外处理。 识别车辆并绘制边界框。 等待它进入理想的识别角度并缩放。 然后拍摄一连串照片以进行异步处理。
I looked into using OpenCV (node-opencv) for object recognition, but I found something simpler like face detection, taking anywhere from 600–800ms. Not only less than ideal for my use, but pretty poor in general.
我研究了使用OpenCV(node-opencv)进行对象识别,但发现了诸如面部检测之类的简单方法,耗时600-800ms。 不仅不适合我使用,而且总体而言还很差。
Hype-train TensorFlow comes to the rescue. Able to run on-device, there are examples of projects identifying multiple vehicles per frame at an astounding 27.7fps. This version could even expose speed estimations. Legally worthless, but perhaps useful in every day policing (no fps benchmark in readme).
炒作TensorFlow来了。 能够在设备上运行的项目示例可以惊人地以每帧27.7fps的速度识别多辆车。 此版本甚至可以公开速度估算值。 从法律上讲毫无价值,但在日常警务中可能很有用(自述文件中没有fps基准测试)。
To better explain how high-performance vehicle recognition could couple with slower ALPR techniques, I created another video in After Effects. I imagine that the two working hand-in-hand would look something like this:
为了更好地说明高性能车辆识别如何与较慢的ALPR技术结合使用,我在After Effects中创建了另一个视频。 我想这两个携手并进将看起来像这样:
A different manifestation of frame rate is largely influenced upon shutter speed, and more specifically, the rolling shutter issues that plague early or low end digital movie recorders. The following is a snapshot from some Contour HD footage. You can see at only 60km/h the rolling shutter issue makes the footage more or less unusable from an ALPR point of view.
帧速率的不同表现在很大程度上影响快门速度,更具体地说, 滚动快门问题困扰着早期或低端的数字电影录像机。 以下是一些Contour HD素材的快照。 从ALPR的角度来看,您只能以60 km / h的速度看到卷帘快门问题,使镜头或多或少无法使用。
Adjusting frame rate on both the Contour HD and my iPhone did not result in noticeably less distortion. In theory, a higher shutter speed should produce clearer and crisper images. They’d become increasingly important if you were to chase the 200km/h BlueNet benchmark. Less blur and less rolling shutter distortion would ideally lead to a better read.
在Contour HD和我的iPhone上调整帧速率都不会导致失真明显减少。 从理论上讲,较高的快门速度应产生更清晰的图像。 如果您要追逐200 km / h BlueNet基准,它们将变得越来越重要。 理想情况下,较少的模糊和较小的卷帘快门失真将导致更好的读取效果。
One of the more interesting discoveries was that the node-openalpr version I was using is both out-of-date and not nearly as powerful as their proprietary solution. While an open source requirement was certainly a factor, it was amazing how accurately the cloud version could successfully read frames that I couldn’t even identify a plate on.
一个更有趣的发现是,我使用的node - openalpr版本既过时又不如其专有解决方案强大。 尽管当然需要开放源代码,但令人惊讶的是,云版本能够成功地准确读取我什至无法识别出的图像。
I also found that the main node-openalpr package defaults to US country processing with no way of overriding it. You have to pull down someone else’s fork which allows you to then provide an extra country parameter.
我还发现主node-openalpr软件包默认为美国国家/地区处理,无法覆盖它。 您必须拉下别人的叉子,然后才能提供其他国家/地区参数。
But this doesn’t always help. Using the default US algorithm I was able to produce the most results. Specifying the Australian data set actually halved the number of successful plate reads, and it only managed to find one or two that the US algorithm couldn’t. Providing the separate “Australian Wide Plate” set again halved the count and introduced a single extra plate.
但这并不总是有帮助。 使用默认的美国算法,我可以产生最多的结果。 指定澳大利亚数据集实际上使成功读板的次数减少了一半,并且只能设法找到美国算法无法读取的一两个。 再次提供单独的“澳大利亚宽板”套装将计数减半,并引入了一个额外的板。
There is clearly a lot to be desired when it comes to Australian-based data sets for ALPR, and I think that the sheer number of plate styles available in Victoria is a contributing factor.
对于基于澳大利亚的ALPR数据集,显然有很多需要改进的地方,我认为维多利亚州可用的大量印版样式是一个重要因素。
Open ALPR comes with one particular tool to reduce the impact of distortion from both the camera angle and rolling shutter issues. Planar warp refers to a method in which coordinates are passed to the library to skew, translate, and rotate an image until it closely resembles a straight-on plate.
Open ALPR附带一种特殊的工具,可以减少摄像机角度和卷帘快门引起的失真影响。 平面扭曲是指一种方法,其中将坐标传递到库中以倾斜,平移和旋转图像,直到图像非常类似于直板。
In my limited testing experience, I wasn’t able to find a planar warp that worked at all speeds. When you consider rolling shutter, it makes sense that the distortion grows relative to vehicle speed. I would imagine feeding accelerometer or GPS speed data as a coefficient might work. Or, you know, get a camera that isn’t completely rubbish.
以我有限的测试经验,我找不到能够在所有速度下工作的平面翘曲。 当您考虑使用卷帘门时,失真会随着车速的增加而增大。 我可以想象,将加速度计或GPS速度数据作为系数可能会起作用。 或者,您知道要购买一台不完全是垃圾的相机。
Numerous readers reached out after the last post to share their own experiences and ideas. Perhaps one of the more interesting solutions shared with me was by Auror in New Zealand.
上一篇文章发表后,众多读者纷纷与他们分享自己的经验和想法。 与我分享的更有趣的解决方案之一可能是Auror在新西兰。
They employ fixed ALPR cameras in petrol stations to report on people stealing petrol. This in itself is not particularly new and revolutionary. But when coupled with their network, they can automatically raise an alert when known offenders have returned, or are targeting petrol stations in the area.
他们在加油站使用固定的ALPR摄像机来报告偷汽油的人。 这本身并不是特别新颖和革命性的。 但是,当与他们的网络配合使用时,他们可以在已知罪犯返回或针对该地区的加油站时自动发出警报。
Independent developers in Israel, South Africa, and Argentina have shown interest in building their own hacked-together versions of BlueNet. Some will probably fare better than others, as places like Israel use a seven digit license plates with no alphabet characters.
以色列,南非和阿根廷的独立开发人员已表示有兴趣构建自己的黑名单版本的BlueNet。 由于以色列等地方使用没有字母字符的七位数车牌,因此某些车票可能会比其他车票好。
There is simply too much that I’ve learned in the last few weeks of dabbling to fit into one post. While there have been plenty of detractors, I really do appreciate the support and knowledge that has been sent my way.
在过去的几周中,我学到的东西太多了,不足以适合一篇文章。 尽管有很多反对者,但我确实非常感谢我所提供的支持和知识。
There are a lot of challenges you will face in trying to build your own ALPR solution, but thankfully a lot of them are solved problems.
在尝试构建自己的ALPR解决方案时,您将面临很多挑战,但值得庆幸的是,其中许多问题已经解决。
To put things in perspective, I’m a designer and front end developer. I’ve spent about ten hours now on footage and code, another eight on video production, and at least another ten on write-ups alone. I’ve achieved what I have by standing on the shoulders of giants. I’m installing libraries built by intelligent people and have leveraged advice from people who sell these cameras for a living.
从客观的角度来看,我是一名设计师和前端开发人员。 我现在在录像和代码上花费了大约10个小时,在视频制作上花费了另外8个小时,仅在写作上至少花费了10个小时。 我已经站在巨人的肩膀上实现了自己的目标。 我正在安装由聪明人建造的图书馆,并利用了出售这些相机为生的人们的建议。
The $86 million question still remains — if you can build a half-arsed solution that does an okay job by standing on the shoulders of giants, how much more money should you pour in to do a really really good job?
这个价值8600万美元的问题仍然存在-如果您可以建立一个半精打采的解决方案,站在巨人的肩膀上做个好的工作,那么您应该投入多少钱才能做一个真正非常好的工作?
My solution is not even in the same solar system as the 99.999% accurate scanner that some internet commenters seem to expect. But then again, BlueNet only has to meet a 95% accuracy target.
我的解决方案甚至与某些互联网评论者期望的99.999%准确度扫描仪不在同一个太阳系中。 但是话又说回来,BlueNet只需达到95%的精度目标。
So if $1 million gets you to 80% accuracy, and maybe $10 million gets you to 90% accuracy — when do you stop spending? Furthermore, considering that the technology has proven commercial applications here in Oceania, how much more taxpayer money should be poured into a proprietary, close-sourced solution when local startups could benefit? Australia is supposed to be an “innovation nation” after all.
因此,如果一百万美元让您达到80%的准确性,也许一千万美元让您达到90%的准确性—什么时候停止支出? 此外,考虑到该技术已在大洋洲证明了其在商业上的应用,当本地初创公司可以从中受益时,应向专有的,外包资源解决方案中投入多少纳税人的钱? 毕竟,澳大利亚应该是一个“创新国家”。
翻译自: https://www.freecodecamp.org/news/remember-that-86-million-license-plate-scanner-i-replicated-heres-what-happened-next-9f3c64e8f22b/
sbc8600