Project Purpose

To reduce food waste and promote various cooking activities by recognizing the contents of the user's refrigerator, recommending possible cooking menus and providing related cooking videos.

스크린샷 2023-08-11 오후 1.36.24.png

413859523_1691660297 (1).gif

스크린샷 2023-08-11 오후 1.37.37.png

Main Features and Components

Raspberry Pi and the Pi Camera

Capture the contents of the refrigerator and use object recognition to identify ingredients.

Object recognition system

Use YOLOv5 to accurately recognize ingredients from images.


Recommend possible dishes based on the recognized ingredients.

YouTube crawling module

Automatically search and fetch YouTube links to cooking videos related to the suggested menu.

Telegram notification system

Sends menu recommendations and YouTube video links to users in Telegram messages.

Expected Benefits

  • Reduces food waste by efficiently utilizing the remaining ingredients in the refrigerator.
  • Helps users easily try different dishes, adding interest and enjoyment to cooking.

Respberry PI & Pico Setting

Raspberry PI 4

스크린샷 2023-08-11 오후 1.40.17.png

Raspberry PI link

We utilized Raspberry Pi to power our AI model and create data.

From the Raspberry homepage, you can save the Raspbian OS to an SD card, boot it, and install the necessary modules.

Camera Module Setting

You can install the camera module by following the link above.

Hardware connection

  • Enable the serial interface: Run sudo raspi-config and select 'Interfacing Options' > 'Serial' to enable hardware serial.
  • Write Python code or other code that can send and receive data through the serial port.

Raspberry PI Pico (W5100S-EVB-Pico)

스크린샷 2023-08-11 오후 1.40.35.png

Pico communicates and receives the data inferred by Raspberry Pi 4, and utilizes Ethernet communication to make menu recommendations using chatGPT.

Connect Ethernet, power and set up the UART to communicate with the Raspberry 4.

Hardware connections

Connect GPIO pin 14 (TX) of the Raspberry Pi 4 to the UART RX pin of the Pico.Connect GPIO pin 15 (RX) of the Raspberry Pi 4 to the UART TX pin of the Pico.Connect the GND pins of both boards to each other.

Connect GPIO pin 14 (TX) of the Raspberry Pi 4 to the UART RX pin of the Pico.Connect GPIO pin 15 (RX) of the Raspberry Pi 4 to the UART TX pin of the Pico.Connect the GND pins of both boards to each other.

YOLOv5(Object Detection)

스크린샷 2023-08-11 오후 1.40.56.png

YOLO Github

We detect the object refrigerator. Obviously, fast reference frames in object objectification are good for real-time detection, but we'll simply be objectifying and uniquing class values to create data.

1. To create the object detection model, I first created a dataset. Through crawling, I built a dataset of images related to food ingredients or containers. I spent about 5 hours drawing bounding boxes for each object element in the photos.📷

스크린샷 2023-08-11 오후 1.41.13.png

2. We trained with the nanomodel. The reason is lightweight. Then, we switched to Onnx TFLite. However, the capacity itself is not much different and the reference speed is not different, so we used the YOLOv5n model.YOLOv5 Train.ipynb

# pt to onnx to -> TFlite file !pip3 install tensorflow==2.3.1
!pip install -r requirements.txt
!python3 --weights --img 418 --batch 1 --include onnx tflite

3. Object recognition using Raspberry Pi 4. Create a reference using the appropriate code. I used RaspCam, so RaspCam, which I set to '0', which is data, enters the source part and makes an inference. Then, I post-process only the class value and bounding box coordinates of the objects detected through save-txt in the parameter and send the data to Pico.

스크린샷 2023-08-11 오후 1.41.44.png

스크린샷 2023-08-11 오후 1.41.49.png

We've coded the appropriate preprocessing in the file, and we can use it to send data to pico.We've also coded the UART communication.(The author is Korean, so there is code to preprocess the label values in Korean.)

from machine import UART
import time
import sys

uart = UART(0, 115200)

while True: if uart.any(): data = uart.readline() print("Received:", data.decode().strip()) sys.stdout.write(data.decode())...
Read more »