GithubHelp home page GithubHelp logo

ironacer's Introduction

Ironacer

Aim of the Ironacer

The mission statement of the project is to leverage object recognition to fire water at squirrels that enter the garden, in the service of non-lethally preventing them from eating the acer tree or digging up bulbs.

The parts

Detection

The detection of the squirrels is handled by the Yolov5 object recongition algorithm found at: https://github.com/ultralytics/yolov5 and is powered by pytorch.

The camera is run by a raspberry pi zero which provides a video stream. The inference of the images is then run on a mac mini in a conda environment to allow pytorch to run natively on apple silicon.

Deterrence

Use of a raspberry pi controlled solenoid valve to control the flow of water.

Information

Use of telegram to publish images of detected squirrels.

Project files

This project is a weird mix of https://github.com/ultralytics/yolov5 and my own code. camera.py - basically useless as it controlled the camera but that's done by stream.py stream.py - runs on the pi and serves the camera video for find.py find.py - class that reads the streaming video and runs motion detection on it of yolov5 inference. Saves images to motion_detected, results, and training_wheels. telegram_bot.py - runs the telegram bot to send images and videos of detected squirrels. utils.py - holds random one-off functions.

Installations

Camera

To use cv2, you need to enable the legacy camera via raspi-config.

The camera's block size is 32x16 so any image data provided to a renderer must have a width which is a multiple of 32, and a height which is a multiple of 16. 1024 x 1024

Conda env

Mostly following: https://towardsdatascience.com/yes-you-can-run-pytorch-natively-on-m1-macbooks-and-heres-how-35d2eaa07a83

brew install miniforge
conda init zsh
conda create --name pytorch_env python=3.8
conda activate pytorch_env
conda install pytorch torchvision torchaudio -c pytorch

Then run python detect.py etc inside that pytorch_env. I think that will work, this was written after I got it to all work and it wasn't straightforward.

Training runs and weights

All run and saved in yolov5/runs/train/exp{}/weights/{best.pt, last.pt} exp - exp2 are trained with 640 image size. exp2 - exp5 are trained with 1280 image size.

yolov5 has runs in gitignore.

Gadget mode for testing pi zero.

32 bit install.

internet sharing for Ethernet/Gadget on the mac.

Now, edit the file called cmdline.txt. Look for rootwait, and add modules-load=dwc2,g_ether immediately after.

In config.txt, and append the following: dtoverlay=dwc2

sudo apt install python3-opencv

cv2 dependancies sudo apt-get install libcblas-dev -y sudo apt-get install libhdf5-dev -y sudo apt-get install libhdf5-serial-dev -y sudo apt-get install libatlas-base-dev -y sudo apt-get install libjasper-dev -y sudo apt-get install libqtgui4 -y sudo apt-get install libopenjp2-7 -y

ironacer's People

Contributors

mechanicalpython avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.