YoloDatasetDBManager
YoloDatasetDBManager is a Python library designed to efficiently manage YOLO datasets stored in a PostgreSQL database. It enables saving images and their associated annotations, rebuilding folder structures from the database, and performing flexible operations on datasets.
📥 Installation
Ensure Python 3.11+ is installed.
Via pip
pip install YoloDatasetDBManager
Via pdm
If you use PDM, run:
pdm add YoloDatasetDBManager
🚀 Usage
Here’s a complete example of how to use YoloDatasetDBManager:
import os
from pathlib import Path
from yolo_dataset_db_manager.db import PostgreSQLManager
from yolo_dataset_db_manager.processor import YoloDatasetProcessor
from yolo_dataset_db_manager.settings import ParamsConnection
# Define the base directory for the project
BASE_DIR = Path(__file__).parent.parent
# Specify the path to the dataset folder, where the YOLO data is stored
dataset_path = BASE_DIR / "data"
# Specify the output directory where the reconstructed dataset will be saved
output_path = BASE_DIR / "datasets_out"
# Configure the connection parameters for the PostgreSQL database
params = ParamsConnection(
dbname=os.getenv("POSTGRES_DB"),
user=os.getenv("POSTGRES_USER"),
password=os.getenv("POSTGRES_PASSWORD"),
host=os.getenv("POSTGRES_HOST"),
port=os.getenv("POSTGRES_PORT"),
)
# Initialize the PostgreSQL manager and create the YOLO dataset table if it doesn't exist
with PostgreSQLManager(params, table_name="yolo_dataset", create_table=True) as db:
process = YoloDatasetProcessor(
db, dataset_path=dataset_path, output_path=output_path
)
# Save the dataset (images and annotations) from the local folder to the database
process.save_dataset()
db.commit() # Commit the transaction to ensure data is stored in the database
# Rebuild the dataset structure from the database into the output folder
process.rebuild_dataset()
🛠️ Contribution
Contributions are welcome! Follow these steps to get involved:
- Fork the project on GitHub.
- Clone the repository:
git clone https://github.com/Macktireh/YoloDatasetDBManager.git
- Install development dependencies with
pdm:pdm install - Create a branch for your changes:
git checkout -b feature/my-feature
- Run tests:
pdm run test
- Submit a pull request when your work is ready.
📜 License
This project is licensed under the MIT License. See the LICENSE file for details.
Metadata
Release files for YoloDatasetDBManager 0.2.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 | Provenance | Actions |
|---|---|---|---|---|
| yolodatasetdbmanager-0.2.1.tar.gz | 8.3 kB | Without provenance | Details for yolodatasetdbmanager-0.2.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| yolodatasetdbmanager-0.2.1-py3-none-any.whl | Python 3 | none | any | Details for yolodatasetdbmanager-0.2.1-py3-none-any.whl |
Total release size: 16.3 kB
Release files / yolodatasetdbmanager-0.2.1.tar.gz
| Download URL | yolodatasetdbmanager-0.2.1.tar.gz |
|---|---|
| Size | 8.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
e7d9f0b6efff994c1ff033fc43a3032ba0451078b5740edf64aee555c783d68b
|
|
BLAKE2b-256 checksum How to use checksums |
ffa50e870afa3276a8ede9cfdbef9c8c5a31be61f843959939ceb7e8fba4c5a1
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
pdm/2.20.1 CPython/3.10.12 Linux/6.5.0-1025-azure
|
Release files / yolodatasetdbmanager-0.2.1-py3-none-any.whl
| Download URL | yolodatasetdbmanager-0.2.1-py3-none-any.whl |
|---|---|
| Size | 8.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
922077db17d9e3baf6aa47cbb83ccbb0913e17eb81f5c6eba26451061218e7df
|
|
BLAKE2b-256 checksum How to use checksums |
15a039abc20c5a4408a1b4f4c3494371e9ffd090f3896bdeb92d534c089fd9be
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
pdm/2.20.1 CPython/3.10.12 Linux/6.5.0-1025-azure
|
Security for YoloDatasetDBManager 0.2.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.