This project wires together frameworks for Artificial Intelligence on the edge. The current focus is popular computer vision models in TensorFlow.js on React. The goal is to support React Native, and multiple web frameworks.
To play with AI-Lab, check out the latest storybook build.
React Native (broken for now) | React |
---|---|
yarn add ai-lab @tensorflow/tfjs
Then add it
import React from 'react';
import { AILabImage } from 'ai-lab';
The packages in this repository require Node v14+ and pnpm
.
The following code automatically runs the SSD model and places bounding boxes for detections.
<AILabImage
model={SSD_MODEL_HERE}
modelConfig={{
modelType: 'ssd'
}}
src={require('./cat.jpeg')}
visual
/>
This code runs the model on the supplied video and logs the results
<AILabLocalVideo
model={ClassificationModel}
onInference={console.log}
modelConfig={{
modelType: 'classification',
}}
src={theVideo}
/>
This code runs the model on the webcam feed and logs the results
<AILabWebCam
model={BlazePoseModel}
onInference={console.log}
modelConfig={{
modelType: 'pose',
}}
/>
Assure Node > v14 Installed
node -v
Assure TypeScript Installed
tsc -v
Assure/Install PNPM
npm install -g pnpm
If you ran yarn/npm - delete all node_modules
from those and start fresh.
Install project code at project root
pnpm install
Windows Users: The package tsconfig files are symlinks. If you're looking for a quick fix, you can copy the contents of the
shared/tsconfig.json
to these files as a temporary fix. These should not be committed like this, and should be reverted or linked in Windows.
pnpm build
Now you can run example projects that are depending on
E.G. of running the ai-lab-example
example
cd examples/ai-lab-example
pnpm start
Working within this repository requires Node v14. A Node Version Manager is recommended, such as nvm
.
This repository is a monorepo, and managed by pnpm
. To install it, run:
$ npm install pnpm -g
From the repository root directory, run the following command to install all dependencies:
$ pnpm install
Once install completes, development can begin.