Skip to main content

Several tools for dealing with image annotations to train YOLO or similar models

Project description

Pflow

Install

pip install -e '.[dev]'

Setup

cp .env.default .env

Run

pflows doc/examples/birds-grouped-categories.json

In this example, we defined a workflow to download the dataset from Roboflow as we can see in the image below:

Birds Dataset

The workflow is defined in a JSON file, where we define the steps to be executed:

[
  {
    "task": "roboflow_tools.download_dataset",
    "target_dir": "{{BASE_FOLDER}}/datasets/downloaded/cub200_parts-50",
    "url": "https://universe.roboflow.com/explainableai-lavbv/cub200_parts/dataset/50"
  },
  {
    "task": "yolo_v8.load_dataset",
    "folder_path": "{{BASE_FOLDER}}/datasets/downloaded/cub200_parts-50"
  },
  {
    "task": "base.count_images"
  },
  {
    "task": "base.count_categories"
  },
  {
    "task": "categories.group_categories",
    "groups": {
      "upper": [["eye", "bill", "head", "nape", "throat"]],
      "lower": [["belly", "feet", "tail"]],
      "middle": [["Wing", "breast", "back"]],
      "Wing": [["Wing"]],
      "back": [["back"]],
      "belly": [["belly"]],
      "bill": [["bill"]],
      "eye": [["eye"]],
      "feet": [["feet"]],
      "head": [["head"]],
      "nape": [["nape"]],
      "tail": [["tail"]],
      "throat": [["throat"]]
    },
    "condition": "any"
  },
  {
    "task": "categories.keep",
    "categories": ["upper", "lower", "middle"]
  },
  {
    "task": "base.count_images"
  },
  {
    "task": "base.count_categories"
  },
  {
    "task": "base.show_categories"
  },
  {
    "task": "yolo_v8.write",
    "target_dir": "{{BASE_FOLDER}}/datasets/processed/birds-grouped-categories-cub200_parts-50"
  }
]

The workflow is composed of the following steps:

  1. Download the dataset from Roboflow
  2. Load the dataset
  3. Count the number of images
  4. Count the number of categories
  5. Group the categories, to create new categories based on the existing ones (upper, lower, middle)
  6. Keep only the categories that are in the groups "upper", "lower" and "middle"
  7. Count the number of images
  8. Count the number of categories
  9. Show the categories
  10. Write the dataset to disk

As we can see, we can use the {{BASE_FOLDER}} variable to refer to the base folder of the project. These variables are defined in the .env file, which is used to configure the project.

We can see the input images and output images below:

Example Bird 1:

Bird 1 before Bird 1 before

Example Bird 2:

Bird 2 before Bird 2 before

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pflows-0.1.19.tar.gz (5.4 MB view details)

Uploaded Source

Built Distribution

pflows-0.1.19-py3-none-any.whl (5.4 MB view details)

Uploaded Python 3

File details

Details for the file pflows-0.1.19.tar.gz.

File metadata

  • Download URL: pflows-0.1.19.tar.gz
  • Upload date:
  • Size: 5.4 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.0 CPython/3.11.4

File hashes

Hashes for pflows-0.1.19.tar.gz
Algorithm Hash digest
SHA256 613bf10e88e560f68e76265077d9e506c96c6c68c474a81d4927ef6dc66ceee1
MD5 2c7fe0e9ce4c25b09e2618536b7b6b48
BLAKE2b-256 e9f6a9de228dea3c7dd30229dbddea66795ca97950f21ffb5988241d23951944

See more details on using hashes here.

File details

Details for the file pflows-0.1.19-py3-none-any.whl.

File metadata

  • Download URL: pflows-0.1.19-py3-none-any.whl
  • Upload date:
  • Size: 5.4 MB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.0 CPython/3.11.4

File hashes

Hashes for pflows-0.1.19-py3-none-any.whl
Algorithm Hash digest
SHA256 0035cf299f6a8bcdb266cca809333daab1ca3395476bcbaffe5d6b12eb53ae99
MD5 7945a044cc5ffc4c6c31e35313f168d3
BLAKE2b-256 63d79dd5b01f51aace60a2d9af2ede4f1f3391947b5eca47c3b1e66f8b03b83a

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page