Garbage Detection system which will detect objects based on whether it is plastic waste or plastics or just garbage.

Overview

Garbage Detection using Yolov5 on Jetson Nano 2gb Developer Kit.

Garbage detection system which will detect objects based on whether it is plastic waste or plastics or just garbage.

Aim and Objectives

Aim

To create a Garbage detection system which will detect objects based on whether it is plastic waste or plastics or just garbage.

Objectives

➢ The main objective of the project is to create a program which can be either run on Jetson nano or any pc with YOLOv5 installed and start detecting using the camera module on the device.

➢ Using appropriate datasets for recognizing and interpreting data using machine learning.

➢ To show on the optical viewfinder of the camera module whether objects are plastics or plastic waste or garbage.

Abstract

➢ An object is classified based on whether it is plastics, plastic waste, garbage etc and is detected by the live feed from the system’s camera.

➢ We have completed this project on jetson nano which is a very small computational device.

➢ A lot of research is being conducted in the field of Computer Vision and Machine Learning (ML), where machines are trained to identify various objects from one another. Machine Learning provides various techniques through which various objects can be detected.

➢ One such technique is to use YOLOv5 with Roboflow model, which generates a small size trained model and makes ML integration easier.

➢ Garbage has become a major problem for developing countries as their rate of growth also results in enormous consumption of products and hence more waste.

➢ Garbage segregation based on recyclable waste and unrecyclable waste like certain plastics helps solve the problem of garbage as well as helps in the further growth of economy by reusing certain recyclable material.

Introduction

➢ This project is based on a Garbage detection model with modifications. We are going to implement this project with Machine Learning and this project can be even run on jetson nano which we have done.

➢ This project can also be used to gather information about what category of waste does the object comes in.

➢ The objects can even be further classified into liquid, solid, organic, inorganic waste based on the image annotation we give in roboflow.

➢ Garbage detection sometimes becomes difficult as certain waste gets mixed together and gets harder for the model to detect. However, training in Roboflow has allowed us to crop images and also change the contrast of certain images to match the time of day for better recognition by the model.

➢ Neural networks and machine learning have been used for these tasks and have obtained good results.

➢ Machine learning algorithms have proven to be very useful in pattern recognition and classification, and hence can be used for Garbage detection as well.

Literature Review

➢ There is no denying that India has improved its sanitation coverage, but the country’s biggest shortcoming is its poor waste management infrastructure.

➢ Where solid waste is properly managed, after the waste is generated, it is segregated at source, then properly stored, collected, transported and treated. In an effective solid waste management model, there should be a goal to reduce, reuse, recover and recycle waste by using the appropriate technologies and the waste that is disposed of in landfills should be minimized, most importantly, landfills should be properly managed so that they don’t become a source of greenhouse gases and toxins.

➢ The waste that is generated is just recklessly dumped in most cases, some is dumped on the streets, and some is dumped in landfills that are not properly managed and this ends up polluting the air, soil, and underground water.

➢ There are not enough public bins, and the available bins are not even covered and, in many cases, waste overflows out of those bins and ends up going all over the streets.

➢ India’s informal recycling sector that consists of waste pickers plays a crucial role in segregating and recycling waste, but in most cases, they are not formally trained and at times they burn wastes at landfills to keep themselves warm at night and end up setting landfill fires that cause air pollution, and because of inadequate gear, they are also exposed to diseases and injuries.

➢ The sizes of landfills in India are constantly increasing and that is fast becoming a major concern.

Jetson Nano Compatibility

➢ The power of modern AI is now available for makers, learners, and embedded developers everywhere.

➢ NVIDIA® Jetson Nano™ Developer Kit is a small, powerful computer that lets you run multiple neural networks in parallel for applications like image classification, object detection, segmentation, and speech processing. All in an easy-to-use platform that runs in as little as 5 watts.

➢ Hence due to ease of process as well as reduced cost of implementation we have used Jetson nano for model detection and training.

➢ NVIDIA JetPack SDK is the most comprehensive solution for building end-to-end accelerated AI applications. All Jetson modules and developer kits are supported by JetPack SDK.

➢ In our model we have used JetPack version 4.6 which is the latest production release and supports all Jetson modules.

Proposed System

  1. Study basics of machine learning and image recognition.

  2. Start with implementation

     ➢ Front-end development
     ➢ Back-end development
    
  3. Testing, analysing and improvising the model. An application using python and Roboflow and its machine learning libraries will be using machine learning to identify whether objects are plastics, plastic waste like bottles or garbage.

  4. Use datasets to interpret the object and suggest whether the object is plastic waste, plastics or garbage.

Methodology

The Garbage detection system is a program that focuses on implementing real time Garbage detection.

It is a prototype of a new product that comprises of the main module: Garbage detection and then showing on viewfinder whether the object is garbage or not.

Garbage Detection Module

This Module is divided into two parts:
1] Garbage detection

➢ Ability to detect the location of object in any input image or frame. The output is the bounding box coordinates on the detected object.

➢ For this task, initially the Dataset library Kaggle was considered. But integrating it was a complex task so then we just downloaded the images from gettyimages.ae and google images and made our own dataset.

➢ This Datasets identifies object in a Bitmap graphic object and returns the bounding box image with annotation of object present in a given image.

2] Classification Detection

➢ Classification of the object based on whether it is garbage or not.

➢ Hence YOLOv5 which is a model library from roboflow for image classification and vision was used.

➢ There are other models as well but YOLOv5 is smaller and generally easier to use in production. Given it is natively implemented in PyTorch (rather than Darknet), modifying the architecture and exporting and deployment to many environments is straightforward.

➢ YOLOv5 was used to train and test our model for various classes like Plastics, plastic waste, garbage. We trained it for 149 epochs and achieved an accuracy of approximately 91%.

Jetson Nano 2GB Developer Kit.

Setup

Demo1

Demo2

Demo3

Demo4

Installation

Initial Setup

Remove unwanted Applications.

sudo apt-get remove --purge libreoffice*
sudo apt-get remove --purge thunderbird*

Create Swap file

sudo fallocate -l 10.0G /swapfile1
sudo chmod 600 /swapfile1
sudo mkswap /swapfile1
sudo vim /etc/fstab
###########add line###########
/swapfile1 swap swap defaults 0 0

Cuda Configuration

vim ~/.bashrc
#############add line #############
export PATH=/usr/local/cuda/bin${PATH:+:${PATH}}
export LD_LIBRARY_PATh=/usr/local/cuda/lib64${LD_LIBRARY_PATH:+:${LD_LIBRARY_PATH}}
export LD_PRELOAD=/usr/lib/aarch64-linux-gnu/libgomp.so.1
source ~/.bashrc

Udpade and Upgrade a System

sudo apt-get update
sudo apt-get upgrade

Install Some Required Packages

sudo apt install curl
curl https://bootstrap.pypa.io/get-pip.py -o get-pip.py
sudo python3 get-pip.py
sudo apt-get install libopenblas-base libopenmpi-dev
sudo apt-get install python3-dev build-essential autoconf libtool pkg-config python-opengl python-pil python-pyrex python-pyside.qtopengl idle-python2.7 qt4-dev-tools qt4-designer libqtgui4 libqtcore4 libqt4-xml libqt4-test libqt4-script libqt4-network libqt4-dbus python-qt4 python-qt4-gl libgle3 python-dev libssl-dev libpq-dev python-dev libxml2-dev libxslt1-dev libldap2-dev libsasl2-dev libffi-dev libfreetype6-dev python3-dev
vim ~/.bashrc
###### add line ########
export OPENBLAS_CORETYPE=ARMV8
source ~/.bashrc
sudo pip3 install pillow

Install Torch

curl -LO https://nvidia.box.com/shared/static/p57jwntv436lfrd78inwl7iml6p13fzh.whl
mv p57jwntv436lfrd78inwl7iml6p13fzh.whl torch-1.8.0-cp36-cp36m-linux_aarch64.whl
sudo pip3 install torch-1.8.0-cp36-cp36m-linux_aarch64.whl

#Check Torch, output should be "True"

sudo python3 -c "import torch; print(torch.cuda.is_available())"

Installation of torchvision.

git clone --branch v0.9.1 https://github.com/pytorch/vision torchvision
cd torchvision/
sudo python3 setup.py install

Clone yolov5 Repositories and make it Compatible with Jetson Nano.

cd
git clone https://github.com/ultralytics/yolov5.git
cd yolov5/
sudo pip3 install numpy==1.19.4

# comment torch,PyYAML and torchvision in requirement.txt

sudo pip3 install --ignore-installed PyYAML>=5.3.1
sudo pip3 install -r requirements.txt

Download weights and Test Yolov5 Installation on USB webcam

sudo python3 detect.py
sudo python3 detect.py --weights yolov5s.pt --source 0

Garbage Dataset Training

We used Google Colab And Roboflow

train your model on colab and download the weights and past them into yolov5 folder link of project

Running Garbage Detection Model

source '0' for webcam

!python detect.py --weights best.pt --img 416 --conf 0.1 --source 0

Output Video

garbage_detection.mp4

Advantages

➢ The Garbage detection system will be of great help in reducing diseases that occur because of poor waste management.

➢ The Garbage detection system shows the classification of the object whether they are plastics, plastic waste like bottles or just plain garbage.

➢ It can then convey to the person who cleans or if it needs to be completely automated then to the segregating machine to separate the waste according to the classes specified.

➢ When completely automated no user input is required and therefore works with absolute efficiency and speed.

➢ As it is completely automated the cost of segregation of waste decreases significantly.

➢ It can work around the clock and therefore becomes more cost efficient.

Application

➢Detects object class like plastic or plastic waste in a given image frame or viewfinder using a camera module.

➢ Can be used in various garbage segregation plants.

➢ Can be used as a refrence for other ai models based on Garbage detection.

Future Scope

➢ As we know technology is marching towards automation, so this project is one of the step towards automation.

➢ Thus, for more accurate results it needs to be trained for more images, and for a greater number of epochs.

➢ Garbage segregation will become a necessity in the future due to rise in population and hence our model will be of great help to tackle the situation in an efficient way.

➢ As more products gets released due to globalization and urbanization new waste will be created and hence our model which can be trained and modified with just the addition of images can be very useful.

Conclusion

➢ In this project our model is trying to detect objects and then showing it on viewfinder, live as what their class is as whether they are plastics, plastic waste or garbage as we have specified in Roboflow.

➢ The model solves the problem of garbage segregation in modern India and helps counteract and prevent water borne diseases.

➢ Lower diseases lead to better economy of country as the workforce doesn’t get affected and hence can go to work with no problem.

Refrences

1] Roboflow :- https://roboflow.com/

2] Datasets or images used: https://www.gettyimages.ae/search/2/image?phrase=garbage

3] Google images

Articles

[1] https://www.recycling-magazine.com/2020/05/06/waste-management-crisis-in-india/#:~:text=Urban%20India%20generates%2062%20million,just%2011.9%20million%20is%20treated.

[2] https://www.downtoearth.org.in/blog/waste/india-s-challenges-in-waste-management-56753

Owner
Rishikesh A. Bondade
Fresher
Rishikesh A. Bondade
Text-to-SQL in the Wild: A Naturally-Occurring Dataset Based on Stack Exchange Data

SEDE SEDE (Stack Exchange Data Explorer) is new dataset for Text-to-SQL tasks with more than 12,000 SQL queries and their natural language description

Rupert. 83 Nov 11, 2022
Weakly Supervised Posture Mining with Reverse Cross-entropy for Fine-grained Classification

Fine-grainedImageClassification Weakly Supervised Posture Mining with Reverse Cross-entropy for Fine-grained Classification We trained model here: lin

ZhenchaoTang 14 Oct 21, 2022
Architecture Patterns with Python (TDD, DDD, EDM)

architecture-traning Architecture Patterns with Python (TDD, DDD, EDM) Chapter 5. 높은 기어비와 낮은 기어비의 TDD 5.2 도메인 계층 테스트를 서비스 계층으로 옮겨야 하는가? 도메인 계층 테스트 def

minsung sim 2 Mar 04, 2022
Code for HodgeNet: Learning Spectral Geometry on Triangle Meshes, in SIGGRAPH 2021.

HodgeNet | Webpage | Paper | Video HodgeNet: Learning Spectral Geometry on Triangle Meshes Dmitriy Smirnov, Justin Solomon SIGGRAPH 2021 Set-up To ins

Dima Smirnov 61 Nov 27, 2022
Public repository of the 3DV 2021 paper "Generative Zero-Shot Learning for Semantic Segmentation of 3D Point Clouds"

Generative Zero-Shot Learning for Semantic Segmentation of 3D Point Clouds Björn Michele1), Alexandre Boulch1), Gilles Puy1), Maxime Bucher1) and Rena

valeo.ai 15 Dec 22, 2022
pytorch implementation for Photo-Realistic Single Image Super-Resolution Using a Generative Adversarial Network arXiv:1609.04802

PyTorch SRResNet Implementation of Paper: "Photo-Realistic Single Image Super-Resolution Using a Generative Adversarial Network"(https://arxiv.org/abs

Jiu XU 436 Jan 09, 2023
Keras implementation of PersonLab for Multi-Person Pose Estimation and Instance Segmentation.

PersonLab This is a Keras implementation of PersonLab for Multi-Person Pose Estimation and Instance Segmentation. The model predicts heatmaps and vari

OCTI 160 Dec 21, 2022
Code for the paper "MASTER: Multi-Aspect Non-local Network for Scene Text Recognition" (Pattern Recognition 2021)

MASTER-PyTorch PyTorch reimplementation of "MASTER: Multi-Aspect Non-local Network for Scene Text Recognition" (Pattern Recognition 2021). This projec

Wenwen Yu 255 Dec 29, 2022
Text to image synthesis using thought vectors

Text To Image Synthesis Using Thought Vectors This is an experimental tensorflow implementation of synthesizing images from captions using Skip Though

Paarth Neekhara 2.1k Jan 05, 2023
Iranian Cars Detection using Yolov5s, PyTorch

Iranian Cars Detection using Yolov5 Train 1- git clone https://github.com/ultralytics/yolov5 cd yolov5 pip install -r requirements.txt 2- Dataset ../

Nahid Ebrahimian 22 Dec 05, 2022
This repo holds the code of TransFuse: Fusing Transformers and CNNs for Medical Image Segmentation

TransFuse This repo holds the code of TransFuse: Fusing Transformers and CNNs for Medical Image Segmentation Requirements Pytorch=1.6.0, 1.9.0 (=1.

Rayicer 93 Dec 19, 2022
Run Effective Large Batch Contrastive Learning on Limited Memory GPU

Gradient Cache Gradient Cache is a simple technique for unlimitedly scaling contrastive learning batch far beyond GPU memory constraint. This means tr

Luyu Gao 198 Dec 29, 2022
Code for ICCV 2021 paper "HuMoR: 3D Human Motion Model for Robust Pose Estimation"

Code for ICCV 2021 paper "HuMoR: 3D Human Motion Model for Robust Pose Estimation"

Davis Rempe 367 Dec 24, 2022
Linear algebra python - Number of operations and problems in Linear Algebra and Numerical Linear Algebra

Linear algebra in python Number of operations and problems in Linear Algebra and

Alireza 5 Oct 09, 2022
This repository contains the PyTorch implementation of the paper STaCK: Sentence Ordering with Temporal Commonsense Knowledge appearing at EMNLP 2021.

STaCK: Sentence Ordering with Temporal Commonsense Knowledge This repository contains the pytorch implementation of the paper STaCK: Sentence Ordering

Deep Cognition and Language Research (DeCLaRe) Lab 23 Dec 16, 2022
ScaleNet: A Shallow Architecture for Scale Estimation

ScaleNet: A Shallow Architecture for Scale Estimation Repository for the code of ScaleNet paper: "ScaleNet: A Shallow Architecture for Scale Estimatio

Axel Barroso 34 Nov 09, 2022
Official Pytorch implementation of 6DRepNet: 6D Rotation representation for unconstrained head pose estimation.

6D Rotation Representation for Unconstrained Head Pose Estimation (Pytorch) Paper Thorsten Hempel and Ahmed A. Abdelrahman and Ayoub Al-Hamadi, "6D Ro

Thorsten Hempel 284 Dec 23, 2022
DeLighT: Very Deep and Light-Weight Transformers

DeLighT: Very Deep and Light-weight Transformers This repository contains the source code of our work on building efficient sequence models: DeFINE (I

Sachin Mehta 440 Dec 18, 2022
Pytorch Implementations of large number classical backbone CNNs, data enhancement, torch loss, attention, visualization and some common algorithms.

Torch-template-for-deep-learning Pytorch implementations of some **classical backbone CNNs, data enhancement, torch loss, attention, visualization and

Li Shengyan 270 Dec 31, 2022
CARLA: A Python Library to Benchmark Algorithmic Recourse and Counterfactual Explanation Algorithms

CARLA - Counterfactual And Recourse Library CARLA is a python library to benchmark counterfactual explanation and recourse models. It comes out-of-the

Carla Recourse 200 Dec 28, 2022