kano-cv


Namekano-cv JSON
Version 1.12.2 PyPI version JSON
download
home_pageNone
SummaryHelpful functions for Computer Vision tasks
upload_time2024-04-04 13:17:01
maintainerNone
docs_urlNone
authorNone
requires_python>=3.9
licenseCopyright (c) 2012-2024 Scott Chacon and others Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
keywords computer vision
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # 🦌 Kano - Tools for Computer Vision Tasks

[![Kano CI](https://github.com/egliette/kano/actions/workflows/python-app.yml/badge.svg)](https://github.com/egliette/kano/actions/workflows/python-app.yml)

**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](https://pypi.org/project/kano-cv/) is available on PyPI. You can install it by running the following command in your terminal:

```bash
pip install kano-cv
```

## 🚀 Usage

- Computer vision tasks:
    - Object Detection (In progress)
    - Object Segmentation (In progress)
    - [YOLO Datasets Splitting/Merging](#yolo-datasets-splittingmerging)
- [Files/Folders Manipulating](#filesfolders-manipulating)
- [Images Processing](#images-processing)
- [Videos Processing](#videos-processing)

### 🗃️ YOLO Datasets Splitting/Merging

**Test these utilities here:** [![Open in Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/drive/1f8H-QzypOlpzA6sUR0WF3IGxtY6xmF1U?usp=sharing)

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:

```python
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:

```python
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](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/drive/1878V0IPa36bsTwPTk5NQSszF7UAyJ9Wq?usp=sharing)

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

```python
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:

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

### 🖼️ Images Processing

**Test these utilities here:** [![Open in Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/drive/181jZX3PNylk0Ry133e9ZH5k2vlPV9zxW?usp=sharing)

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

```python
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:

```python
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](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/drive/1pqHmUHHTnmIfACupcLr_em3PdXNnGOkp?usp=sharing)

**Kano** helps you extract images from a video. For demo purposes, I will download a video from YouTube using [pytube](https://github.com/pytube/pytube). If you find this function helpful, please give a star to [the original repo](https://github.com/pytube/pytube).

```python
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) license.

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "kano-cv",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.9",
    "maintainer_email": null,
    "keywords": "computer vision",
    "author": null,
    "author_email": "egliette <leminhtu74@gmail.com>",
    "download_url": "https://files.pythonhosted.org/packages/23/6c/4c0f8b3753b87fed2f37888fdc0e8723cf27a0e48cbc295953c137f055ce/kano-cv-1.12.2.tar.gz",
    "platform": null,
    "description": "# \ud83e\udd8c Kano - Tools for Computer Vision Tasks\n\n[![Kano CI](https://github.com/egliette/kano/actions/workflows/python-app.yml/badge.svg)](https://github.com/egliette/kano/actions/workflows/python-app.yml)\n\n**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.\n\n## \ud83d\udce5 Installation\n\n[The latest released version](https://pypi.org/project/kano-cv/) is available on PyPI. You can install it by running the following command in your terminal:\n\n```bash\npip install kano-cv\n```\n\n## \ud83d\ude80 Usage\n\n- Computer vision tasks:\n    - Object Detection (In progress)\n    - Object Segmentation (In progress)\n    - [YOLO Datasets Splitting/Merging](#yolo-datasets-splittingmerging)\n- [Files/Folders Manipulating](#filesfolders-manipulating)\n- [Images Processing](#images-processing)\n- [Videos Processing](#videos-processing)\n\n### \ud83d\uddc3\ufe0f YOLO Datasets Splitting/Merging\n\n**Test these utilities here:** [![Open in Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/drive/1f8H-QzypOlpzA6sUR0WF3IGxtY6xmF1U?usp=sharing)\n\nIf 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:\n\n```python\nfrom kano.complex.roboflow import merge_datasets\n\n\n# Each dataset folder contains two folders \"images\" and \"labels\"\nfolders = [\n    \"Dataset_1\",\n    \"Dataset_2\",\n]\n\nmerge_datasets(folders, merged_folder_path=\"dataset\")\n```\n\nYou can also split a dataset into train/valid/test with your own split ratio with only one command:\n\n```python\nfrom kano.complex.roboflow import split_dataset\n\n\n# Split a dataset (contains \"images\" and \"labels\")\n# into train, valid, test folders with a given ratio\nsplit_dataset(\n    dataset_path=\"dataset/train\",\n    train_percent=80,\n    valid_percent=20,\n    target_folder=\"splitted_dataset\",\n)\n```\n\n### \ud83d\udcc1 Files/Folders Manipulating\n\n**Test these utilities here:** [![Open in Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/drive/1878V0IPa36bsTwPTk5NQSszF7UAyJ9Wq?usp=sharing)\n\n**Kano** is designed to run many common functions in just one line:\n\n```python\nfrom kano.file_utils import create_folder, print_foldertree, remove_folder\n\n# Create a folder and its subfolder without errors\ncreate_folder(\"folder_A/subfolder\")\n\nfor i in range(2):\n    with open(f\"folder_A/subfolder/file_{i}.txt\", \"w\") as f:\n        pass\n\nprint_foldertree(\"folder_A\")\n# folder_A (2 files)\n# |-- subfolder (2 files)\n\n# Remove a folder with its content without errors\nremove_folder(\"folder_A/subfolder\")\n```\n\nYou can even zip many folders (and files) by providing their paths and the destination path in a function call:\n\n```python\nzip_paths([\"folder_A\", \"folder_B\"], \"zipfile.zip\")\n```\n\n### \ud83d\uddbc\ufe0f Images Processing\n\n**Test these utilities here:** [![Open in Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/drive/181jZX3PNylk0Ry133e9ZH5k2vlPV9zxW?usp=sharing)\n\nYou can quickly download an image using a URL and show it in IPython notebooks or Python files:\n\n```python\nfrom kano.image_utils import download_image, show_image\n\n\nimage = download_image(\"https://avatars.githubusercontent.com/u/77763935?v=4\", \"image.jpg\")\n\n# using a numpy array\nshow_image(image)\n\n# using a file path\nshow_image(\"image.jpg\")\n```\n\nor you can get a random image with a specific size:\n\n```python\nfrom kano.image_utils import get_random_picture\n\n\nimage = get_random_picture(width=400, height=300, save_path=\"random_image.jpg\")\n\n# using a numpy array\nshow_image(image)\n\n# using a file path\nshow_image(\"random_image.jpg\")\n```\n\n### \ud83c\udf9e\ufe0f Videos Processing\n\n**Test these utilities here:** [![Open in Colab](https://colab.research.google.com/assets/colab-badge.svg)](https://colab.research.google.com/drive/1pqHmUHHTnmIfACupcLr_em3PdXNnGOkp?usp=sharing)\n\n**Kano** helps you extract images from a video. For demo purposes, I will download a video from YouTube using [pytube](https://github.com/pytube/pytube). If you find this function helpful, please give a star to [the original repo](https://github.com/pytube/pytube).\n\n```python\nfrom kano.video_utils import download_youtube_video, extract_frames\n\n\ndownload_youtube_video(\"https://www.youtube.com/watch?v=<VIDEOID>\", \"video.mp4\")\n\n# Get 1 image per 2 seconds\nextract_frames(\n    video_path=\"video.mp4\",\n    target_folder=\"frames\",\n    seconds_interval=2,\n)\n```\n\n## \ud83d\ude4b\u200d\u2642\ufe0f Contributing to Kano\n\nAll 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.\n\n## \ud83d\udd11 License\nKano is licensed under the [MIT](LICENSE) license.\n",
    "bugtrack_url": null,
    "license": "Copyright (c) 2012-2024 Scott Chacon and others  Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the \"Software\"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:  The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.  THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ",
    "summary": "Helpful functions for Computer Vision tasks",
    "version": "1.12.2",
    "project_urls": {
        "Github": "https://github.com/egliette/kano"
    },
    "split_keywords": [
        "computer",
        "vision"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "b038496aadfca686302d6ba9d595bf9ce63e65bacd77294c6e2070e2fc254c0e",
                "md5": "60a2e236536035ba324b0baeff74988e",
                "sha256": "f00fa3e1cdd32df94178cad49de19f96dd137ce383702252c1ae2e96dfba7543"
            },
            "downloads": -1,
            "filename": "kano_cv-1.12.2-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "60a2e236536035ba324b0baeff74988e",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.9",
            "size": 13869,
            "upload_time": "2024-04-04T13:16:59",
            "upload_time_iso_8601": "2024-04-04T13:16:59.634327Z",
            "url": "https://files.pythonhosted.org/packages/b0/38/496aadfca686302d6ba9d595bf9ce63e65bacd77294c6e2070e2fc254c0e/kano_cv-1.12.2-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "236c4c0f8b3753b87fed2f37888fdc0e8723cf27a0e48cbc295953c137f055ce",
                "md5": "50d5efe51e15aa86c0950ccf0fb89c5b",
                "sha256": "7c2bc59a0c682d78e9096232a81fbf84013ff6b0168b785b3db733625f9bb19d"
            },
            "downloads": -1,
            "filename": "kano-cv-1.12.2.tar.gz",
            "has_sig": false,
            "md5_digest": "50d5efe51e15aa86c0950ccf0fb89c5b",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.9",
            "size": 14584,
            "upload_time": "2024-04-04T13:17:01",
            "upload_time_iso_8601": "2024-04-04T13:17:01.399573Z",
            "url": "https://files.pythonhosted.org/packages/23/6c/4c0f8b3753b87fed2f37888fdc0e8723cf27a0e48cbc295953c137f055ce/kano-cv-1.12.2.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-04-04 13:17:01",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "egliette",
    "github_project": "kano",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "kano-cv"
}
        
Elapsed time: 0.22403s