aibrick

所属分类:数值算法/人工智能
开发工具:JavaScript
文件大小:717KB
下载次数:0
上传日期:2023-04-11 14:30:09
上 传 者sh-1993
说明:  aibrick,用于用Pybricks编程乐高的人工智能机器学习
(Artificial Inteligence/Machine Learning for programming LEGO with Pybricks ,)

文件列表:
CHANGELOG.md (358, 2023-04-11)
LICENSE (1071, 2023-04-11)
OpenSans-Medium.ttf (129948, 2023-04-11)
ai-brick-ic.png (2326, 2023-04-11)
aibrick.py (2925, 2023-04-11)
aibrick_brick_classifier.py (2800, 2023-04-11)
ble.js (4719, 2023-04-11)
bt_connect.png (3589, 2023-04-11)
connection.js (1964, 2023-04-11)
font-awesome (0, 2023-04-11)
font-awesome\css (0, 2023-04-11)
font-awesome\css\font-awesome.css (37414, 2023-04-11)
font-awesome\css\font-awesome.min.css (31000, 2023-04-11)
font-awesome\fonts (0, 2023-04-11)
font-awesome\fonts\FontAwesome.otf (134808, 2023-04-11)
font-awesome\fonts\fontawesome-webfont.eot (165742, 2023-04-11)
font-awesome\fonts\fontawesome-webfont.svg (444379, 2023-04-11)
font-awesome\fonts\fontawesome-webfont.ttf (165548, 2023-04-11)
font-awesome\fonts\fontawesome-webfont.woff (98024, 2023-04-11)
font-awesome\fonts\fontawesome-webfont.woff2 (77160, 2023-04-11)
index.html (1806, 2023-04-11)
interface.js (5186, 2023-04-11)
mic.css (982, 2023-04-11)
models.js (5948, 2023-04-11)
rotate.png (626, 2023-04-11)
styles.css (3117, 2023-04-11)

# ![](https://github.com/repkovsky/aibrick/blob/master/ai-brick-ic.png) aiBrick aiBrick is [browser application](https://github.com/repkovsky/aibrick/blob/master/https://repkovsky.github.io/aibrick) which enables using machine learning and artificial intelligence algorithms with Lego Mindstorms/Spike/Technic hubs programmed in [Pybricks](https://github.com/repkovsky/aibrick/blob/master/https://pybricks.com/). Processing of camera/microphone input is performed in web browser using [TensorFlow.js](https://github.com/repkovsky/aibrick/blob/master/https://www.tensorflow.org/js) and results are sent to hub over [WebBluetoothAPI](https://github.com/repkovsky/aibrick/blob/master/https://developer.mozilla.org/en-US/docs/Web/API/Web_Bluetooth_API). Transmission on the hub's side is handled by `aibrick.py` module. Currently supported AI/ML models are: * [TeachableMachine Audio](https://github.com/repkovsky/aibrick/blob/master/https://teachablemachine.withgoogle.com/train/audio) * [TeachableMachine Image](https://github.com/repkovsky/aibrick/blob/master/https://teachablemachine.withgoogle.com/train/image) ## Running TeachableMachine models ### Creating AI/ML model and development of the Python program 1. Teach your AI/ML model on [TeachableMachine](https://github.com/repkovsky/aibrick/blob/master/https://teachablemachine.withgoogle.com/). After gathering samples and training, click "Export Model" and in the tab "Tensorflow.js" choose option "Upload (shareable link)" and click "Upload my model". Below you will find the shareable link with you audio/image recognition model, which will be used to configure aiBrick. 2. Install [Pybricks firmware](https://github.com/repkovsky/aibrick/blob/master/https://code.pybricks.com/) (v3.2.2 or higher) if you don't have it already on your hub. Download [aibrick.py](https://github.com/repkovsky/aibrick/blob/master/aibrick.py) module and upload it into [Pybricks code editor](https://github.com/repkovsky/aibrick/blob/master/https://code.pybricks.com/) using option "Import a file". 3. Create new file in Pybricks code editor (next to `aibrick.py`) and develop your code (see example of implementation in [aibrick_brick_classifier.py](https://github.com/repkovsky/aibrick/blob/master/aibrick_brick_classifier.py)). 4. Turn on the hub and connect Bluetooth in [Pybricks code editor](https://github.com/repkovsky/aibrick/blob/master/https://code.pybricks.com/). Run the program (it is going to be present in hub also when the Pybricks code editor is disconnected). 5. Open the [aiBrick website](https://github.com/repkovsky/aibrick/blob/master/https://repkovsky.github.io/aibrick) at the same device in Chrome Browser, where the code editor is running. Press the Bluetooth button in aiBrick, find hub on the list of available devices and connect. ### Running aiBrick with programmed hub 1. Turn on the hub. 2. Open the [aiBrick website](https://github.com/repkovsky/aibrick/blob/master/https://repkovsky.github.io/aibrick) in Chrome Browser on smartphone, tablet or PC. Press the Bluetooth button in aiBrick, find hub on the list of available devices and connect. 3. Push the button on hub to start the program. ## How does it work? Currently supported AI/ML models are based on neural networks - you can find [nice introduction on 3Blue1Brown])https://www.youtube.com/watch?v=aircAruvnKk) YouTube channel. Some nice answers can be also found in [TeachableMachine FAQ](https://github.com/repkovsky/aibrick/blob/master/https://teachablemachine.withgoogle.com/faq). Here is short description how aiBrick works: * aiBrick web application and Lego hub running Pybricks with `AiBrickteachableMachine` class communicate over Bluetooth using simple named messages. * aiBrick web application sends `setup` messages to hub until hub responds with `setup` message with JSON-formatted configuration of AI/ML model to be loaded in aiBrick. * aiBrick web application loads requested model downloading it from the provided address and sends `labels` message to hub with list of classes, which can be recognized by the AI model. * aiBrick web application starts to process audio/image. Depending on the configuration it will send two types of frames to Lego hub: * `p` (_probability_) frame containing probabilities of each class (after each processing of input chunk), with frequency limited to 10Hz * `d` (_detected_) frame, notyfing about class whose probability just exceeded 0.5, so it is considered to be detected. * No audio/image is recorded, stored or send over network - all processing is performed locally, on the device running web application. Network connection is necessary only for downloading AI/ML model from Google storage, after that step you can safely disable network connection at all, if you wish.

近期下载者

相关文件


收藏者