<commit_before># Image Labelling Tool
This repository is a fork of a project released [here](https://bitbucket.org/ueacomputervision/image-labelling-tool).
The original originals are <NAME>, Dr. <NAME> and Dr. <NAME> at University of East Anglia.

The code is modified to work better with SLIC initialization.
Also, this repository provides a complete example to train an object detection model with annotated data.

## Installation
```
$ pip install -e .
```

## Usage
```bash
# This starts up interactive annotator.
# If slic option is supplied, it starts with precomputed segmentations based on SLIC.
$ python flask_app.py [--slic] [--image_dir PATH_TO_DIR] [--label_names label_names.yml]
```


For those who want to have label images instead of raw `.json`, please use the following command.
```bash
# Convert annotated json to labels
$ python convert_json_to_label.py [--image_dir PATH_TO_DIR] [--label_names label_names.yml]
```

## Example<commit_msg>updated usage on the top page README<commit_after># Image Labelling Tool
This repository is a fork of a project released [here](https://bitbucket.org/ueacomputervision/image-labelling-tool).
The original originals are <NAME>, Dr. <NAME> and Dr. <NAME> at University of East Anglia.

The code is modified to work better with SLIC initialization.
Also, this repository provides a complete example to train an object detection model with annotated data.

## Installation
```
$ pip install -e .
```

## Usage
```bash
# This starts up interactive annotator.
# If slic option is supplied, it starts with precomputed segmentations based on SLIC.
$ python flask_app.py [--slic] [--image_dir PATH_TO_DIR] [--label_names label_names.yml]
```
SLIC option should not be set for those who only want to annotate by bounding boxes.
The option can be helpful for segmenting an image. Please be aware the superpixel segmentation is not always perfect.

The annotations will be stored in the same directory where the corresponding images exist.
The annotaions are stored by `.json` files containing all the parameters.

I provided a convenient script to translate raw `.json` into a label image.
This can be helpful for annotating semantig segmentation datasets.
```bash
# Convert annotated json to labels
$ python convert_json_to_label.py [--image_dir PATH_TO_DIR] [--label_names label_names.yml]
```

## Example
{'fraction_non_alphanumeric': 0.08326253186066271, 'fraction_numerical': 0.0, 'mean_word_length': 4.674698795180723, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 9, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3883843', 'n_tokens_mistral': 683, 'n_tokens_neox': 636, 'n_words': 302}