{"id":27147748,"url":"https://github.com/soroushj/image-dataset-loader","last_synced_at":"2025-10-17T08:15:47.516Z","repository":{"id":62570521,"uuid":"193899045","full_name":"soroushj/image-dataset-loader","owner":"soroushj","description":"Load image datasets as NumPy arrays","archived":false,"fork":false,"pushed_at":"2024-03-26T21:11:10.000Z","size":32,"stargazers_count":6,"open_issues_count":0,"forks_count":1,"subscribers_count":0,"default_branch":"master","last_synced_at":"2025-04-03T20:18:42.795Z","etag":null,"topics":["dataset","image-dataset","machine-learning","numpy-arrays","numpy-data"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/soroushj.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-06-26T12:22:22.000Z","updated_at":"2024-03-23T10:52:03.000Z","dependencies_parsed_at":"2022-11-04T00:31:21.787Z","dependency_job_id":null,"html_url":"https://github.com/soroushj/image-dataset-loader","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/soroushj%2Fimage-dataset-loader","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/soroushj%2Fimage-dataset-loader/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/soroushj%2Fimage-dataset-loader/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/soroushj%2Fimage-dataset-loader/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/soroushj","download_url":"https://codeload.github.com/soroushj/image-dataset-loader/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247838415,"owners_count":21004576,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["dataset","image-dataset","machine-learning","numpy-arrays","numpy-data"],"created_at":"2025-04-08T11:51:01.596Z","updated_at":"2025-10-17T08:15:47.428Z","avatar_url":"https://github.com/soroushj.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# image-dataset-loader: Load image datasets as NumPy arrays\n\n[![PyPI](https://img.shields.io/pypi/v/image-dataset-loader.svg)](https://pypi.org/project/image-dataset-loader/)\n[![MIT license](https://img.shields.io/badge/license-MIT-brightgreen.svg)](https://opensource.org/licenses/MIT)\n\n## Installation\n\n```bash\npip install image-dataset-loader\n```\n\n## Overview\n\nSuppose you have an image dataset in a directory which looks like this:\n\n```\ndata/\n  train/\n    cats/\n      cat0001.jpg\n      cat0002.jpg\n      ...\n    dogs/\n      dog0001.jpg\n      dog0002.jpg\n      ...\n  test/\n    cats/\n      cat0001.jpg\n      cat0002.jpg\n      ...\n    dogs/\n      dog0001.jpg\n      dog0002.jpg\n      ...\n```\n\nYou can use the `image_dataset_loader.load` function to load this dataset as NumPy arrays:\n\n```python\nimport image_dataset_loader\n\n(x_train, y_train), (x_test, y_test) = image_dataset_loader.load('path/to/data', ['train', 'test'])\n```\n\nThe shape of the `x_*` arrays will be `(instances, rows, cols, channels)` for color images and `(instances, rows, cols)` for grayscale images.\nAlso, the shape of the `y_*` arrays will be `(instances,)`.\n\nAll images in the dataset must have the same shape.\nAlso, all data subsets (i.e., `train` and `test` in this example) must contain the same set of classes.\nClass names will be sorted alphabetically.\nSo, in this example, `cats` and `dogs` will be represented by `0` and `1`, respectively.\n\nYou can also load a single data subset. For example:\n\n```python\n(x_train, y_train), = image_dataset_loader.load('path/to/data', ['train'])\n```\n\nNote that the comma after `(x_train, y_train)` is required, because the function always returns a tuple of tuples.\n\n## API\n\n```python\nload(dataset_path, set_names,\n     shuffle=True, seed=None,\n     x_dtype='uint8', y_dtype='uint32')\n```\n\n- **`dataset_path:`** Path to the dataset directory.\n- **`set_names:`** List of the data subsets (subdirectories of the dataset directory).\n- **`shuffle:`** Whether to shuffle the samples. If false, instances will be sorted by class name and then by file name.\n- **`seed:`** Random seed used for shuffling (see the [docs](https://docs.python.org/3/library/random.html#random.seed)).\n- **`x_dtype:`** NumPy data type for the X arrays (see the [docs](https://numpy.org/devdocs/user/basics.types.html)).\n- **`y_dtype:`** NumPy data type for the Y arrays (see the [docs](https://numpy.org/devdocs/user/basics.types.html)).\n- Returns a tuple of `(x, y)` tuples corresponding to `set_names`.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsoroushj%2Fimage-dataset-loader","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsoroushj%2Fimage-dataset-loader","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsoroushj%2Fimage-dataset-loader/lists"}