Skip to content
Branch: master
Find file History
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
..
Failed to load latest commit information.
active-learning
conf
examples
image-object-detection-with-yolo
labels-with-weak-supervision
Dockerfile
README.md
add_users.py
delete_all_assets.py
entrypoint.sh
export_labels.py
get_labeler_stats.py
google_ner_pre_labeling.py
import_assets.py
import_assets_by_chunks.py
import_assets_with_s3.py
import_image.py
import_predictions.py
online_learning_text_classification.py
requirements.txt
set_asset_to_be_labeled_by.py
update_assets_metadata.py
update_interface_settings.py
update_project_instructions.py
update_project_title.py

README.md

Recipes

How to create a project

You can refer to the following documentation.

How to update interface settings

  1. Edit new_interface_settings.json.

  2. Execute:

python update_interface_settings.py

How to massively add users

  1. Edit new_users.yml.

  2. Execute:

python add_users.py

Note: You need to have ADMIN right at Organization level to create users.

How to import assets with metadata

  1. Edit new_assets.yml. Metadata may contain some information about assets. Used for interface category IMAGE_WITH_SEARCH.

  2. Execute:

python import_assets.py

To massively import data:

python import_assets_by_chunks.py

How to update assets metadata

  1. Edit new_assets.yml. Metadata may contain some information about assets. Used for interface category IMAGE_WITH_SEARCH.

  2. Execute:

python update_assets_metadata.py

How to import assets with S3

  1. Edit new_assets_with_s3.yml.

  2. Execute:

python import_assets_with_s3.py

How to import images

  1. Execute:
python import_image.py

How to delete all assets

  1. Execute:
python delete_all_assets.py

How to push pre-annotation to existing assets

  1. Edit new_predictions.yml.

  2. Execute:

python import_predictions.py

How to export and parse labels

  1. Execute:
python export_labels.py

How to do Named-Entity Recognition with Google

Example based on Enron email dataset. Its downloads the data, get the first 50 emails, pre-label them with Google NLP, push both assets and predictions to Kili and prioritize the assets.

  1. Create a NER project and retrieve its ID.

  2. Make sure that your GCP authentication is set up properly (or follow this tutorial).

  3. Execute:

python google_ner_pre_labeling.py

How to use GraphQL Playground

For more flexibility, you can directly query GraphQL API without using kili-playground.

  1. Go to http://cloud.kili-technology.com/api/label/playground

  2. Login using the following mutation in order to retrieve the authentication token:

mutation {
  signIn(email: "YOUR_EMAIL", password: "YOUR_PASSWORD") {
    user {
      id
    }
    token
  }
}
  1. In the bottom left corner of the screen, click on HTTP headers and write the retrieved token in the authorization headers:
{
  "Authorization": "Bearer: YOUR_TOKEN"
}
  1. Launch any query/mutation:
query {
  getUser(email: "YOUR_EMAIL") {
    id
  }
}

How to do online learning with AutoML (Text Classification Single-class)

  • Create Project for TextClassification Single-class

  • Then execute:

python online_learning_text_classification.py (OPTIONAL --api_endpoint https://cloud.kili-technology.com/api/label/graphql)
  • Enter your personnal information : Mail, Password, ProjectID

  • Annotate

  • See predictions

In docker

  1. Create a .env file in this folder containing your settings:
EMAIL=
PASSWORD=
PROJECT_ID=
API_ENDPOINT=
  1. Build the docker and launch it:
docker build -t kili-playground .

docker run -it --network="host" kili-playground online-learning

How to do online learning with YOLOv3 (for object detection)

  1. Create a project for single-class object detection

  2. Update settings to respect YOLOv3's way of dealing with classes (key is an integer starting from zero and value is in lower case)

{
  "tools":[
    "rectangle"
  ],
  "annotation_types": {
    "0": "face"
  }
}
  1. Build the docker in the folder:
cd image-object-detection-with-yolo
docker build -t kili-playground-yolo .
  1. Launch it by setting EMAIL/PASSWORD/PROJECT_ID/API_ENDPOINT environment variables:
docker run -it -e "EMAIL=mypassword@kili-technology.com" \
  -e "PASSWORD=my_password" \
  -e "PROJECT_ID=1234567890" \
  -e "API_ENDPOINT=https://cloud.kili-technology.com/api/label/graphql" \
  --network="host" kili-playground-yolo
  1. The script will continuously create predictions on non-labelled assets.

How to import OCR metadata

  1. Edit new_assets.yml where metadata has the format of ./examples/invoice.json and the content points to the URL of invoice.png.

  2. Execute:

python import_assets.py

How to set assets only to be labeled by some users

  1. Edit new_assets.yml and change the field toBeLabeledBy. When this field no exists, assets can be labeled by everyone.

  2. Execute:

python set_asset_to_be_labeled_by.py

How to authenticate to the API ?

Use:

from kili.authentication import KiliAuth
from kili.playground import Playground

kauth = KiliAuth(email=email, password=password)
playground = Playground(kauth)

How to delete one asset identified by its external id ?

Use:

playground.delete_assets_by_external_id(project_id=project_id, external_id=external_id)

How to update instructions in project?

Currently instructions can be set as a link to a PDF or an external web page.

You can update instructions with:

python update_project_instructions.py

How to get labeler statistics?

You can get an excel file summing up the asset / labeler / day doing:

python get_labeler_stats.py
You can’t perform that action at this time.