Skip to main content

pycvt is a Python package designed for computer vision utilities, including YOLO annotation handling, image manipulation, bounding box plotting, and data conversion tools.

Project description

pycvt

Install

pip install pycvt --upgrade

dev

uv sync

Usage

from pycvt import (
    load_yolo_annotations,
    save_yolo_annotations,
    load_yolo_names,
    draw_bounding_boxes,
    xyxy2xywh,
    xywh2xyxy,
    xyxy2xywhn,
    xywhn2xyxy,
    box_iou,
    generate_sliding_windows,
    crop_with_bbox,
    sliding_crop,
    scale_boxes,
    get_color,
    example_file,
)

"load_yolo_annotations", # to load yolo format annotations from a file
"save_yolo_annotations", # to save yolo format annotations to a file
"load_yolo_names",      # to load class names from a yolo names file
"draw_bounding_boxes",  # to draw bounding boxes on an image
"xyxy2xywh",            # convert bounding box from (x1, y1, x2, y2) to (x_center, y_center, width, height)
"xywh2xyxy",            # convert bounding box from (x_center, y_center, width, height) to (x1, y1, x2, y2)
"xyxy2xywhn",           # convert bounding box from (x1, y1, x2, y2) to normalized (x_center, y_center, width, height)
"xywhn2xyxy",           # convert bounding box from normalized (x_center, y_center, width, height) to (x1, y1, x2, y2)
"box_iou",              # calculate Intersection over Union (IoU) between two sets of boxes
"generate_sliding_windows",  # generate sliding window coordinates for an image
"crop_with_bbox",         # crop image regions with bounding boxes and adjust boxes accordingly
"sliding_crop",         # crop an image using sliding windows
"scale_boxes",          # scale bounding boxes by a factor
"get_color",             # get a color for a given class id
"example_file",            # one example file for testing purposes  

YOLO Predict CLI

集成后的数据集预测工具可以直接通过 pycvt 使用:

pip install -e .[yolo-predict]
pycvt-yolo-predict --config demo.yaml

也可以在代码里调用:

from pycvt.tools.predict_config import load_predict_config
from pycvt.tools.yolo_dataset import predict_dataset

config = load_predict_config("demo.yaml")
predict_dataset(config, "demo.yaml")

配置格式示例:

dataset: /path/to/dataset.yaml

prediction_store:
  root: predictions
  run: xxx-model
  plot: true

model:
  name: yolov8det
  weights: /models/xxx-model.torchscript
  conf: 0.25
  iou: 0.45
  classes: null
  imgsz: 640
  half: true
  nc: null

ray:
  num_actors: null
  num_cpus: 2.0
  gpus_per_actor: 0.25

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

pycvt-0.0.1.post202606050006.tar.gz (18.9 kB view details)

Uploaded Source

Built Distribution

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

pycvt-0.0.1.post202606050006-py3-none-any.whl (21.4 kB view details)

Uploaded Python 3

File details

Details for the file pycvt-0.0.1.post202606050006.tar.gz.

File metadata

  • Download URL: pycvt-0.0.1.post202606050006.tar.gz
  • Upload date:
  • Size: 18.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.19 {"installer":{"name":"uv","version":"0.11.19","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for pycvt-0.0.1.post202606050006.tar.gz
Algorithm Hash digest
SHA256 c3c23d30118337ee2ed96e12a6d046ca6d9914eb9bd38031f96b0771ae4720bc
MD5 7feb6aaf72ea6c3c90447ccd593392be
BLAKE2b-256 4d01e24585d34aa2d965160e484b3ef5b0668ca7b08a131ac67354a26d54aed7

See more details on using hashes here.

File details

Details for the file pycvt-0.0.1.post202606050006-py3-none-any.whl.

File metadata

  • Download URL: pycvt-0.0.1.post202606050006-py3-none-any.whl
  • Upload date:
  • Size: 21.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.11.19 {"installer":{"name":"uv","version":"0.11.19","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for pycvt-0.0.1.post202606050006-py3-none-any.whl
Algorithm Hash digest
SHA256 f11062ef4b3c5e593d56fe349749a59b9ee12b40cd88c77c646a67dc8fbe1f0d
MD5 b0387c2bcb2c94c2095a03e5ab6fda8d
BLAKE2b-256 524e5cd1c8e91012d71aac4b15906edf1e302469f1d29ddee6831b9086f3f22c

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