Skip to content

Instantly share code, notes, and snippets.

View frederik-encord's full-sized avatar

Frederik Hvilshøj frederik-encord

View GitHub Profile
"""
This file demonstrates how to
1. Download a project with DICOM series from Encord Annotate
2. Extract masks based on all the polygons and bounding boxes in the project
The only dependency is `encord-active`.
_Installation:_
"""
This script will add tags in Encord Active based on nested radio attributes.
If an object has no nested attributes, it will be tagged with "no classification".
To run the script, make sure to have your encord active environment sourced and
then do:
```shell
(ea-venv)$ python tag_with_radio_classifications.py "/path/to/your/encord-active/project"
```
from pathlib import Path
import numpy as np
from encord_active.lib.labels.label_transformer import (
BoundingBox,
BoundingBoxLabel,
DataLabel,
LabelTransformer,
PolygonLabel,
)
from time import perf_counter
import cv2
import matplotlib.pyplot as plt
import numpy as np
import torch
from kornia.utils import draw_convex_polygon
from torch import Tensor
import sys
from datetime import datetime
from enum import Enum
from functools import partial
from pathlib import Path
from typing import Any, Callable, NamedTuple, Optional, TypeVar
from uuid import UUID
import orjson
import typer
"""
If you have tagged your data (with data tags), this script can help you
converting the tags into Radio Button Classifications.
Prerequisites:
1. You need to be an admin of both the project and the ontology associated
with the project.
2. You need to have `encord-active` installed and working in your shell.
"""
If you have tagged your data (with data tags), this script can help you
converting the tags into Radio Button Classifications.
Prerequisites:
1. You need to be an admin of both the project and the ontology associated
with the project.
2. You need to have `encord-active` installed and working in your shell.
import csv
import re
import sys
from pathlib import Path
from uuid import UUID, uuid4
import typer
from encord_active.db.models import (
Project,
ProjectDataUnitMetadata,
"""
Works for encord active version 0.1.78.
The script will take all (nested) radio button and checklist annotations and
transform them into tags. For example if you have an ontology like
- animal [radio button]
- ( ) dog
- properties [checklist]
- [ ] cute
"""
If you have tagged your data (with data tags), this script can help you
converting the tags into checklist classifications.
Prerequisites:
1. You need to be an admin of the Encord Annotate project.
2. You need to have `encord-active==0.1.78` installed and working in your shell.
Installation: