Skip to main content

Add your description here

Project description

klygo

Thư viện Python hỗ trợ nén/giải nén file, xử lý bộ dữ liệu YOLO, đọc/ghi file cấu hình và nhận diện vật thể zero-shot.


Tính năng chính

  • klygo.archive: Các thao tác với file nén ZIP (nén, giải nén, tìm kiếm, gộp, chia, thêm, xóa file) hỗ trợ hiển thị thanh tiến trình.
  • klygo.datasets: Các công cụ quản lý và xử lý bộ dữ liệu YOLO (phân chia train/val/test, chia lại tỷ lệ tại chỗ, gộp nhiều dataset có ánh xạ lại class ID, và tách dataset theo class/tỷ lệ con).
  • klygo.io: Đọc và ghi các file cấu hình YAML, JSON, TOML, tự động tạo thư mục, tự động phân giải đường dẫn tương đối và truy cập dạng thuộc tính qua Box.
  • klygo.models: Lớp hỗ trợ nhận diện vật thể zero-shot (dựa trên Grounding DINO) trên ảnh và video, tự động xuất dữ liệu theo định dạng YOLO.

Cấu trúc thư mục

klygo/
├── archive/        # Các tiện ích nén và giải nén
├── datasets/       # Công cụ quản lý và phân chia bộ dữ liệu YOLO
├── io/             # Bộ đọc/ghi cấu hình YAML, JSON, TOML
├── models/         # Lớp nhận diện vật thể (Kernel)
└── validators/     # Bộ xác thực dữ liệu đầu vào

Hướng dẫn sử dụng nhanh

1. Nén và giải nén (klygo.archive as ar)

import klygo.archive as ar

# Nén thư mục và giải nén
ar.compress("src_directory/", "archive.zip")
ar.extract("archive.zip", output="destination_dir/", overwrite=True)

# Tìm kiếm file trong archive
files = ar.search("archive.zip", "images/*.jpg")

Xem tài liệu đầy đủ tại docs/archive/README.md.


2. Quản lý bộ dữ liệu YOLO (klygo.datasets)

from klygo.datasets import partition, repartition, merge, split, remap_classes, get_dataset_info

# 1. Phân chia tập dữ liệu thô thành train/val/test
partition(source="raw_data.zip", output="dataset/", ratios=(0.8,), overwrite=True)

# 2. Hợp nhất hai bộ dữ liệu khác class tự động đổi class ID
merge(sources=["data1/", "data2.zip"], output="merged.zip", overwrite=True)

# 3. Tách nhỏ bộ dữ liệu theo từng class đối tượng riêng biệt
split(source="merged.zip", output_dir="split_classes/", by_class=True, overwrite=True)

# 4. Ánh xạ và đổi tên lớp dữ liệu
remap_classes(source="merged.zip", output="remapped.zip", class_map={0: 1, "apple": "red_apple"}, overwrite=True)

# 5. Lấy thông tin chi tiết của bộ dữ liệu YOLO
info = get_dataset_info("merged.zip")
print(info)

Xem tài liệu đầy đủ tại docs/datasets/README.md.


3. File cấu hình (klygo.io as io)

import klygo.io as io

# Ghi file cấu hình
config_data = {"learning_rate": 0.01, "epochs": 50}
io.write_file("configs/train_params.toml", config_data, overwrite=True)

# Đọc file cấu hình và truy cập bằng thuộc tính
cfg = io.Config("configs/train_params.toml").imread()
print(cfg.learning_rate)  # 0.01

Xem tài liệu đầy đủ tại docs/io/README.md.


4. Mô hình nhận diện (klygo.models.Kernel)

from klygo.models import Kernel

# Khởi tạo mô hình Grounding DINO
kernel = Kernel()

# Chạy nhận diện trên video và xuất ra bộ dữ liệu YOLO
kernel.detect(
    input_path="input_video.mp4",
    prompt="car. traffic light.",
    save_yolo_dir="dataset/"
)

Xem tài liệu đầy đủ tại docs/models/README.md.


Cài đặt

git clone https://github.com/your-username/klygo.git
cd klygo
uv sync

Tài liệu chi tiết

Tất cả hướng dẫn đầy đủ đều được lưu tại thư mục docs:

  • Hướng dẫn nén & giải nén: docs/archive/README.md
  • Hướng dẫn xử lý bộ dữ liệu YOLO: docs/datasets/README.md
  • Hướng dẫn cấu hình & IO: docs/io/README.md
  • Hướng dẫn nhận diện vật thể: docs/models/README.md

k l y g o

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

klygo-0.1.0.tar.gz (28.7 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

klygo-0.1.0-py3-none-any.whl (39.4 kB view details)

Uploaded Python 3

File details

Details for the file klygo-0.1.0.tar.gz.

File metadata

  • Download URL: klygo-0.1.0.tar.gz
  • Upload date:
  • Size: 28.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.13

File hashes

Hashes for klygo-0.1.0.tar.gz
Algorithm Hash digest
SHA256 051ecccdd1c43f2088763354c2469e4a6589657f68ee96dde2778a3fe82a22f8
MD5 186c8ccd8f1519bebbc8ff5df17a7846
BLAKE2b-256 d71ba80248953cf9554bdabc3091df6474333bd029aff1d763909cf557441c95

See more details on using hashes here.

File details

Details for the file klygo-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: klygo-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 39.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.13

File hashes

Hashes for klygo-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 8416b766028443bbbce183cb27ac576b43c5fb7a78437e5699b4b5460fe0905b
MD5 67158064ef3b7ec546c4337047c54c68
BLAKE2b-256 c1f5040629d63dc312b3586275945eeb2668024d9013112b3bf3f133a1adcb60

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page