Git Product home page Git Product logo

depin-ai-demo's Introduction

depin-ai-demo

A simple example demonstrating how to run an AI-based prover on W3bstream.

Description

The AI model is designed to predict whether a user is walking or running. It operates under the assumption that the user wears 'smart shoes' equipped with two smart sensors. These sensors are connected via Bluetooth to each other and to a mobile app. As the user walks, the main sensor measures the vertical force exerted by the feet and records the interval in milliseconds between two consecutive steps. It then calculates average values across several steps and sends this information to the mobile app, which in turn sends it to the W3bstream project. The W3bstream network 'proves' whether the user is currently walking or running through AI prediction and sends the proof to the project's contract for tokenization.

Requirements

This demo is based on the Smartcore AI library for Rust, specifically version 0.3.2.

It utilizes the KNN Classifier for simplicity, and no special optimization is included in this example. The dataset, training process, classifier, and optimizations can be easily adapted to create a model for other use cases, but such customizations are left as an exercise for the reader.

The AI model file generated by this tool must then be imported into the W3bstream provere. Check this repo for how to do it (WIP)

Quick Start

Create the model

cd gen_model
cargo run

You should see an output similar to:

Finished dev [unoptimized + debuginfo] target(s) in 0.15s
     Running `target/debug/runner_ai`
********* Training  Model **********
100 samples. Accuracy: 1
********** Model trained **********
Prediction: [92.0, 76.0, 400.0] -> Running

The model file is located in the modeldirectory. Feel free to customize the training data in the data/ directory and modify src/main.rs as needed.

Build the W3bstream prover

By now see https://github.com/simonerom/depin-zk-test/tree/ai-test

Deploy the test contract

Deploy the W3bstream configuration

Send test data

depin-ai-demo's People

Contributors

simonerom 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.