bogdaaamn / coffee-cup-detect-runner

Application that runs an object detection model using Edge Impulse on Linux. It saves the moments when you hold a coffee cup longer than 3 seconds in a Supabase database

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Edge Impulse to Supabase on Linux

This is an application that runs an object detection model using Edge Impulse on Linux. It stores every moment when you hold a coffee cup longer than 3 seconds in a Supabase database.

It is heavily based on the Edge Impulse example-linux-with-twilio example application.

Edge Impulse

To run this application you need a development board that supports Edge Impulse. You need to train an object detection model that detects coffee cups. You need camera available on the board to run this model.

Once you have a trained model, install the edge-impulse-linux libraries to get your model running.

Supabase

To send data to the database, you need a Supabase project.

You can head over to database.new to create a new Supabase project. When your project is up and running, navigate to the project's SQL Editor and paste in the following snippet:

create table detections (
  id uuid NOT NULL DEFAULT uuid_generate_v4(),
  created_at timestamp with time zone not null default current_timestamp,
  message text
);

This will create a detections table in which you can insert rows every time, for example, a coffee cup is detected.

Alternatively, you can manually navigate to your project's Table Editor and configure the table manually.

Development

  1. Download the trained model to your device, more details here
$ edge-impulse-linux-runner --download model.eim
  1. Clone this repository
$ git clone https://github.com/bogdaaamn/coffee-cup-detect-runner
  1. Install the dependencies, make sure you have Node and npm installed on your device
$ npm install
  1. Create an .env file (see .env.example) and copy the Supabase credentials, more details here
SUPABASE_URL=<SUPABASE_URL>
SUPABASE_ANON_KEY=<SUPABASE_ANON_KEY>
  1. Start the application
$ npm run build
$ npm start
  1. Additionally, you can open a web browser at http://localhost:4911 to see the live webcam feed. You can keep an eye on the logs to see data being sent to the database.

Resources

About

Application that runs an object detection model using Edge Impulse on Linux. It saves the moments when you hold a coffee cup longer than 3 seconds in a Supabase database


Languages

Language:TypeScript 100.0%