Skip to content

Commit

Permalink
Kill Streamlit 🔪 (#563)
Browse files Browse the repository at this point in the history
* Start

* Model definition, testing db creation

* New API

* SQL queries

* Initial migration script

* Partially working metric migration script

* Add partial embedding support to global db storage.

* Extra search terms

* Database migrations support.

* Bug fixes

* Fixes from testing

* Misc

* Migrate tags

* Start of new api endpoint.

* Work on storing predictions and more data quality assertions in migration script.

* Process predictions into db, main metadata.

* Add some constraints to the database

* Cleanup of metric definitions

* Improve queries

* Bugfixes

* Bugfixes

* Minor prediction changes.

* Calculate prediction matches

* More prediction calculation support.

* Start of prediction metrics support.

* Add metric correlations support.

* Rename & unify object, classification.

* Mutual info regression, WIP

* Embedding search & more prediction support

* Split new router into 3.

* Fix all linting.

* Post-rebase regen poetry lock

* Fix some bugs with predictions from rebase & others

* Bug fixes and start of prediction explorer implementation.

* poetry lock fix post rebase

* Support metric dissimilarity.

* Move db migration script out as it is is needed to execute dynamically for mixed mode.

* wip - extra formatting improvements and start of extra backend apis needed.

* Rework stages

* Re-validate predictions, now fully correct handling of FP/FN/TP split.

* Optimize metric performance query.

* Summary query filter support, part 1.

* Summary query filter support, part 2.

* Summary query filter support, part 3. Prediction implementation is partial and broken for the filtered use-case.

* Bug fixes for GET filter query parameters.

* Change some defaults.

* wip: project2 actions

* Re-enable reduced embedding extension storage

* Improve queries

* feat: introduce new frontend

feat: init new frontend

feat: convert the project selection page to req res

feat: render old react explorer instead of search

feat: adds the project selection menu

delete uneeded file

remove node modules

* feat: adds project selector to the top right

* fix: scoped queries unique keys

* Backend implementation of synced create subset & upload project actions.

Missing attempt at front-end implementation.

* Update FE & Fix communication issues with legacy codebase from update. Almost working subset action, need filters to properly test.

* Add upload to encord action, still have df issues with subset creation.

* Pandas bug-fixes

* feat: introduce filters UI

feat: enable data filters

chore: add proper types for the filters send to BE

refactor: unite data and annotations explorer

refactor: adds new filters to the predictions page

chore: post rebase fixes

feat: adds tags filter

feat: adds prediction type select

* fix: project selection page

* fix: remove log

* fix: project card show image

* fix: add project hash to query keys

* Post rebase frontend updates & misc fixes. Partially fix migration script.

* Update migration script to work on new formatting changes for certain metrics.

* feat: auth on new FE

* feat: alembic migration versions.

* Tag sync, alembic debugging, & re-enable proper project migration behaviour.

* fix: id splitting in migration

* fixdxdsxFix db unique constraint & label row hash uniqueness for local subset creation.

* wip: serve FE build assets on server & migrate on startup.

* WIP: adds download sandbox and disables it

* fix: query invalidation & improved local fs serve logic.

* fix: proper subset creation logic.

* fix: disable upload to encord when filters applied

* upload project & create subset: misc improvements / fixes.

* WIP: fe cleanup

* fix: predictions explorer set selected project

* fix: display raw images for non-sandbox projects.

* wip - feat: filter impl improvement & first attempt at label class filter support.

* fix: use relative url only when built.

* fix: null api context edge case (rare)

* fix: build errors & upload to encord file path.

* fix: bring back startup

* fix: filter data by label class

* fix fe: style & misc bugs

* fix: encord upload, invalidate caches before reading updated data.

* chore: rename visualize to start

* chore: change default port to 8000

* fix: partially working encord-active upload, issue with local data uri only.

* fix: remove scroll jitter while explorer is loading.

* feat: favicon.ico

* fix: debounce filters for perf.

* chore: dev mode

* fix: prefer relative uri - fixes upload to encord & remote subset.

* chore: delete app folder

* chore: replace encord-active-components with new implementation

* chore: kill streamlit

* fix: misc db schema fixes, more correct metric normalisation & misc bugfixes.

* WIP: fix lintting

* fix: all mypy + other lint issues.

* fix: ea-components dev mode & error on missing components on non-dev mode.

* fix: project level statistics & ttl cache

* fix: black and isort

* fix: project description accessor

* fix: prediction migration bug.

* fix: project comparison project selection

* fix: classification predictions

* fix: misc style fixes

* fix: misc styling & logging on migration

* fix: ok style for modals

* fix: prediction metrics design & buckets

* fix: prediction selection improvements & rename comparison domain to scope.

* fix: hide prediction selector while only 1 prediction is present.

* fix: upload to encord error boundaries and state updates.

* fix: project name and folder missmatch

* fix: ts error

* fix: tagging query invalidation keys

* FE-side fix: generate feature hash mapping for recursive attributes.

* fix: FE quartile line overlay & naming of similarity.

* fix: bounding box prediction

* fix: old predictions folder structure

* wip-fix: classification prediction handling.

* fix: style project comparison.

* fix: implement legacy classification hash handling.

* fix: minor fe tweaks

* fix: better scaling for large prediction v-bars

* fix: react key errors

* fix: duplicate metrics on predictions page

* delete sreamlit file

* fix: subset migration version and reduced embeddings

* fix: hide metric_random, handle classification annotation_quality, do not move the folder when uploading a project to encord.

* fix: antd styles

* fix: slider values precision

* fix: subsetting with embeddings plot

* fix: hide distribution bar chart by default in metric predictions.

* fix: blur filter support (negative values).

* partial fix for classification prediction project handling.

* minor fix: use triple eq in blur workaroud

* fix: add fallback for color generation.

* fix: lint and formatting

* fix: don't show label information on data metrics

* fix: almost fix all classification prediction issues.

* fix: final classification prediction  bug.

* fix: exclude unnecessary files from FE component build.

* feat: publish new encord-active-components.

---------

Co-authored-by: James Clifton <james@encord.com>
  • Loading branch information
Encord-davids and james-encord authored Jul 31, 2023
1 parent 67590fd commit 89bd8e5
Show file tree
Hide file tree
Showing 190 changed files with 12,313 additions and 8,413 deletions.
6 changes: 0 additions & 6 deletions .env

This file was deleted.

4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -352,3 +352,7 @@ Sessionx.vim

imports.prof
ci-tests


# Encord active sqlite database instance.
encord-active.sqlite
3 changes: 1 addition & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,7 @@ RUN prisma generate --schema=./src/encord_active/lib/db/schema.prisma
WORKDIR /data

RUN git config --global --add safe.directory '*'
EXPOSE 8501
EXPOSE 8502
EXPOSE 8000

HEALTHCHECK CMD ecord-active --version
ENTRYPOINT ["encord-active"]
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ The download command will ask which pre-built dataset to use and will download i
```shell
encord-active download
cd /path/of/downloaded/project
encord-active visualize
encord-active start
```

The app should then open in the browser.
Expand All @@ -124,11 +124,11 @@ encord-active init /path/to/data/directory

A project will be created using the data in the directory.

To visualize the project run:
To start the project run:

```shell
cd /path/to/project
encord-active visualize
encord-active start
```

You can find more details on the `init` command in the [documentation][encord-active-docs-init].
Expand Down
6 changes: 3 additions & 3 deletions docs/docs/cli.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ download Download a sandbox dataset to get started 📁
init Initialize a project from your local file system 🌱
import Import projects or predictions ⬇️
refresh Sync data and labels from a remote Encord project 🔄
visualize Launch the application with the provided project ✨
start Launch the application with the provided project ✨
project Manage project settings ⚙️
metric Manage project metrics 📋
print Print useful information 🖨️
Expand Down Expand Up @@ -132,15 +132,15 @@ Sample pictures:

</details>

## `visualize`
## `start`

Launch the application with the provided project ✨

```
Usage: encord-active quickstart [OPTIONS]
Options:
--target -t DIRECTORY Path of the projects you would like to visualize
--target -t DIRECTORY Path of the projects you would like to start
```

## `init`
Expand Down
8 changes: 3 additions & 5 deletions docs/docs/faq.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ You can refer to the [workflow description][import-predictions] for importing mo
For larger projects, initialization can take a while.
While we're working on improving the efficiency, there are a couple of tricks that you can do.

1. As soon as the metric computations have started (indicated by Encord Active printing a line containing `Running metric`) you can open a new terminal and run `encord-active visualize`.
1. As soon as the metric computations have started (indicated by Encord Active printing a line containing `Running metric`) you can open a new terminal and run `encord-active start`.
This will allow you to continuously see what have been computed so far.
Refresh the browser once in a while when new metrics are done computing in your first terminal.

Expand All @@ -89,12 +89,9 @@ Please see this [notebook](https://colab.research.google.com/github/encord-team/

You can.

The code base is structured such that all data operations live in [`encord_active.lib`][ea-lib] which serves as the "backend" for the UI.
The code base is structured such that all data operations live in [`encord_active.lib`][ea-lib] and [`encord_active.lib`][ea-lib] which serves as the "backend" for the UI.
As such, everything you can do with the UI can also be done by code.

The UI/frontend is built in [streamlit](https://streamlit.io/) which is a python based frontend library.
Therefore, you can find many good examples in the [`encord_active.app`][ea-app] code for how to operate with the project data via python.

Other good resources can be found in our [example notebooks][ea-examples].

---
Expand Down Expand Up @@ -202,6 +199,7 @@ Your feedback and bug reports help us improve Encord Active for everyone.
[ea-examples]: https://github.com/encord-team/encord-active/tree/main/examples
[ea-intro-blogpost]: https://encord.com/blog/closing-the-ai-production-gap-encord-active-a-new/
[ea-lib]: https://github.com/encord-team/encord-active/tree/main/src/encord_active/lib
[ea-server]: https://github.com/encord-team/encord-active/tree/main/src/encord_active/server
[filter-guide]: ./user-guide/filtering
[export-guide]: ./user-guide/exporting
[active-learning]: ./active-learning
Expand Down
21 changes: 10 additions & 11 deletions docs/docs/getting-started.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
sidebar_position: 2
---

import Tabs from '@theme/Tabs';
import TabItem from '@theme/TabItem';
import Link from '@docusaurus/Link';
import Tabs from "@theme/Tabs";
import TabItem from "@theme/TabItem";
import Link from "@docusaurus/Link";

# Getting Started

Expand Down Expand Up @@ -45,7 +45,7 @@ If you encounter any difficulties during the installation of encord-active, you
You can also run the docker image instead of install Encord Active

```shell
docker run -it -p 8501:8501 -p 8502:8502 -v ${PWD}:/data encord/encord-active <command>
docker run -it -p 8000:8000 -v ${PWD}:/data encord/encord-active <command>
```

:::
Expand Down Expand Up @@ -102,11 +102,11 @@ encord-active init /path/to/data/directory

A project will be created using the data (without labels) in the current working directory (unless used with `--target`).

To visualize the project run:
To start the project run:

```shell
cd /path/to/project
encord-active visualize
encord-active start
```

You can find more details on the `init` command in the [CLI section](./cli#init).
Expand Down Expand Up @@ -145,7 +145,7 @@ Next, `encord-active` will fetch your data and labels before computing all the [
Downloading the data and computing the metrics may take a while.
Bare with us, it is worth the wait.

When the process is done, follow the printed instructions to open the app or see more details in the [Open Encord Active](./cli#visualize) page.
When the process is done, follow the printed instructions to open the app or see more details in the [Open Encord Active](./cli#start) page.

## Running the App

Expand All @@ -154,7 +154,7 @@ To launch the Encord Active app, run the following command:
```shell
# within venv
cd /path/to/project
encord-active visualize
encord-active start
```

Now, your browser should open a new window with Encord Active.
Expand All @@ -180,12 +180,11 @@ You can also have a look at how to [write custom metrics](./metrics/write-your-o

Please don't hesitate to contact us if you have any questions via our dedicated [Discord server][join-discord] or email at [active@encord.com][ea-email].

If you encounter any errors, we would love to hear from you so we can address them promptly.
If you encounter any errors, we would love to hear from you so we can address them promptly.
We receive immediate notifications when issues are submitted through Encord Active's [GitHub][repo-issues] repository.
Also, feel free to reach out to us via [Discord][join-discord] or email at [active@encord.com][ea-email] for further assistance.
Also, feel free to reach out to us via [Discord][join-discord] or email at [active@encord.com][ea-email] for further assistance.
We appreciate your feedback and assistance in improving Encord Active.


[colab-download-sandbox-project]: https://colab.research.google.com/drive/1RujTUxcxpB9bGJHp_UtCdSSQn7oef2ci?usp=sharing
[colab-import-your-own-project]: https://colab.research.google.com/drive/1P4C-JAml8yh8aUa_rvNPI_hPBvBgZ1FD?usp=sharing
[ea-email]: mailto:active@encord.com
Expand Down
2 changes: 1 addition & 1 deletion docs/docs/import/import-coco-project.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ to tell Encord Active to use symlinks instead of copying files. But be aware tha

The whole flow might take a while depending on the size of the original dataset.

When the process is done, follow the printed instructions to launch the app with the [visualize](../cli#visualize) command.
When the process is done, follow the printed instructions to launch the app with the [start](../cli#start) command.

:::info

Expand Down
2 changes: 1 addition & 1 deletion docs/docs/import/import-encord-project.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ Alternatively, if you prefer to override the selection process, you can use the

You will get a directory containing all the data, labels, and [metrics](/category/quality-metrics) of the project. You have the option to choose whether to store the data in the local file system and can opt-in or opt-out accordingly.

When the process is done, follow the printed instructions to open the app or see more details in the [visualize](../cli#visualize) CLI command.
When the process is done, follow the printed instructions to open the app or see more details in the [start](../cli#start) CLI command.

If you are importing an Encord Annotate project for the first time, the Command Line Interface (CLI) will prompt you to provide the local path of a private SSH key associated with Encord.
To associate an SSH key with Encord, please refer to the documentation available [here][encord-docs-ssh].
Expand Down
13 changes: 6 additions & 7 deletions docs/docs/installation.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@
sidebar_position: 3
---

import Tabs from '@theme/Tabs';
import TabItem from '@theme/TabItem';
import Link from '@docusaurus/Link';
import Tabs from "@theme/Tabs";
import TabItem from "@theme/TabItem";
import Link from "@docusaurus/Link";

# Installation

Expand Down Expand Up @@ -63,15 +63,15 @@ $ encord-active --version

This must be run in the same virtual environment where you installed the package.

The `--help` option provides some context to what you can do with `encord-active`.
The `--help` option provides some context to what you can do with `encord-active`.
If you'd like to explore the available commands in the Command Line Interface (CLI), you can refer to the [CLI section](./cli) for more detailed information.

## Docker

We also provide a docker image that works exactly as the CLI.

```shell
docker run -it --rm -p 8501:8501 -p 8502:8502 -v ${PWD}:/data encord/encord-active <command>
docker run -it --rm -p 8000:8000 -v ${PWD}:/data encord/encord-active <command>
```

Running the previous command will mount your current working directory, so everything that happens inside the docker container will persist after it is done.
Expand All @@ -81,12 +81,11 @@ Running the previous command will mount your current working directory, so every
If you intend to use Encord Active with an Encord Annotate project you'll need to mount a volume with your SSH key as well.

```shell
docker run -it --rm -p 8501:8501 -p 8502:8502 -v ${PWD}:/data -v ${HOME}/.ssh:/root/.ssh encord/encord-active
docker run -it --rm -p 8000:8000 -v ${PWD}:/data -v ${HOME}/.ssh:/root/.ssh encord/encord-active
```

Then, when asked for your SSH key, you can point to `~/.ssh/<your-key-file>`


[git-download]: https://git-scm.com/download
[latest-python-3.9-brew]: https://formulae.brew.sh/formula/python@3.9
[latest-python-3.9-minor-version]: https://www.python.org/downloads/release/python-3917/
Expand Down
2 changes: 1 addition & 1 deletion docs/docs/metrics/write-your-own.md
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ When you have run your metric, you can visualize your results by running:

```shell
# within venv
encord-active visualize
encord-active start
```

Now, you can improve your data/labels/model by choosing your own custom metric in the app.
4 changes: 2 additions & 2 deletions docs/docs/sdk/initialize-a-project.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ If you prefer using the CLI, you can refer to the [Quick import data & labels][q
After completing these steps, you can launch the application by using the following CLI command and access the project:

```shell
encord-active visualize -t "path/to/where/you/store/projects"
encord-active start -t "path/to/where/you/store/projects"
```

## Steps to initialize a project with labels
Expand Down Expand Up @@ -184,7 +184,7 @@ To include labels, you need to provide the transformer object and the correspond
After completing these steps, you can launch the application by using the following CLI command and access the project:

```shell
encord-active visualize -t "path/to/where/you/store/projects"
encord-active start -t "path/to/where/you/store/projects"
```

[gh-bbox-transformer]: https://github.com/encord-team/encord-active/blob/main/examples/label-transformers/bounding-boxes/bbox_transformer.py
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ project_fs.db.unlink(missing_ok=True)
Now, open the encord-active app using the following CLI command in the project or its root folder:

```shell
encord-active visualize
encord-active start
```

Go to Data Quality -> Explorer, and choose Image Diversity from the metric drop down menu. You will see the examples sorted
Expand Down
2 changes: 1 addition & 1 deletion docs/docs/tutorials/touring-the-coco-dataset.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ When the download process is done, `encord-active` will print how to run the app

```shell
cd /path/to/downloaded/project
encord-active visualize
encord-active start
```

:::caution
Expand Down
2 changes: 1 addition & 1 deletion examples/building-a-custom-metric-function.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -570,7 +570,7 @@
"metadata": {},
"outputs": [],
"source": [
"!encord-active visualize -t \"quickstart\""
"!encord-active start -t \"quickstart\""
]
},
{
Expand Down
8 changes: 4 additions & 4 deletions examples/download-sandbox-dataset.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,13 @@
"\n",
"```shell\n",
"encord-active download --project-name \"[project-name]\"\n",
"encord-active visualize -t \"[project-name]\"\n",
"encord-active start -t \"[project-name]\"\n",
"```\n",
"\n",
"For example:\n",
"```shell\n",
"encord-active download --project-name quickstart\n",
"encord-active visualize -t quickstart\n",
"encord-active start -t quickstart\n",
"```\n"
]
},
Expand All @@ -43,7 +43,7 @@
"from pathlib import Path\n",
"\n",
"from encord_active.lib.project.sandbox_projects import available_prebuilt_projects, fetch_prebuilt_project\n",
"from encord_active.cli.utils.streamlit import launch_streamlit_app\n",
"from encord_active.cli.utils.server import launch_app\n",
"\n",
"# List available sandbox projects\n",
"PREBUILT_PROJECT_TO_STORAGE = list(available_prebuilt_projects().keys())\n",
Expand All @@ -60,7 +60,7 @@
"fetch_prebuilt_project(project_name, project_path)\n",
"\n",
"# Open the app\n",
"!encord-active visualize -t \"$project_path\""
"!encord-active start -t \"$project_path\""
]
}
],
Expand Down
2 changes: 1 addition & 1 deletion examples/getting-started-with-coco-project.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@
"metadata": {},
"outputs": [],
"source": [
"!encord-active visualize -t \"[name-of-your-project]\""
"!encord-active start -t \"[name-of-your-project]\""
]
},
{
Expand Down
4 changes: 2 additions & 2 deletions examples/getting-started-with-encord-projects.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
"\n",
"```shell\n",
"encord-active import project\n",
"encord-active visualize -t \"[project-name]\"\n",
"encord-active start -t \"[project-name]\"\n",
"```\n"
]
},
Expand Down Expand Up @@ -166,7 +166,7 @@
"metadata": {},
"outputs": [],
"source": [
"!encord-active visualize -t \"[name-of-your-project]\""
"!encord-active start -t \"[name-of-your-project]\""
]
},
{
Expand Down
2 changes: 1 addition & 1 deletion examples/label-transformers/classification/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ The outcome should be a new project with 28 images of which
Try running

```shell
encord-active visualize
encord-active start
```

to see the results.
2 changes: 0 additions & 2 deletions examples/maskrcnn-example/environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -137,8 +137,6 @@ dependencies:
- shapely==1.8.5.post1
- shortuuid==1.0.11
- smmap==5.0.0
- streamlit==1.13.0
- streamlit-nested-layout==0.1.1
- tenacity==8.1.0
- tensorboardx==2.5.1
- termcolor==2.1.1
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ See documentation: https://docs.encord.com/docs/active-cli#project
3. Open the Encord-Active app.

```shell
(encord-active-environment) > encord-active visualize
(encord-active-environment) > encord-active start
```

4. Go to **Label Quality => Explore**, and choose **Object annotation quality** metric.
Expand Down
4 changes: 2 additions & 2 deletions frontend_components/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ Built with React, Typescript, Vite and Tailwind.
After making changes to the frontend side of things we need to build it.

```shell
cd src/encord_active_components/frontend
cd ./encord_active_components/frontend
npm run build
```

Expand All @@ -17,7 +17,7 @@ When the frontend build is done, it is time to build the package and publish it.
Navigate back to the root directory

```shell
cd ../../../ # or `cd -` (anything that will get you back to root)
cd ../../ # or `cd -` (anything that will get you back to root)
```

Bump the version
Expand Down
Loading

0 comments on commit 89bd8e5

Please sign in to comment.