Skip to content

Commit

Permalink
refactor: decouple rendering (#57)
Browse files Browse the repository at this point in the history
* refactor: remove set project dir

* refactor: move db to lib (#29)

* refactor: adds a project file structure class

* refactor: remove st and state dependency from connections db

* refactor: unifies db queries for state population

* refactor: move tag count to lit

* refactor: moves metrics loading and its deps to lib (#36)

* refactor: dataframe validation and decoupling outliers computation

* refactor: adds lost changes due to merge conflicts

* refactor: decouple img utils

* refactor: metric explorer (#40)

* refactor: restructure metrics explorer statistics components

* moves pagination to a separate component

* moves get_histogram to a lib

* avoid using string enum value for embedding type

* split and decouple similarities and embeddings from explorer

* Refactor/decouple model quality pages (#46)

* chore: Add local ci-tests script to gitignore.

* refactor(model-quality): move data logic to lib

	-  move data.py an map_mar.py from app to lib
	- add pandera schemas
	- refactor data frame merging for reuse
 	- use session state setdefault for caching prediction data
 	- Type inputs to map_mar computations
	- schemas for model data frames
	- refactor grid view
	- redefine prediction scope
	- metric charts
	- move charts to lib

* refactor: export utils (#43)

* refactor: export actions utils

* refactor: dataset balancing

* refactor: move cli helper to lib

* Chore/gitignore (#45)

chore: Add local ci-tests script to gitignore.

* refactor: lib restructure (#47)

* refactor: move metric from common to metrics

* refactor: dataset balance module

* refactor: adds sandbox projects module

* moves project stuff to project dir

* rename type definitions back to metric

* rename metrics files

* rename embedding files

* rename encord project to utils

* encrod action utils

* moves common embeddings to utils

* reorganize writers

* moves tester to execute

* model predictions reader

* model predictions filters

* fix isort and black

* fix mypy errors

* fix(imports): broken imports after refactor

* fix: remove print

* fix: wrong dir in project fetch meta

* refactor: consolidated state and bugfixes (#56)

* refactor: consolidate state

* state cleanup and state mutator

* adds a lazy state initialization and some more cleanup

* refactor: organize state files

* removes global state const

* remove generic multiselect

* remove mutliselect

* more cleanup of predictions state

* fix multiselect values

* completely gets rid of predictions state

* Fix: convert imported polygon points to absolute values (#52)

fix: unnormalize polygon points

* adds db module

* fix missing similarities missing imports

* fix: double annotator stats title (#55)

fix: remove duplicate title

Co-authored-by: Gorkem Polat <[email protected]>
Co-authored-by: Frederik Hvilshøj <[email protected]>

* fix: linting error

* delete test file

Co-authored-by: Frederik Hvilshøj <[email protected]>
Co-authored-by: Frederik Hvilshøj <[email protected]>
Co-authored-by: Gorkem Polat <[email protected]>
  • Loading branch information
4 people authored Jan 4, 2023
1 parent 36f3418 commit 2507f54
Show file tree
Hide file tree
Showing 121 changed files with 3,752 additions and 3,154 deletions.
6 changes: 2 additions & 4 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -339,7 +339,7 @@ Sessionx.vim
# Temporary
.netrwhist
# Auto-generated tag files
tags
# tags
# Persistent undo
[._]*.un~

Expand All @@ -348,9 +348,7 @@ tags

.idea

/viewer/outputs/
/outputs/
/viewer/pages/outputs/
/local_tests/

imports.prof
ci-tests
4 changes: 2 additions & 2 deletions docs/builders/build_metrics_pages.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@

from tabulate import tabulate

import encord_active.lib.common.metric as metrics
import encord_active.lib.metrics.run_all as run_all
import encord_active.lib.metrics.execute as run_all
import encord_active.lib.metrics.metric as metrics

github_url = "https://github.com/encord-team/encord-active"
descriptions = {
Expand Down
6 changes: 3 additions & 3 deletions docs/docs/metrics/write-your-own.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ Your implementation should call `writer.write(<object_score>, <object>)` for eve

```python
from encord_active.lib.common.iterator import Iterator
from encord_active.lib.common.metric import AnnotationType, DataType, MetricType, Metric
from encord_active.lib.common.writer import CSVMetricWriter
from encord_active.lib.metrics.metric import AnnotationType, DataType, MetricType, Metric
from encord_active.lib.metrics.writer import CSVMetricWriter

class ExampleMetric(Metric):
TITLE = "Example Title"
Expand Down Expand Up @@ -63,7 +63,7 @@ class ExampleMetric(Metric):
if __name__ == "__main__":
import sys
from pathlib import Path
from encord_active.lib.common.tester import perform_test
from encord_active.lib.metric.execute import perform_test

path = sys.argv[1]
perform_test(ExampleMetric(), data_dir=Path(path))
Expand Down
16 changes: 8 additions & 8 deletions docs/docs/sdk/importing-model-predictions.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ That is:
- `h`: box pixel height / image height

```python
from encord_active.app.db.predictions import BoundingBox, Prediction, Format
from encord_active.lib.db.predictions import BoundingBox, Prediction, Format

prediction = Prediction(
data_hash = "<your_data_hash>",
Expand Down Expand Up @@ -112,7 +112,7 @@ BoundingBox(x=10/img_w, y=25/img_h, w=200/img_w, h=150/img_h)
You specify masks as binary `numpy` arrays of size [height, width] and with `dtype` `np.uint8`.

```python
from encord_active.app.db.predictions import Prediction, Format
from encord_active.lib.db.predictions import Prediction, Format

prediction = Prediction(
data_hash = "<your_data_hash>",
Expand All @@ -136,7 +136,7 @@ That is, an array of relative (`x`, `y`) coordinates:
- `y`: relative y-coordinate of each point of the polygon (pixel coordinate / image height)

```python
from encord_active.app.db.predictions import Prediction, Format
from encord_active.lib.db.predictions import Prediction, Format
import numpy as np

polygon = np.array([
Expand Down Expand Up @@ -182,7 +182,7 @@ You can copy the appropriate snippet based on your prediction format from above
Note the highlighted line, which defines where the `.pkl` file will be stored.

```python showLineNumbers
from encord_active.app.db.predictions import Prediction, Format
from encord_active.lib.db.predictions import Prediction, Format

predictions_to_store = []

Expand Down Expand Up @@ -224,7 +224,7 @@ The code would change to something similar to this:

```python
# highlight-next-line
from encord_active.lib.model_predictions.prediction_writer import PredictionWriter
from encord_active.lib.model_predictions.writer import PredictionWriter

def predict(test_loader):
# highlight-next-line
Expand Down Expand Up @@ -367,7 +367,7 @@ To import the predictions, you do the following
import json

from encord_active.lib.model_predictions.importers import import_KITTI_labels
from encord_active.lib.model_predictions.prediction_writer import PredictionWriter
from encord_active.lib.model_predictions.writer import PredictionWriter

# highlight-next-line
predictions_root = Path("/path/to/your/predictions")
Expand Down Expand Up @@ -416,7 +416,7 @@ You can use this template where the highlighted lined are what you need to chang

```python
from encord_active.lib.model_predictions.importers import import_mask_predictions
from encord_active.lib.model_predictions.prediction_writer import PredictionWriter
from encord_active.lib.model_predictions.writer import PredictionWriter

# highlight-start
class_map = {
Expand Down Expand Up @@ -470,7 +470,7 @@ For this, you can use these lines of code:

```python
from encord_active.lib.model_predictions.iterator import PredictionIterator
from encord_active.lib.metrics.run_all import run_metrics
from encord_active.lib.metrics.execute import run_metrics

run_metrics(data_dir=data_dir, iterator_cls=PredictionIterator)
```
Expand Down
8 changes: 4 additions & 4 deletions docs/docs/workflows/import-predictions.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ That is:
- `h`: box pixel height / image height

```python
from encord_active.app.db.predictions import BoundingBox, Prediction, Format
from encord_active.lib.db.predictions import BoundingBox, Prediction, Format

prediction = Prediction(
data_hash = "<your_data_hash>",
Expand Down Expand Up @@ -158,7 +158,7 @@ BoundingBox(x=10/img_w, y=25/img_h, w=200/img_w, h=150/img_h)
You specify masks as binary `numpy` arrays of size [height, width] and with `dtype` `np.uint8`.

```python
from encord_active.app.db.predictions import Prediction, Format
from encord_active.lib.db.predictions import Prediction, Format

prediction = Prediction(
data_hash = "<your_data_hash>",
Expand All @@ -182,7 +182,7 @@ That is, an array of relative (`x`, `y`) coordinates:
- `y`: relative y-coordinate of each point of the polygon (pixel coordinate / image height)

```python
from encord_active.app.db.predictions import Prediction, Format
from encord_active.lib.db.predictions import Prediction, Format
import numpy as np

polygon = np.array([
Expand Down Expand Up @@ -228,7 +228,7 @@ You can copy the appropriate snippet based on your prediction format from above
Note the highlighted line, which defines where the `.pkl` file will be stored.

```python showLineNumbers
from encord_active.app.db.predictions import Prediction, Format
from encord_active.lib.db.predictions import Prediction, Format

predictions_to_store = []

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -504,8 +504,8 @@
"import numpy as np\n",
"from encord_active.lib.common import utils\n",
"from encord_active.lib.common.iterator import Iterator\n",
"from encord_active.lib.common.metric import AnnotationType, DataType, Metric, MetricType\n",
"from encord_active.lib.common.writer import CSVMetricWriter\n",
"from encord_active.lib.metrics.metric import AnnotationType, DataType, Metric, MetricType\n",
"from encord_active.lib.metrics.writer import CSVMetricWriter\n",
"from loguru import logger\n",
"\n",
"logger = logger.opt(colors=True)\n",
Expand Down Expand Up @@ -563,7 +563,7 @@
" import sys\n",
" from pathlib import Path\n",
"\n",
" from encord_active.lib.common.tester import perform_test\n",
" from encord_active.lib.metric.execute import perform_test\n",
"\n",
" path = sys.argv[1]\n",
" perform_test(InstanceDeviation(), data_dir=Path(path), use_cache_only=True)"
Expand Down Expand Up @@ -717,4 +717,4 @@
]
}
]
}
}
56 changes: 53 additions & 3 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ toml = "^0.10.2"
pydantic = "^1.10.2"
pycocotools = {version = "^2.0.6", optional = true}
psutil = "^5.9.4"
pandera = "^0.13.4"


[tool.poetry.extras]
Expand Down
Loading

0 comments on commit 2507f54

Please sign in to comment.