Skip to main content

Package to work with galleries of images

Project description

Galleries

Galleries is a python package to manage images galleries and is mainly designed for recognition purposes. With this package you can create a gallery specifying where to get the images from and how to get annotations (if exist) from each image.

Installation

pip install galleries

Usage

Gallery construction

from galleries.annotations_parsers.file_name_parser import FileNameSepParser
from galleries.gallery import Gallery
from galleries.images_providers.local_files_image_providers import LocalFilesImageProvider


images_provider = LocalFilesImageProvider("path/to/images")
annotations_parser = FileNameSepParser(["label", "age"], sep="_")
gallery = Gallery(images_provider, annotations_parser)

Traverse images

images = gallery.get_images()  # returns a generator
for image in images:
  # image is a numpy ndarray
  pass

Get annotations

annotations = gallery.get_annotations()  # returns a generator
for annotation in annotations:
  # annotation is a dictionary
  pass

You can also generate new data for each image and easily save it using a GalleryDataHandler, which is an abstract class. GalleryGenericDataHandler is an implementation of this class that takes information of how to generate the new data and where to save it.

For instance, this is a code example of how to extract features from a gallery and save it to disk:

from galleries.write_gallery_data import GalleryGenericDataHandler

feature_extractor = ...  # your feature extractor here which has a features(image) method
data_generator = "<folder name>", "<feature extractor name>", feature_extractor.features

# write features if do not exist
gallery_features_writer = GalleryGenericDataHandler(gallery, "directory/to/save/features")
exist_features = gallery_features_writer.exists_data(data_generator)
if not exist_features:
  gallery_features_writer.write_data(data_generator)

# read features
features = gallery_features_writer.read_data(data_generator)

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

galleries-0.3.15.tar.gz (12.9 kB view details)

Uploaded Source

Built Distribution

galleries-0.3.15-py3-none-any.whl (19.0 kB view details)

Uploaded Python 3

File details

Details for the file galleries-0.3.15.tar.gz.

File metadata

  • Download URL: galleries-0.3.15.tar.gz
  • Upload date:
  • Size: 12.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.0 CPython/3.9.12

File hashes

Hashes for galleries-0.3.15.tar.gz
Algorithm Hash digest
SHA256 3b70b4f5c0cc3079cc651a80a1b57139e8ef0b07679c7bb4950c5b0f459a7d3f
MD5 d0fec1556d54eca0b225644c5a3ca9af
BLAKE2b-256 f4d113870a67bbd4dee6e5dd9efbf2a1cfd4a438399ebd2e72c7932cc07432cc

See more details on using hashes here.

File details

Details for the file galleries-0.3.15-py3-none-any.whl.

File metadata

  • Download URL: galleries-0.3.15-py3-none-any.whl
  • Upload date:
  • Size: 19.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.0 CPython/3.9.12

File hashes

Hashes for galleries-0.3.15-py3-none-any.whl
Algorithm Hash digest
SHA256 2780c6a83c642d9529d9217fb03a1c1a7d8ac77f44eec7357a80f73cc00f1826
MD5 679536c342ae8bf9173f04258e0aa789
BLAKE2b-256 9e73cb2a51ed38db04bedd8ba912406ce47b7694b699bf3be6fdcafafa114735

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