Skip to content

Commit 2c880c8

Browse files
Merge branch 'release/v0.2.0'
2 parents c58c8da + 9c90e7b commit 2c880c8

File tree

197 files changed

+7855
-5335
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

197 files changed

+7855
-5335
lines changed

.eslintignore

Lines changed: 0 additions & 1 deletion
This file was deleted.

.eslintrc.js

Lines changed: 9 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -8,19 +8,7 @@ module.exports = {
88
sourceType: 'module',
99
project: './tsconfig.json',
1010
},
11-
plugins: ['svelte3'],
12-
extends: ['airbnb-typescript/base', 'prettier', 'prettier/@typescript-eslint'],
13-
overrides: [
14-
{
15-
files: ['**/*.svelte'],
16-
processor: 'svelte3/svelte3',
17-
rules: {
18-
'import/first': 'off',
19-
'import/no-mutable-exports': 'off',
20-
'@typescript-eslint/explicit-module-boundary-types': 'off',
21-
},
22-
},
23-
],
11+
extends: ['airbnb-typescript/base', 'prettier'],
2412
rules: {
2513
'import/extensions': [
2614
'error',
@@ -37,4 +25,12 @@ module.exports = {
3725
'import/prefer-default-export': 'off',
3826
'no-plusplus': 'off',
3927
},
28+
ignorePatterns: [
29+
'node_modules/*',
30+
'**/*.svelte',
31+
'dist/*',
32+
'types',
33+
'.prettierrc.js',
34+
'.eslintrc.js',
35+
],
4036
};

.gitignore

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
.DS_STORE
22
node_modules
33
dist
4-
types
4+
types
5+
*.onnx
6+
examples/dist

.vscode/settings.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
},
55
"svelte.plugin.css.diagnostics.enable": false,
66
"editor.formatOnSave": true,
7+
"css.validate": false,
78
"eslint.validate": ["javascript", "javascriptreact", "svelte"],
89
"[svelte]": {
910
"editor.defaultFormatter": "svelte.svelte-vscode"

CHANGELOG.md

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
# Marcelle changelog
2+
3+
## Unreleased
4+
5+
### Breaking changes
6+
7+
- `tfImageClassifier` has been replaced by `tfGenericModel`
8+
- Module `name` property has been replaced by `title`
9+
- Modules' mount method now accepts an HTML Element rather than a selector
10+
- `imageDrop` has been renamed to `imageUpload`
11+
- `browser` has been renamed to `datasetBrowser`
12+
- `progress` has been renamed to `trainingProgress`
13+
- `confusion` has been renamed to `confusionMatrix`
14+
- Dashboards now have a `closable` option, which is disabled by default.
15+
- Dataset's `$created` stream has been replaced by a more generic `$changes` stream
16+
17+
### New Features
18+
19+
- Mobilenet and COCO-SSD are now cached in the browser's storage for improved network performance
20+
- Model Storage: models can be saved and loaded from datastores. They can be automatically synchronized with a datastore. File import/export is also possible
21+
- Dataset upload has been added
22+
- Dashboard now expose $active and $page streams to monitor its state
23+
- Dashboard settings have been improved (TODO: give details + breaking changes)
24+
- `trainingPlot`: The logs to display can be be configured in the module's options. It is possible to pass either a scalar (incremental mode) an array for each log.
25+
- `imageUpload` now supports target image dimensions and automatically crops and resizes images
26+
- `datasetBrowser` now allows the selection, deletion or class change of instances
27+
28+
### New Modules
29+
30+
- `tfGenericModel`
31+
- `fileUpload`
32+
- `imageUpload`
33+
- `onnxImageClassifier`
34+
35+
### Deprecated Modules
36+
37+
- `tfImageClassifier`
38+
- `imageDrop`
39+
40+
### Performance Improvements
41+
42+
- Datasets have been updated for improved performance
43+
- Memory management related to TFJS has been improved
44+
45+
### Bug Fixes
46+
47+
- `webcam` now supports multiple video devices
48+
- Quite a few others...
49+
50+
### Internal Changes
51+
52+
- Build system update
53+
- Examples now use vite
54+
- Svelte components now use Typescript
55+
- Module's `description` was unused and has been removed
56+
- Data stores have a `$services` stream and have been simplified
57+
- The architecture for models has been improved
58+
59+
## 0.1.0-alpha.4
60+
61+
- First-ish published version

README.md

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ Marcelle is a web-based reactive toolkit facilitating the design of custom ML pi
2727

2828
## Installation
2929

30-
[See online documentation](https://marcelle.netlify.app/installation.html)
30+
[See online documentation](https://marcelle.dev/installation.html)
3131

3232
Using NPM:
3333

@@ -43,19 +43,10 @@ yarn add @marcellejs/core@next
4343

4444
## Usage
4545

46-
See [Online Documentation](https://marcelle.netlify.app) and [Examples](https://glitch.com/@marcelle.crew/marcelle-examples).
46+
See [Online Documentation](https://marcelle.dev)
4747

4848
## 🛠 Developing
4949

50-
### Setting up VSCode
51-
52-
[Download VSCode](https://code.visualstudio.com/) and install the following extensions:
53-
54-
- [Svelte for VS Code](https://marketplace.visualstudio.com/items?itemName=svelte.svelte-vscode)
55-
- [ESLint](https://marketplace.visualstudio.com/items?itemName=dbaeumer.vscode-eslint)
56-
- [Prettier - Code formatter](https://marketplace.visualstudio.com/items?itemName=esbenp.prettier-vscode)
57-
- [Tailwind CSS IntelliSense](https://marketplace.visualstudio.com/items?itemName=bradlc.vscode-tailwindcss)
58-
5950
### Building the library
6051

6152
To build for production:
@@ -72,6 +63,15 @@ yarn dev # OR npm run dev
7263

7364
To generate the typescript declaration files (useful for the rollup example), run `yarn build:types` in production, or `yarn dev:types` in development.
7465

66+
### Setting up VSCode
67+
68+
[Download VSCode](https://code.visualstudio.com/) and install the following extensions:
69+
70+
- [Svelte for VS Code](https://marketplace.visualstudio.com/items?itemName=svelte.svelte-vscode)
71+
- [ESLint](https://marketplace.visualstudio.com/items?itemName=dbaeumer.vscode-eslint)
72+
- [Prettier - Code formatter](https://marketplace.visualstudio.com/items?itemName=esbenp.prettier-vscode)
73+
- [Tailwind CSS IntelliSense](https://marketplace.visualstudio.com/items?itemName=bradlc.vscode-tailwindcss)
74+
7575
## ✍️ Authors
7676

7777
- [@JulesFrancoise](https://github.com/JulesFrancoise/)

docs/api/data-stores.md

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -23,19 +23,15 @@ The `location` argument can either be:
2323
- `'localStorage'`: in this case the data is stored using the browser's web storage. It will persist after page refresh, but there is a limitation on the quantity of data that can be stored.
2424
- a URL indicating the location of the server. The server needs to be programmed with Feathers, as described [below](#generating-a-server-application).
2525

26-
### .authenticate()
26+
### .connect()
2727

2828
```tsx
29-
async authenticate(): Promise<User>
29+
async connect(): Promise<User>
3030
```
3131

32-
### .createService()
32+
Connect to the data store backend. If using a remote backend, the server must be running, otherwise an exception will be thrown. If the backend is configured with user authentication, this method will require the user to log in.
3333

34-
```tsx
35-
createService: (name: string): void;
36-
```
37-
38-
Create a new service with the given `name`. If a service with the same name already exist, it will not be replaced. Note that the name of the service determines the name of the collection in the data store. It is important to choose name to avoid potential conflicts between collections.
34+
This method is automatically called by dependent modules such as datasets and models.
3935

4036
### .login()
4137

@@ -55,7 +51,9 @@ async logout(): Promise<void>
5551
service(name: string): Service<unknown>
5652
```
5753

58-
Get the Feathers Service instance, which API is documented on [Feathers' wesite](https://docs.feathersjs.com/api/services.html#service-methods). The interface exposes `find`, `get`, `create`, `update`, `patch` and `remove` methods for manipulating the data.
54+
Get the Feathers service instance with the given `name`. If the service does not exist yet, it will be automatically created. Note that the name of the service determines the name of the collection in the data store. It is important to choose name to avoid potential conflicts between collections.
55+
56+
The method returnsa Feathers Service instance, which API is documented on [Feathers' wesite](https://docs.feathersjs.com/api/services.html#service-methods). The interface exposes `find`, `get`, `create`, `update`, `patch` and `remove` methods for manipulating the data.
5957

6058
### .signup()
6159

docs/api/interfaces.md

Lines changed: 75 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -18,43 +18,42 @@ The following factory function creates and returns an empty Dashboard Applicatio
1818
marcelle.dashboard({
1919
title: string;
2020
author: string;
21-
datasets: Dataset[];
21+
closable?: boolean;
2222
}): Dashboard
2323
```
2424

2525
#### Parameters
2626

27-
| Parameter | Type | Description | Required |
28-
| --------- | ---------------- | --------------------------------------- | :------: |
29-
| title | String | The application's title. | |
30-
| author | String | The application's authors/credits. | |
31-
| datasets | Array\<Dataset\> | The datasets present in the application | |
27+
| Parameter | Type | Description | Required | Default |
28+
| --------- | ------- | ------------------------------------------------------------------------------------------------------------------------------------------- | :------: | :-----: |
29+
| title | String | The application's title. | | |
30+
| author | String | The application's authors/credits. | | |
31+
| closable | boolean | Whether the dashboard can be closed. This flag adds a close button to the menu bar, and is useful when the dashboard is displayed on demand | | false |
32+
33+
#### Streams
34+
35+
### Streams
36+
37+
| Name | Type | Description | Hold |
38+
| -------- | ------- | ------------------------------------------------------------------ | :--: |
39+
| \$active | boolean | Stream specifying whether the dashboard is active (visible) or not ||
40+
| \$page | string | Stream indicating the current page slug ||
3241

3342
#### Example
3443

3544
```js
36-
const dashboard = marcelle.dashboard({
45+
const dash = dashboard({
3746
title: 'Marcelle Example - Dashboard',
3847
author: 'Marcelle Pirates Crew',
39-
datasets: [trainingSet],
4048
});
4149

42-
dashboard
50+
dash
4351
.page('Data Management')
4452
.useLeft(input, featureExtractor)
4553
.use([label, capture], trainingSetBrowser);
46-
dashboard
47-
.page('Training')
48-
.use(
49-
b,
50-
'KNN (k-Nearest Neighbors)',
51-
paramsKNN,
52-
progressKNN,
53-
'MLP (Multilayer Perceptron)',
54-
paramsMLP,
55-
progressMLP,
56-
plotTrainingMLP,
57-
);
54+
dash.page('Training').use(params, b, prog, plotTraining);
55+
dash.page('Batch Prediction').use(predictButton, confusionMatrix);
56+
dash.settings.dataStores(store).datasets(trainingSet).models(classifier).predictions(batchMLP);
5857
```
5958

6059
#### .destroy()
@@ -73,6 +72,14 @@ Dashboard.page(name: string): DashboardPage
7372

7473
Create a new page on the dashboard entitled `name`, and returns the corresponding [`DashboardPage`](#dashboardpage) instance.
7574

75+
#### .settings
76+
77+
```tsx
78+
Dashboard.settings: DashboardSettings
79+
```
80+
81+
The dashboard's settings. See [`DashboardSettings`](#dashboardsettings).
82+
7683
#### .start()
7784

7885
```tsx
@@ -108,6 +115,53 @@ useLeft(...modules: Module[]): DashboardPage {
108115

109116
The `useLeft` method is similar to use except that modules are placed on the left column of the dashboard page. The method only accept modules as argument.
110117

118+
### DashboardSettings
119+
120+
Specifies the contents of the dashboards settings panel.
121+
122+
#### .datasets()
123+
124+
```tsx
125+
datasets(...datasets: Dataset[]): DashboardSettings
126+
```
127+
128+
Specify the datasets that can be managed in the settings panel.
129+
130+
#### .dataStores()
131+
132+
```tsx
133+
dataStores(...stores: DataStore[]): DashboardSettings
134+
```
135+
136+
Specify the data stores that can be managed in the settings panel.
137+
138+
#### .models()
139+
140+
```tsx
141+
models(...models: Model<any, any>[]): DashboardSettings
142+
```
143+
144+
Specify the models that can be managed in the settings panel.
145+
#### .predictions()
146+
147+
```tsx
148+
predictions(...predictions: BatchPrediction[]): DashboardSettings
149+
```
150+
151+
Specify the batch prediction modules that can be managed in the settings panel.
152+
153+
#### .use()
154+
155+
```tsx
156+
use(...modules: Array<Module | Module[] | string>): DashboardSettings
157+
```
158+
159+
The `use` method takes an arbitrary number of arguments specifying the modules to display on the page. By default, modules are stacked vertically in the right column of the page. Each argument can either be:
160+
161+
- A module ([`Module`](/api/modules/)), displayed full-width on the right column
162+
- An array of module, which are then distributed horizontally
163+
- A string, which defines a section title
164+
111165
## Wizards
112166

113167
Wizards are dedicated to the creation of step-by-step guides for beginners or end-users. Wizards are inspired by Teachable machine's [_training wizard_ demo](https://glitch.com/~tm-wizard) that walks users through training their machine learning model. Marcelle wizards are more flexible and allow developers to specify what modules should be displayed at every step. Therefore, wizards can be used to assist the training but could also guide users in the analysis of the model's result.

docs/api/modules/README.md

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,13 @@ sidebarDepth: 2
66

77
Modules are the building blocks of a Marcelle application and handle various tasks such as capturing images from a webcam, defining a new dataset, instancing a Deep Neural Network (DNN), displaying a confusion matrix, or monitoring the confidence of a model prediction, to name a few. Because Marcelle emphasizes instant feedback and user interaction, modules often provide a graphical user interface that can be displayed on demand in a web application.
88

9-
The specification of modules is somehow loose in the library, to allow for easy customization and extension. A module is essentially a JavaScript object exposing a set of reactive streams and providing a `mount` method for displaying their associated view. All modules have string properties called `name` and `description`. The `name` is used as title for the cards displayed in a dashboard. Each module instance also carries a unique `id`.
9+
The specification of modules is somehow loose in the library, to allow for easy customization and extension. A module is essentially a JavaScript object exposing a set of reactive streams and providing a `mount` method for displaying their associated view. All modules have a string property called `title` used as title for the cards displayed in a dashboard. Each module instance also carries a unique `id`.
1010

1111
The minimal TypeScript interface corresponding to a module is as follows:
1212

1313
```ts
1414
interface Module {
15-
name: string; // module name
16-
description: string; // module description
15+
title: string; // module name
1716
id: string; // module id (unique per instance)
1817
mount(targetSelector?: string): void; // mount the module's view in the DOM
1918
destroy(): void; // destroy the module's view
@@ -37,10 +36,10 @@ mlp.$training;
3736
## Views
3837

3938
```tsx
40-
Module.mount(targetSelector?: string): void;
39+
Module.mount(target?: HTMLElement): void;
4140
```
4241

43-
Modules should implement a `mount` method that displays the view assotiated with the module instance. The method takes as argument a CSS selector specifying the target element where the view should be mounted. If no selector is passed, the module will attempt mounting the module on the DOM element which id is the `id` of the module.
42+
Modules should implement a `mount` method that displays the view assotiated with the module instance. The method takes as optional argument the target HTML element where the view should be mounted. If no target is passed, the module will attempt mounting the module on the DOM element which id is the `id` of the module.
4443

4544
Marcelle does not enforce the use of a particular web framework for programming views, however it uses [Svelte](https://svelte.dev/) internally, for its performance and its native compatibility with reactive data streams.
4645

0 commit comments

Comments
 (0)