Skip to main content

Python utilities for archive, config and zero-shot detection

Project description

klygo

Thư viện Python hỗ trợ xử lý ZIP, quản lý dataset YOLO, đọc/ghi cấu hình và ảnh, nhận diện vật thể zero-shot, crop và trực quan hóa kết quả.

Cài đặt

git clone https://github.com/IchigoMazone/klygo.git
cd klygo
uv sync

Các package

  • klygo.archive: nén, giải nén, tìm kiếm, kiểm tra, chỉnh sửa, gộp và chia ZIP.
  • klygo.datasets: partition, repartition, unpartition, merge, split và remap dataset YOLO.
  • klygo.io: đọc/ghi YAML, JSON, TOML; đọc ảnh bằng PIL hoặc OpenCV.
  • klygo.models: nhận diện zero-shot trên ảnh, thư mục ảnh và video.
  • klygo.visualize: hiển thị, vẽ bbox, crop, đọc crop và thống kê dataset.

Sử dụng nhanh

Archive

import klygo.archive as ar

ar.compress("dataset", "dataset.zip", overwrite=True)
ar.extract("dataset.zip", output_dir="extracted", overwrite=True)
files = ar.search("dataset.zip", "images/*.jpg")

Dataset YOLO

import klygo.datasets as ds

ds.partition(
    source="raw_dataset.zip",
    target="dataset",
    ratios=(0.8, 0.1, 0.1),
    overwrite=True,
)

info = ds.get_dataset_info("dataset")
print(info)

Đọc cấu hình và ảnh

import klygo.io as io

config = io.Config("config.yaml").read()
pil_images = io.read_images("dataset/images", backend="pil")
opencv_images = io.read_images("dataset/images", backend="opencv")

Model

from klygo.models import Model

model = Model()

predictions = model.predict(
    source="dataset/images",
    prompt="car. person.",
)

detected_frames = model.detect(
    source="traffic.mp4",
    output_path="detected.mp4",
    annotated_dir="annotated",
    dataset_dir="generated_dataset",
    prompt="car. person.",
)

detection_results = model.detect(
    source="dataset/images",
    prompt="car. person.",
    metadata=True,
)

crop_results = model.crop(
    source="traffic.mp4",
    target="crops",
    prompt="car. person.",
)

Visualize

import klygo.visualize as vis

grid = vis.read_crops("crops")  # lưới 5 x 5 mặc định
vis.show_image(grid, title="Detected objects")

saved_detections = vis.read_detections("annotated")

Quy ước đường dẫn

  • source: file hoặc thư mục đầu vào.
  • *_path: đường dẫn file.
  • *_dir: đường dẫn thư mục.
  • target: file hoặc thư mục đầu ra linh hoạt.

Tài liệu chi tiết

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-2.0.1.tar.gz (2.0 MB view details)

Uploaded Source

Built Distributions

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

klygo-2.0.1-cp313-cp313-win_amd64.whl (560.4 kB view details)

Uploaded CPython 3.13Windows x86-64

klygo-2.0.1-cp312-cp312-win_amd64.whl (560.4 kB view details)

Uploaded CPython 3.12Windows x86-64

File details

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

File metadata

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

File hashes

Hashes for klygo-2.0.1.tar.gz
Algorithm Hash digest
SHA256 22ce2f583d110b6a0fecb3499da0c54115790f202b124f830b4755b77198b272
MD5 f7db825efc6436b7cded3310cd4217da
BLAKE2b-256 e51c40edca017a7bc684d7e7abf620e38ee6763c794eac18b285f88c3b9a949c

See more details on using hashes here.

File details

Details for the file klygo-2.0.1-cp313-cp313-win_amd64.whl.

File metadata

  • Download URL: klygo-2.0.1-cp313-cp313-win_amd64.whl
  • Upload date:
  • Size: 560.4 kB
  • Tags: CPython 3.13, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.13

File hashes

Hashes for klygo-2.0.1-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 f70b95231fc06ee3eb228b86dbedda4b8ba74fe2011b58d633f063787be565d0
MD5 5c3fce9be0a0d4a98964dd543a445a91
BLAKE2b-256 3bd589499a4ae7d4299b07ed2748f1e9a015ac5585bc8ccc4d71e9edaaa06702

See more details on using hashes here.

File details

Details for the file klygo-2.0.1-cp312-cp312-win_amd64.whl.

File metadata

  • Download URL: klygo-2.0.1-cp312-cp312-win_amd64.whl
  • Upload date:
  • Size: 560.4 kB
  • Tags: CPython 3.12, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.13

File hashes

Hashes for klygo-2.0.1-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 4b1361209b9d814b924f1321b00cdbae75d2cde7b01b762b0a190471bb15afae
MD5 d713be94baccaf2149c73b2b0ff408eb
BLAKE2b-256 5fe0d775402e994f19c8663a7c6aee81f75dff2e9cd43231d0b2e12bef8c4b4e

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