Skip to content

Kangas CLI

Douglas Blank edited this page Mar 13, 2023 · 3 revisions

Kangas server

If you are running from inside a notebook, or even in a Python environment, you can start the Kangas server by simply calling:

dg.show()

However, you may also start Kangas from the command-line:

kangas server
kangas server filename.datagrid

Examples:

kangas server https://github.com/dsblank/examples/raw/main/mnist-60000-after-5-epochs.datagrid.zip
kangas server https://github.com/caleb-kaiser/kangas_examples/raw/master/coco-500.datagrid
kangas server https://github.com/WillKoehrsen/Hands-On-Machine-Learning/raw/master/handson-ml-master/datasets/housing/housing.csv

See Development for full description of server flags.

Kangas Import/Export

Kangas can import from, and export to specific targets. Currently Kangas supports:

  • huggingface
  • comet

Additional integrations are welcome!

Import

Import can import datasets (including images and annotations).

kangas import [-h] [--comet] [--huggingface] [--debug] [--options KEY=VALUE [KEY=VALUE ...]] PATH NAME

Positional arguments:

  PATH                  The source-specific path: workspace/project
  NAME                  The name of the DataGrid to create

Optional arguments:

  -h, --help            show this help message and exit
  --comet               Use comet as the source
  --huggingface         Use huggingface as the source
  --debug               Show debugging information
  --options KEY=VALUE [KEY=VALUE ...]
                        Pass the following KEY=VALUE pairs;
                            for --huggingface: --options split=train streaming=True seed=42
                                     samples=100 private=True push=False
                                     labels=objects:category bbox=objects:bbox:xyxy
                                     ids=objects:bbox_id

Examples:

Import a dataset from huggingface, and map the annotations from the "objects" field (real example):

kangas import --huggingface detection-datasets/fashionpedia_4_categories fashionpedia.datagrid \
    --options split=val samples=10 labels=objects:category bbox=objects:bbox:xyxy ids=objects:bbox_id

Format options for bbox are: xyxy and xywh.

Import a dataset from Comet. This will construct a DataGrid with a column name "Image". Includes annotations (real example):

kangas import --comet dsblank/coco-500 coco-500.datagrid

Export

Export can send datasets (including images and annotations).

kangas export [-h] [--comet] [--debug] [--huggingface] [--options KEY=VALUE [KEY=VALUE ...]] [PATH] NAME

Positional arguments:

  PATH                  The target-specific path: workspace/project/exp, workspace/project, project, or nothing
  NAME                  The name of the DataGrid to upload to host

Optional arguments:

  -h, --help            show this help message and exit
  --comet               Use comet as the target
  --debug               Show debugging information
  --huggingface         Use huggingface as the target
  --options KEY=VALUE [KEY=VALUE ...]
                        Pass the following KEY=VALUE pairs; for --comet: --options output_dir=DIR; for --huggingface --options limit=N

Examples:

For exporting to huggingface:

kangas export --huggingface my-org/my-new-dataset samples.datagrid --options limit=1000

For exporting to Comet:

kangas export --comet my-workspace/my-project samples.datagrid --output_dir=/tmp

Upgrade

To upgrade annotations from Kangas 1 to Kangas 2, use:

kangas upgrade filename.datagrid
# or:
kangas upgrade *.datagrid

Table of Contents

Clone this wiki locally