Smart waste bin for environmental education

ConciencIA Ecológica proposes smart bins to help children in Guayaquil learn waste sorting through images, sounds and lights.

A learning project shared by the community. The article documents its team, methods and results; it does not establish that the prototype is ready for real-world use.

Smart waste bin for environmental education

"I learned that we are never too small to make a difference"

Greta Thunberg

Latam online. Second Edition. 2021

The quote reminds us that young people can help change the world and shape their future.

But if that future looks polluted and bleak, how can they make a difference today?

Mascot of ConciencIA Ecológica

Young people’s concern for the environment inspired ConciencIA Ecológica: a proposal to make learning to sort waste fun. We combine technology and AI to promote the four Rs: reduce, reuse, recycle and recover.

Our team of seven people from Ecuador, Mexico and Venezuela took part in the second Saturdays.AI LATAM programme. Following its build to learn approach, we developed ConciencIA Ecológica, a deep learning project for primary and lower-secondary school pupils in Guayaquil, Ecuador.

If you want to know more, I invite you to continue reading.

Members of the ConciencIA Ecológica project team

The problem

According to the National Institute of Statistics and Census (INEC), in 2017 each Ecuadorian generated about 860 grams of solid waste per day, below the kilogram per day cited for Latin America and the Caribbean. The historical figures we gathered indicated a 48% increase over the previous year and motivated our interest in better waste sorting.

The figures consulted for the project indicated that 96% of collected waste went to sanitary landfills, emergency disposal cells or open dumps, while 4% was recycled. In a 2016 household survey, INEC conducted a household survey detecting that 59% of households did not classify waste.

When asked the reasons why they did not classify, 43% responded due to the lack of specific containers. However, the remaining 57% were due to cultural problems: “they do not know how to classify” (18%), “they are not interested” in waste classification (16%), they say “they do not know the benefits” (15%) or the remaining (8%) do not trust garbage collection systems.

The historical figures collected for the project identified Guayaquil as the largest waste-producing city, accounting for 28% of the country’s daily total. Reported reasons for not sorting included lack of interest (29%), not knowing the benefits (15%) and not knowing how (6%). The cited lack-of-interest figures for other cities were Ambato 20%, Machala 14%, Quito 11% and Cuenca 9%.

For this reason our project focuses its efforts on this city and opens its first chapter called Guayaquil.

Problem identified

Children are not only the future, they are also the present of the world

Today's children will be tomorrow's adults. If we want to change the way people interact with our planet, we must start from an early age by creating environmentally friendly habits, and these can be encouraged at school through education and the creation of spaces for good environmental practices.

This led to ConciencIA Ecológica: learning to sort waste through play.

This project focuses on reducing disinterest and ignorance in the classification of waste among basic education students in the city of Guayaquil, through containers with intelligent vision that guide children from 5 years old to 14 years old, in the correct classification and management of waste, promoting the practices of Reduce, Reuse, Recycle and Recover (4R).

The proposal unites several concepts, first seeking to familiarize children from school age with waste management, guiding them through audio and lights towards the correct container, also to correctly manage the waste in their container, contributing to the classification from the source, and creating awareness in the child through educational messages.

The containers are designed to be able to measure the volume of waste and emit a signal when the container is full, this will allow the school to empty it in time and avoid damage to the container gate.

Genesis of ecological consciousness

We considered two options for the central module: an Nvidia Jetson Nano connected to a camera and microcontroller, or a reused tablet providing a camera, computing power and coordination of signals to bins, speakers and lights.

We chose a reused tablet for its lower cost and potential accessibility for schools. In 2021, the team estimated a $70 budget, assuming the tablet was donated.

After deciding how to carry out the classification, we thought about what we wanted to classify and using the Ecuadorian Standard INEN 2841, 2014, regarding the standardization of colors for containers for deposit and temporary storage of solid waste, 5 classes were established: glass, paper, cardboard, plastic, organic.

Which were finally grouped into:

  • In a green container: Organic.
  • In a blue container: Plastic.
  • In a white container. Glass.
  • In a gray container: Cardboard and Paper.
  • Black bin: items the model could not classify confidently enough. A low score alone does not establish that an item is non-recyclable.

Steps to follow

1. Dataset

We selected data from three sources: an open collection of waste-image datasets called “Waste datasets review”, particularly with the data set Trashnet, containing 2,527 images; specialist photography websites; and phone photographs of items relevant to the school environment.

The dataset was built with a total of 5000 images in 5 classes: glass, paper, cardboard, plastic, organic. The metal class was not considered for the project. The dataset was divided into 80% training and 20% for validation.

2. Processing: the ABC

This was the longest phase due to the time invested to make the bounding boxes. For processing, we used LabelImg, a free image-annotation tool used with Python.

For each labeling, care was taken to enclose the object within the bounding box, as tight as possible to the image and making as many boxes as there were objects.

Example of using the LabelImg tool

Annotations were saved as YOLO-format TXT files. Each line contains a class and normalised bounding-box coordinates: (c, xn, yn, wn, hn).

YOLO annotation format (*.txt)

Where:

  • c: is the class number, in this project there are 5 classes, where c can take the value 0 for cardboard, 1 paper, 2 glass, 3 plastic and 4 organic.
  •  xn: center of the normalized bounding box in the x direction.
  • yn: center of the bounding box normalized in the y direction.
  • wn: normalized width of the bounding box (x).
  • hn: normalized height of the bounding box (y).

3. The model

The selected model was YOLOv5 (You Only Look Once). This is an open source system for object detection in real time pre-trained with the COCO dataset, which uses a single convolutional neural network (CNN) to detect objects in images.

According to the literature review, Yolo in its fifth version is a good algorithm to detect objects in the field of food, robotics, health, among other areas. We selected YOLOv5 based on detection studies we reviewed and its suitability for the project’s resources.

4. Results:

We carried out four transfer-learning runs and observed improvements between the first and last. Final metrics are detailed below. We configured the following variables:

  • Model: we used YOLOv5s, the Small variant, to keep training requirements manageable. Choosing a larger variant would involve balancing resources, speed and performance.
  • Weights: we started with COCO-pretrained weights. After each run, we saved the best checkpoint and used it as the starting point for the next.
  • Epochs: Training began with 10 epochs, reaching up to 30 epochs.
  • Batch, remained fixed at 6 for the entire training.
  • Image size: The data set was configured so that each image had a size of 640 x 640.

Configuration of the final run

The results of

  • Confusion matrix
  • Precision and Sensitivity (Recall)

The confusion matrix indicates what type of error the model is making, in the case of Yolo for calculation we used a confidence threshold of 0.25 and an IoU threshold of 0.45. These are different criteria: confidence filters detections, while IoU measures overlap between boxes. Neither implies a 50% probability of belonging to a class.

The class for the confusion matrix in the confidence calculation of 0.25 and an IoU (Intersection over Union) limit of 0.45

Yolo presents its matrix in relative values, where each element of the matrix is normalized to the total of the column, so the sum of the values in each column is equal to 1.

The main percentages in the matrix were: cardboard, 72% correct and 24% missed; glass, 85% correct and 10% mistaken for plastic; paper, 59% correct, 8% mistaken for cardboard and 32% missed; plastic, 64% correct and 34% missed; organic waste, 85% correct and 13% missed. These rounded figures do not list every error for each class.

Reported mean precision was 0.748 and recall was 0.723. Precision compares correct detections with all detections made; recall compares correctly detected objects with all objects that should have been detected. Misses in recall are false negatives, not false positives. These figures concern object detections, not directly the percentage of whole images classified correctly.

Results of the metrics that it shows us when obtaining from the confusion matrix

5. Developing the prototype

The scope was limited to a prototype: model deployment, hardware simulation and an application sketch connecting the two. Five classes were trained; “general waste” was proposed as a fallback for low-confidence results, not a sixth learned class.

The operation of the prototype will be explained below.

ConciencIA Ecológica was designed around five differently coloured bins and a central tablet-and-camera module. Bin size and openings were planned with children’s ease of use in mind.

Proposed design

A child would show an item to the camera. The model would estimate one of its five classes, with a fallback for uncertain results. The application would display the category and announce the material and the appropriate bin colour.

An outline of the prototype process is presented

At the same time, the Tablet will send a signal to a microcontroller to open the container intended to collect the waste and a signal will be sent that will turn on a light located in the container. The App will issue information about the practice of the 4Rs to promote its use. The child will finally go to the indicated container and deposit the waste.

An outline of the prototype process is presented

An ultrasonic sensor will be installed in each container to measure the volume of accumulated waste. The sensor will send a signal to three LEDs that will indicate three levels: Available (green), Intermediate (yellow) and Full (red). This is in order to prevent the containers from exceeding their capacity, since, if this occurs, they can hinder the opening of the door with the entry of waste, causing damage to the servomotors.

Internal structure of the container (ultrasonic sensor above)

6. Deployment

At this stage, the application would centralise model output and coordinate the display, sounds, lights and bin opening; interaction was still at the design stage.

The App must be started by the administrator, who can start running ConciencIA Ecológica through his username and password.

Design of the proposed application

Immediately, a menu is displayed which will show a “start recycling” button that will put ConciencIA Ecológica in waste recognition mode. Pressing the button turns on the proximity sensor and the optical sensor (camera); In the future we plan to implement a statistics module visible in the menu, for the purposes of this project idea it will be placed as disabled.

Design of the proposed application - starting the process

In recognition mode, when the approach sensor is activated, a message will be displayed for the child to present the object to the camera; when the object is detected, the prediction will be made.

Android app for classification, showing categorization in real time.

Once done, the identified class will be displayed on the screen and will emit a sound with the name of the container, then it will emit a short educational message.

Design of the proposed application with sound interaction

At the same time, the App will send the information via Bluetooth to the microcontroller, which will be responsible for opening the correct gate and emitting the signal to turn on the LEDs. Below is a simulated diagram in Tinkercad.

Circuit sketch

The future: next steps

Up to this point, we have an idea of how ConciencIA Ecológica in a simple way can guide children in creating habits to Reduce, Reuse, Recycle and Recover. But...

have we come this far?

In the short term, the first thing would be to bring this conceptualization to reality, improving each of the technical aspects contemplated in the prototype. Financing from the Municipality of Guayaquil or an interested institution would be the spark to propel the project.

In the medium term, increase the database and include other materials for classification, such as metal, and even scale the project to companies for hazardous materials such as batteries, energy-saving light bulbs, fluorescent light bulbs, which are causing a serious problem for the environment.

The design can be adapted to each region’s colours, materials and collection systems. Local rules and practices would need checking before deployment.

Could the app also answer children’s questions? A future version could support age-appropriate conversations about recycling, aligned with local educational programmes and subject to suitable supervision.

Ultrasonic sensors could also estimate waste volume and track it over time by bin, category and school.

A database and dashboard could track volumes, devices needing repair and full bins awaiting emptying. The aim is to help schools maintain the system and support learning through play.

Members:

  • Luis Reyes
  • Lady Sangacha
  • Jostin Maldonado
  • Karely Mayorquín
  • Jorge Chiquito
  • Verónica Abad
  • Carlos González

Project presentation: DemoDay

Open video or resource

Repository:

GitHub: https://github.com/SaturdaysAI/Projects/tree/master/LATAM_remote/ConcienciaEcologica

More artificial intelligence!

Saturdays.AI makes AI more accessible through shared learning and projects with a social purpose. Our motto is AI4ALL IS AI4GOOD.

Meet the Saturdays.AI community

FROM CURIOSITY TO PRACTICE

Your next step starts here.

Put an idea into practice or find people to continue learning with.

Receive new stories in your RSS reader ↗

A story from the Saturdays.AI community. Originally published on March 9, 2022.

← More community stories