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
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file galleries-0.2.5.tar.gz
.
File metadata
- Download URL: galleries-0.2.5.tar.gz
- Upload date:
- Size: 9.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.7.1 importlib_metadata/4.8.2 pkginfo/1.8.2 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.9
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | a64ac61a5cba56b67dd4f93c1cf1df798b7f364f2c9a6b492004853a3be7754f |
|
MD5 | f9d2c414a22e89241b1a197b84419b9a |
|
BLAKE2b-256 | 6d9e162ce58a2eb08232dcbad038c5f5b57103bc9cc03174888ba285fa44c2b4 |
File details
Details for the file galleries-0.2.5-py3-none-any.whl
.
File metadata
- Download URL: galleries-0.2.5-py3-none-any.whl
- Upload date:
- Size: 11.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.7.1 importlib_metadata/4.8.2 pkginfo/1.8.2 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.9
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7b78836d8925b9a23230cfaa71fa8bde2274e492c79e8477b3d684f41886cd12 |
|
MD5 | bb8862a809dd68d182cfba2b94f77de0 |
|
BLAKE2b-256 | 004b29e2588cd8240598684eb575ca25554161c0973e12f7cb182927bd8e0370 |