Skip to main content

Templates to write DataContainer content to file.

Project description



Sinapsis Data Writer

Package to write data of all formats, from the DataContainer in a specified location

🐍 Installation🚀 Features📚 Usage example📙 Documentation🔍 License

🐍 Installation

This mono repo consists of different packages to handle data:

  • sinapsis-data-readers
  • sinapsis-data-visualization
  • sinapsis-data-writers
  • sinapsis-generic-data-tools

Install using your package manager of choice. We encourage the use of uv

Example with uv:

  uv pip install sinapsis-data-writers --extra-index-url https://pypi.sinapsis.tech

or with raw pip:

  pip install sinapsis-data-writers --extra-index-url https://pypi.sinapsis.tech

[!IMPORTANT] Templates in each package may require extra dependencies. For development, we recommend installing the package with all the optional dependencies:

with uv:

  uv pip install sinapsis-data-writers[all] --extra-index-url https://pypi.sinapsis.tech

or with raw pip:

  pip install sinapsis-data-writers[all] --extra-index-url https://pypi.sinapsis.tech

[!NOTE] Some templates also need system dependencies (e.g., ffmpeg). The installation depends on your OS. For Linux:

apt-get install -y ffmpeg

🚀 Features

  • Sinapsis Data Writers
    Write data to many kinds of files.
    • Annotation Writers
      Save text annotations to JSON, geometries to polygons, etc.
    • Audio Writers
      Save to audio files using Soundfile, among others.
    • Image Writers Save to image files using CV2, among others.
    • Video Writers
      Save to video files using CV2 or FFMPEG, among others.
  • Sinapsis Generic Data Tools
    Wide range of miscellaneous tools to manipulate your data.

[!TIP] Use CLI command sinapsis info --all-template-names to show a list with all the available Template names installed with Sinapsis Data Tools.

[!TIP] Use CLI command sinapsis info --example-template-config TEMPLATE_NAME to produce an example Agent config for the Template specified in TEMPLATE_NAME.

For example, for ImageSaver use sinapsis info --example-template-config ImageSaver to produce the following example config:

agent:
  name: my_test_agent
  description: agent to save image locally
templates:
- template_name: InputTemplate
  class_name: InputTemplate
  attributes: {}
- template_name: ImageSaver
  class_name: ImageSaver
  template_input: InputTemplate
  attributes:
    save_dir: /path/to/save/dir
    extension: jpg
    root_dir: '/path/to/sinapsis/cache'
    save_full_image: true
    save_bbox_crops: false
    save_mask_crops: false
    min_bbox_dim: 5

📚 Usage example

Example agent config You can copy and paste the following config and run it using the sinapsis cli, changing the data_dir attribute in the FolderImageDatasetCV2 and the root_dir attribute in the ImageSaver template
agent:
  name: my_test_agent
  description: agent to save image locally
templates:
- template_name: InputTemplate
  class_name: InputTemplate
  attributes: {}
- template_name: FolderImageDatasetCV2
  class_name: FolderImageDatasetCV2
  attributes:
    data_dir: /path/to/image
    pattern: '**/*'
    batch_size: 1
    load_on_init: true
    label_path_index: 0
    is_ground_truth: false

- template_name: ImageSaver
  class_name: ImageSaver
  template_input: FolderImageDatasetCV2
  attributes:
    save_dir: /path/to/save/dir
    extension: jpg
    root_dir: '/path/to/sinapsis/cache'
    save_full_image: true
    save_bbox_crops: false
    save_mask_crops: false
    min_bbox_dim: 5
To run, simply use:
sinapsis run name_of_the_config.yml

NOTE: Make sure to update the data_dir attribute in the FolderImageDatasetCV2, and the save_dir and root_dir attributes in the ImageSaver templates to actual directories

📙 Documentation

Documentation for this and other sinapsis packages is available on the sinapsis website

Tutorials for different projects within sinapsis are available at sinapsis tutorials page

🔍 License

This project is licensed under the AGPLv3 license, which encourages open collaboration and sharing. For more details, please refer to the LICENSE file.

For commercial use, please refer to our official Sinapsis website for information on obtaining a commercial license.

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

sinapsis_data_writers-0.1.1.tar.gz (51.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

sinapsis_data_writers-0.1.1-py3-none-any.whl (33.2 kB view details)

Uploaded Python 3

File details

Details for the file sinapsis_data_writers-0.1.1.tar.gz.

File metadata

File hashes

Hashes for sinapsis_data_writers-0.1.1.tar.gz
Algorithm Hash digest
SHA256 c3f01d570d33b7783eb40e1ba1f12783683d45e389ab00e8e3e5485aa9202f57
MD5 4882915766a4f5ea4baa7d64a9c2c597
BLAKE2b-256 f92726eb8729f48dc529cbeccf239a9ab2ecd0b7aff519aad5cbc299a7693ee3

See more details on using hashes here.

File details

Details for the file sinapsis_data_writers-0.1.1-py3-none-any.whl.

File metadata

File hashes

Hashes for sinapsis_data_writers-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 54e67b97c6f9172d0a80c9f14152bfe696f98e62ae4b33fde756fa1c648403c5
MD5 d647d8309c29a2ed7f5cf851743eba1e
BLAKE2b-256 68e50bb93d887642b6e73e629fe6929bcf20c362fdb098cf98ae283c4473f8a6

See more details on using hashes here.

Supported by

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