鴿子 迷信
鴿子回避系統 (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.
免責聲明:您正在閱讀第1部分,該部分概述了該項目。 第2部分 介紹了技術設置和數據收集。 第3部分 介紹如何訓練Pigeon識別模型并在Raspberry Pi上運行它。
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.
想象一個美麗的夏日早晨。 陽光穿過樹葉,鳥兒唱著快樂的歌,一切都充滿了歡快的色彩。 您沖泡第一杯咖啡,踏上陽臺,享受只有周日早晨才能提供的和平與和諧。 突然間,某些事情干擾了您對地球生命之美的沉思。 在我的世界中,幾乎每天我都會在陽臺上發現鴿子便便。 我是忙碌的女人。 我喜歡安寧地享受早晨的咖啡,但是我不喜歡這樣-清潔鴿子糞便上的陽臺。
This morning I decided to start a war against the pigeons and Artificial Intelligence is the right weapon for this.
今天早上,我決定發動一場與鴿子的戰爭,而人工智能是解決這一問題的正確武器。
Now I set the emotional part aside and jump straight to the business of engineering, wiring, modeling, and soldering.
現在,我將情感部分擱置一旁,直接進入工程,布線,建模和焊接業務。
問題陳述 (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.
鴿子定期拜訪我的陽臺,并在那留下一些痕跡。 我想擺脫鴿子而不傷害他們,但是要傳達一個明確的信息,那就是這里不歡迎他們。
解決方法 (Solution approach)
I have built a Pigeon Avoidance System that detects pigeons and shoos them away. The initial hardware setup includes:
我建立了一個避免鴿子的系統,該系統可以檢測并驅趕鴿子。 初始硬件設置包括:
Raspberry Pi. I used Raspberry Pi 4 Model B 8GB RAM
Raspberry Pi 。 我使用了Raspberry Pi 4 Model B 8GB RAM
Camera module for Raspberry
覆盆子相機模組
Two motion sensors
兩個運動傳感器
Stepping motor
步進馬達
Software stack:
軟件堆棧:
- Python for the automation 自動化的Python
- Keras for the Deep Learning part 深度學習部分的Keras
- PHP, JavaScript, HTML for data labelling solution PHP,JavaScript,HTML數據標簽解決方案
架構概述 (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.
整體解決方案以以下方式工作。 每當鴿子降落在陽臺上時,運動傳感器就會檢測到光線變化。 它觸發了主管道,而主管道反過來又激活了攝像機。 相機拍攝照片并將其存儲在Raspberry上。 主管道將圖片發送到“鴿子識別模型”,該模型計算鴿子出現在圖片上的概率,并返回該類。 如果檢測到鴿子,則主管道會通過抬起帶有色帶的棍子來激活步進電機,以驅趕鴿子。 聽起來很簡單,雖然有效。

為什么您可能需要鴿子火種 (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.
到目前為止,尚未解釋的架構圖上有一個要素。 這正是人們通常揚起眉毛問:“鴿子火種到底是什么?”的時刻。 Pigeon Tinder是整個解決方案的重要組成部分。 顯然,為了訓練Pigeon Recognition Model,我需要將標記的數據饋入其中。 Pigeon Tinder是Raspberry上托管的Web應用程序,可幫助我手動標記圖像。 最初,我想實現一個移動應用程序,其中向左滑動將圖片標記為“不是鴿子”,向右滑動將標簽標記為“鴿子”。 但是,我很快意識到,首先,移動應用程序開發對于最小可行產品(MVP)有點過大。 其次,實際上,我需要三個課程,因為每當我在陽臺上喝咖啡時,我都會產生很多動作,而Raspberry會通過制作數百張圖片然后嘗試對其進行分類而消失。 因此,我引入了“人類”類,該類在拍攝下一張照片之前會造成兩分鐘的延遲。 我的主要希望是,在我已經呆在陽臺上的時候,鴿子還不夠輕率。 由于這些原因,我決定在Raspberry上安裝的Apache HTTP Server上運行一個Web應用程序。 鴿子火種的界面是什么樣的。

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.
由于我更喜歡??在手機上打鴿子,因此該網頁適合移動應用。 該應用程序非常簡單。 每當我為圖像分配標簽時,它就會將圖片移動到以下文件夾之一:“鴿子”,“人”或“無”。 這也是將來培訓的合適目錄結構。 “刪除”按鈕將圖片臨時移動到“垃圾箱”文件夾中,該文件夾定期由cron作業每晚運行的clean_directories.py腳本清空。
By the way, all code, including training routine, inference, Pigeon Tinder, and Raspberry automation is available on GitHub.
順便說一下,所有代碼,包括訓練例程,推理,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.
即使我沒有使用移動應用程序的原始想法,但仍保留了標簽模塊的原始名稱。 我希望Tinder不會為此起訴我,否則您會在新聞中聽到關于我的消息。
接下來是什么? (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躲避系統”的名義在幾篇文章中記錄該項目。 第2部分:“ 如何為鴿子回避系統設置數據收集 ”將說明如何訪問外部Raspberry組件,例如攝像頭,運動傳感器和步進引擎。 它還將提供有關數據收集以及如何在陽臺上設置整個系統的詳細信息。 深度學習部分在“ 如何使用深度學習從陽臺上射擊鴿子 ”中進行了描述。 但是,我建議您先閱讀有關數據收集的文章。 因此,請保持更新,與此同時, 第2部分 :我在廚房焊接電纜。 對于這個項目,我確實需要很多電纜。

If you got any questions about this project, please feel free to reach me via LinkedIn.
如果您對此項目有任何疑問,請隨時通過LinkedIn與我聯系。
翻譯自: https://towardsdatascience.com/how-artificial-intelligence-helped-me-to-win-the-war-against-the-pigeons-9458293983a1
鴿子 迷信
本文來自互聯網用戶投稿,該文觀點僅代表作者本人,不代表本站立場。本站僅提供信息存儲空間服務,不擁有所有權,不承擔相關法律責任。 如若轉載,請注明出處:http://www.pswp.cn/news/392024.shtml 繁體地址,請注明出處:http://hk.pswp.cn/news/392024.shtml 英文地址,請注明出處:http://en.pswp.cn/news/392024.shtml
如若內容造成侵權/違法違規/事實不符,請聯系多彩編程網進行投訴反饋email:809451989@qq.com,一經查實,立即刪除!