鸽子 迷信_人工智能如何帮助我战胜鸽子
鴿子 迷信
鴿子回避系統(tǒng) (Pigeon Avoidance System)
Disclaimer: You are reading Part 1 that gives an overview of the project. Part 2 describes the technical setup and data collection. Part 3 is about how to train the Pigeon Recognition Model and run it on Raspberry Pi.
免責(zé)聲明:您正在閱讀第1部分,該部分概述了該項(xiàng)目。 第2部分 介紹了技術(shù)設(shè)置和數(shù)據(jù)收集。 第3部分 介紹如何訓(xùn)練Pigeon識別模型并在Raspberry Pi上運(yùn)行它。
Imagine a beautiful summer morning. The sun is shining through the leaves, the birds are singing happy songs, and everything is full of cheerful colors. You make your first cup of coffee and step on the balcony to enjoy the peace and harmony that only Sunday mornings can provide. Suddenly something disrupts you from the contemplation of the beauty of terrestrial life. In my world, it is the pigeon poop that I find on my balcony almost every day. I am a busy woman. I like enjoying my morning coffee in peace, but what I do not like — to clean the balcony from pigeon’s feces.
想象一個美麗的夏日早晨。 陽光穿過樹葉,鳥兒唱著快樂的歌,一切都充滿了歡快的色彩。 您沖泡第一杯咖啡,踏上陽臺,享受只有周日早晨才能提供的和平與和諧。 突然間,某些事情干擾了您對地球生命之美的沉思。 在我的世界中,幾乎每天我都會在陽臺上發(fā)現(xiàn)鴿子便便。 我是忙碌的女人。 我喜歡安寧地享受早晨的咖啡,但是我不喜歡這樣-清潔鴿子糞便上的陽臺。
This morning I decided to start a war against the pigeons and Artificial Intelligence is the right weapon for this.
今天早上,我決定發(fā)動一場與鴿子的戰(zhàn)爭,而人工智能是解決這一問題的正確武器。
Now I set the emotional part aside and jump straight to the business of engineering, wiring, modeling, and soldering.
現(xiàn)在,我將情感部分?jǐn)R置一旁,直接進(jìn)入工程,布線,建模和焊接業(yè)務(wù)。
問題陳述 (Problem statement)
Pigeons regularly visit my balcony and left certain traces there. I want to get rid of pigeons without harming them, but by delivering a clear message that they are not welcomed here.
鴿子定期拜訪我的陽臺,并在那留下一些痕跡。 我想擺脫鴿子而不傷害他們,但是要傳達(dá)一個明確的信息,那就是這里不歡迎他們。
解決方法 (Solution approach)
I have built a Pigeon Avoidance System that detects pigeons and shoos them away. The initial hardware setup includes:
我建立了一個避免鴿子的系統(tǒng),該系統(tǒng)可以檢測并驅(qū)趕鴿子。 初始硬件設(shè)置包括:
Raspberry Pi. I used Raspberry Pi 4 Model B 8GB RAM
Raspberry Pi 。 我使用了Raspberry Pi 4 Model B 8GB RAM
Camera module for Raspberry
覆盆子相機(jī)模組
Two motion sensors
兩個運(yùn)動傳感器
Stepping motor
步進(jìn)馬達(dá)
Software stack:
軟件堆棧:
- Python for the automation 自動化的Python
- Keras for the Deep Learning part 深度學(xué)習(xí)部分的Keras
- PHP, JavaScript, HTML for data labelling solution PHP,JavaScript,HTML數(shù)據(jù)標(biāo)簽解決方案
架構(gòu)概述 (Architecture overview)
The overall solution works in the following way. Whenever a pigeon lands on the balcony, the motion sensor detects a light change. It triggers the Main Pipeline, which in return activates the camera. The camera takes a picture and stores it on the Raspberry. The Main Pipeline sends the picture to the Pigeon Recognition Model that calculates the probability of a pigeon being on the picture and returns back the class. If a pigeon was detected, the Main Pipeline activates the stepping motor that shoos pigeon away by lifting up a stick with ribbons. Sounds pretty straightforward, though effective.
整體解決方案以以下方式工作。 每當(dāng)鴿子降落在陽臺上時,運(yùn)動傳感器就會檢測到光線變化。 它觸發(fā)了主管道,而主管道反過來又激活了攝像機(jī)。 相機(jī)拍攝照片并將其存儲在Raspberry上。 主管道將圖片發(fā)送到“鴿子識別模型”,該模型計(jì)算鴿子出現(xiàn)在圖片上的概率,并返回該類。 如果檢測到鴿子,則主管道會通過抬起帶有色帶的棍子來激活步進(jìn)電機(jī),以驅(qū)趕鴿子。 聽起來很簡單,雖然有效。
Pigeon Avoidance System Architecture Diagram鴿子回避系統(tǒng)架構(gòu)圖為什么您可能需要鴿子火種 (Why you might need a Pigeon Tinder)
There is one element on the architecture diagram that hasn’t been explained so far, the Pigeon Tinder. That is exactly the moment when people usually raising their eyebrows asking: “What the hell is the Pigeon Tinder?” Pigeon Tinder is an essential part of the overall solution. Apparently, in order to train the Pigeon Recognition Model, I need to feed labeled data into it. Pigeon Tinder is a web app hosted on the Raspberry that helps me to manually label the images. Initially, I wanted to implement a mobile app where the left swipe would label the picture as “Not a Pigeon” and the right swipe as “Pigeon”. However, shortly I realized that first, mobile app development is a bit of overkill for the Minimal Viable Product (MVP). Second, in reality, I need three classes, as whenever I drink coffee on the balcony I would produce a lot of motion and the Raspberry would go off by making hundreds of pictures and then trying to classify them. Therefore I introduced a class “Human” that causes a two minutes delay before the next picture is taken. My main hope is that pigeons are not impudent enough to get on the balcony while I am already there. Because of these reasons, I settled for a web app running on Apache HTTP Server installed on the Raspberry. That how the interface of the Pigeon Tinder looks like.
到目前為止,尚未解釋的架構(gòu)圖上有一個要素。 這正是人們通常揚(yáng)起眉毛問:“鴿子火種到底是什么?”的時刻。 Pigeon Tinder是整個解決方案的重要組成部分。 顯然,為了訓(xùn)練Pigeon Recognition Model,我需要將標(biāo)記的數(shù)據(jù)饋入其中。 Pigeon Tinder是Raspberry上托管的Web應(yīng)用程序,可幫助我手動標(biāo)記圖像。 最初,我想實(shí)現(xiàn)一個移動應(yīng)用程序,其中向左滑動將圖片標(biāo)記為“不是鴿子”,向右滑動將標(biāo)簽標(biāo)記為“鴿子”。 但是,我很快意識到,首先,移動應(yīng)用程序開發(fā)對于最小可行產(chǎn)品(MVP)有點(diǎn)過大。 其次,實(shí)際上,我需要三個課程,因?yàn)槊慨?dāng)我在陽臺上喝咖啡時,我都會產(chǎn)生很多動作,而Raspberry會通過制作數(shù)百張圖片然后嘗試對其進(jìn)行分類而消失。 因此,我引入了“人類”類,該類在拍攝下一張照片之前會造成兩分鐘的延遲。 我的主要希望是,在我已經(jīng)呆在陽臺上的時候,鴿子還不夠輕率。 由于這些原因,我決定在Raspberry上安裝的Apache HTTP Server上運(yùn)行一個Web應(yīng)用程序。 鴿子火種的界面是什么樣的。
Pigeon Tinder鴿子火種As I prefer to tinder pigeons on my phone, the web page is adapted for mobile usage. The app is very simple. Whenever I assign a label to the image, it moves the picture into one of the folders: “pigeon”, “human”, or “nothing”. That is also a proper directory structure for future training. The Delete button temporarily moves the picture into a “trash” folder that is regularly emptied by the clean_directories.py script that is run by a cron job every night.
由于我更喜歡??在手機(jī)上打鴿子,因此該網(wǎng)頁適合移動應(yīng)用。 該應(yīng)用程序非常簡單。 每當(dāng)我為圖像分配標(biāo)簽時,它就會將圖片移動到以下文件夾之一:“鴿子”,“人”或“無”。 這也是將來培訓(xùn)的合適目錄結(jié)構(gòu)。 “刪除”按鈕將圖片臨時移動到“垃圾箱”文件夾中,該文件夾定期由cron作業(yè)每晚運(yùn)行的clean_directories.py腳本清空。
By the way, all code, including training routine, inference, Pigeon Tinder, and Raspberry automation is available on GitHub.
順便說一下,所有代碼,包括訓(xùn)練例程,推理,Pigeon Tinder和Raspberry自動化,都可以在GitHub上獲得 。
Even though I didn’t go for the original idea of the mobile app, I still kept the original name of the labeling module. I hope Tinder will not sue me for this, otherwise you will hear about me in the news.
即使我沒有使用移動應(yīng)用程序的原始想法,但仍保留了標(biāo)簽?zāi)K的原始名稱。 我希望Tinder不會為此起訴我,否則您會在新聞中聽到關(guān)于我的消息。
接下來是什么? (What is next?)
I am documenting this project in a few articles under the name “Pigeon Avoidance System”. Part 2: “How to set up data collection for the pigeon avoidance system” will explain how to access external Raspberry components like camera, motion sensor, and stepping engine. It will also provide details about the data collection and how to set up the overall system on the balcony. The Deep Learning part is described in: “How to use Deep Learning to shoo the pigeons from the balcony”. However, I would recommend reading the article about the data collection first. So stay updated and in the meantime, a sneak peek for Part 2: me soldering cables in my kitchen. I indeed need a lot of cables for this project.
我正在以“ Pigeon躲避系統(tǒng)”的名義在幾篇文章中記錄該項(xiàng)目。 第2部分:“ 如何為鴿子回避系統(tǒng)設(shè)置數(shù)據(jù)收集 ”將說明如何訪問外部Raspberry組件,例如攝像頭,運(yùn)動傳感器和步進(jìn)引擎。 它還將提供有關(guān)數(shù)據(jù)收集以及如何在陽臺上設(shè)置整個系統(tǒng)的詳細(xì)信息。 深度學(xué)習(xí)部分在“ 如何使用深度學(xué)習(xí)從陽臺上射擊鴿子 ”中進(jìn)行了描述。 但是,我建議您先閱讀有關(guān)數(shù)據(jù)收集的文章。 因此,請保持更新,與此同時, 第2部分 :我在廚房焊接電纜。 對于這個項(xiàng)目,我確實(shí)需要很多電纜。
Me soldering cables in my kitchen我在廚房里焊接電纜If you got any questions about this project, please feel free to reach me via LinkedIn.
如果您對此項(xiàng)目有任何疑問,請隨時通過LinkedIn與我聯(lián)系。
翻譯自: https://towardsdatascience.com/how-artificial-intelligence-helped-me-to-win-the-war-against-the-pigeons-9458293983a1
鴿子 迷信
總結(jié)
以上是生活随笔為你收集整理的鸽子 迷信_人工智能如何帮助我战胜鸽子的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 做梦梦到彩虹和凤凰是什么意思
- 下一篇: scikit keras_Scikit学