Skip to main content

Helpful functions for Computer Vision tasks

Project description

🦌 Kano - Tools for Computer Vision Tasks

Kano CI

Kano is a Python package providing utility functions for Computer Vision tasks. Its primary focus is simplifying lengthy functions, allowing developers to concentrate more on the main processes.

📥 Installation

The latest released version is available on PyPI. You can install it by running the following command in your terminal:

pip install kano-cv

🚀 Usage

🗃️ YOLO Datasets Splitting/Merging

Test these utilities here: Open in Colab

If you are using Roboflow to label and struggling to merge many Workspaces or YOLO format projects, Kano provides a utility to merge them with just one command:

from kano.complex.roboflow import merge_datasets


# Each dataset folder contains two folders "images" and "labels"
folders = [
    "Dataset_1",
    "Dataset_2",
]

merge_datasets(folders, merged_folder_path="dataset")

You can also split a dataset into train/valid/test with your own split ratio with only one command:

from kano.complex.roboflow import split_dataset


# Split a dataset (contains "images" and "labels")
# into train, valid, test folders with a given ratio
split_dataset(
    dataset_path="dataset/train",
    train_percent=80,
    valid_percent=20,
    target_folder="splitted_dataset",
)

📁 Files/Folders Manipulating

Test these utilities here: Open in Colab

Kano is designed to run many common functions in just one line:

from kano.file_utils import create_folder, print_foldertree, remove_folder

# Create a folder and its subfolder without errors
create_folder("folder_A/subfolder")

for i in range(2):
    with open(f"folder_A/subfolder/file_{i}.txt", "w") as f:
        pass

print_foldertree("folder_A")
# folder_A (2 files)
# |-- subfolder (2 files)

# Remove a folder with its content without errors
remove_folder("folder_A/subfolder")

You can even zip many folders (and files) by providing their paths and the destination path in a function call:

zip_paths(["folder_A", "folder_B"], "zipfile.zip")

🖼️ Images Processing

Test these utilities here: Open in Colab

You can quickly download an image using a URL and show it in IPython notebooks or Python files:

from kano.image_utils import download_image, show_image


image = download_image("https://avatars.githubusercontent.com/u/77763935?v=4", "image.jpg")

# using a numpy array
show_image(image)

# using a file path
show_image("image.jpg")

or you can get a random image with a specific size:

from kano.image_utils import get_random_picture


image = get_random_picture(width=400, height=300, save_path="random_image.jpg")

# using a numpy array
show_image(image)

# using a file path
show_image("random_image.jpg")

🎞️ Videos Processing

Test these utilities here: Open in Colab

Kano helps you extract images from a video. For demo purposes, I will download a video from YouTube using pytube. If you find this function helpful, please give a star to the original repo.

from kano.video_utils import download_youtube_video, extract_frames


download_youtube_video("https://www.youtube.com/watch?v=<VIDEOID>", "video.mp4")

# Get 1 image per 2 seconds
extract_frames(
    video_path="video.mp4",
    target_folder="frames",
    seconds_interval=2,
)

🙋‍♂️ Contributing to Kano

All contributions, bug reports, bug fixes, enhancements, and ideas are welcome. Feel free to create pull requests or issues so that we can improve this library together.

🔑 License

Kano is licensed under the MIT license.

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

kano-cv-1.9.1.tar.gz (11.3 kB view details)

Uploaded Source

Built Distribution

kano_cv-1.9.1-py3-none-any.whl (10.2 kB view details)

Uploaded Python 3

File details

Details for the file kano-cv-1.9.1.tar.gz.

File metadata

  • Download URL: kano-cv-1.9.1.tar.gz
  • Upload date:
  • Size: 11.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/4.0.2 CPython/3.11.8

File hashes

Hashes for kano-cv-1.9.1.tar.gz
Algorithm Hash digest
SHA256 e0f3499daca306aca6e8586c9b4c6ad5011e608738a5edcbfac29e2294bdebf9
MD5 c8a94749c39ada5ff5c92ec60d2c2dd9
BLAKE2b-256 c0656a2e07810ee93f8537d7656e017c6e73af55effc740406c7471bd7c0ef1c

See more details on using hashes here.

File details

Details for the file kano_cv-1.9.1-py3-none-any.whl.

File metadata

  • Download URL: kano_cv-1.9.1-py3-none-any.whl
  • Upload date:
  • Size: 10.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/4.0.2 CPython/3.11.8

File hashes

Hashes for kano_cv-1.9.1-py3-none-any.whl
Algorithm Hash digest
SHA256 d2faa80a7e11d3bf3fe8afa987f5d7699b9d8a5416a9aa36b2e203afb5279b00
MD5 bbbbb063e9cdbcedcf2f4fefa29224c4
BLAKE2b-256 a7581a1a50c41bf949acad9dbbbd7243fca1833b336703b071d3735b26f371f3

See more details on using hashes here.

Supported by

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