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)
Metadata
Release files for galleries 0.5.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| galleries-0.5.1.tar.gz | 15.9 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| galleries-0.5.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 42.4 kB
Release files / galleries-0.5.1.tar.gz
| Download URL | galleries-0.5.1.tar.gz |
|---|---|
| Size | 15.9 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
0d2afcc29e973259fc617771db964573137012fd3d4d7e6ef15b0bf137a0a3ba
|
|
BLAKE2b-256 checksum How to use checksums |
900d8f2c87b267990cd6ed5497df25fe79760506c07f2a2669edb026a79fe204
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.1 CPython/3.11.1
|
Release files / galleries-0.5.1-py3-none-any.whl
| Download URL | galleries-0.5.1-py3-none-any.whl |
|---|---|
| Size | 26.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
21147ee1cd2f6482191fb8711598c9bd52c910664556c45fd251b13df21d91c9
|
|
BLAKE2b-256 checksum How to use checksums |
128a787648e316a4965e528b856abf7d6ab6cb73f1e14ead9a6fdea567b8ce57
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.1 CPython/3.11.1
|