Skip to main content

ModeYOLO is a versatile Python package designed for efficient color space transformations and simplified dataset modification for deep learning applications. Seamlessly integrating into your workflow, this package empowers users to effortlessly perform diverse color operations and streamline the creation of modified datasets, enhancing the flexibility and convenience of machine learning model training processes.

Project description

ModeYOLO Python Package

Introduction

ModeYOLO is a Python package designed to perform color space transformations on images and facilitate the creation of modified datasets for training deep learning models. The package consists of two main modules: ColorOperation.py and Operation.py.

Folder Structure

Before using the package, ensure that your source dataset follows the following folder structure:

dataset/
|-- train/
|   |-- images/
|   |-- labels/
|-- test/
|   |-- images/
|   |-- labels/
|-- val/
|   |-- images/
|   |-- labels/
|-- data.yaml

ColorOperation Module (ColorOperation.py)

Class: colorcng

Constructor

def __init__(self, path: str, mode: str = 'all') -> None:
    """
    Initializes the colorcng object.

    Parameters:
    - path: str, path to the target directory.
    - mode: str, mode of operation ('all', 'rgb', 'bgr', 'gray', 'hsv', 'crcb', 'lab').
    """

Methods

  1. cng_rgb

    def cng_rgb(self, opt: str, img: np.ndarray, idx: int | str = 0) -> None:
        """
        Converts the image to RGB color space.
    
        Parameters:
        - opt: str, operation type ('train', 'test', 'val').
        - img: np.ndarray, input image.
        - idx: int | str, index for the output file name.
        """
    
  2. cng_bgr

    def cng_bgr(self, opt: str, img: np.ndarray, idx: int | str = 0) -> None:
        """
        Saves the image in BGR color space.
    
        Parameters:
        - opt: str, operation type ('train', 'test', 'val').
        - img: np.ndarray, input image.
        - idx: int | str, index for the output file name.
        """
    
  3. cng_gray

    def cng_gray(self, opt: str, img: np.ndarray, idx: int | str = 0) -> None:
        """
        Converts the image to grayscale.
    
        Parameters:
        - opt: str, operation type ('train', 'test', 'val').
        - img: np.ndarray, input image.
        - idx: int | str, index for the output file name.
        """
    
  4. cng_hsv

    def cng_hsv(self, opt: str, img: np.ndarray, idx: int | str = 0) -> None:
        """
        Converts the image to HSV color space.
    
        Parameters:
        - opt: str, operation type ('train', 'test', 'val').
        - img: np.ndarray, input image.
        - idx: int | str, index for the output file name.
        """
    
  5. cng_crcb

    def cng_crcb(self, opt: str, img: np.ndarray, idx: int | str = 0) -> None:
        """
        Converts the image to YCrCb color space.
    
        Parameters:
        - opt: str, operation type ('train', 'test', 'val').
        - img: np.ndarray, input image.
        - idx: int | str, index for the output file name.
        """
    
  6. cng_lab

    def cng_lab(self, opt: str, img: np.ndarray, idx: int | str = 0) -> None:
        """
        Converts the image to LAB color space.
    
        Parameters:
        - opt: str, operation type ('train', 'test', 'val').
        - img: np.ndarray, input image.
        - idx: int | str, index for the output file name.
        """
    
  7. execute

    def execute(self, opt: str, file: str, idx: int | str = 0) -> None:
        """
        Executes the specified color space transformation.
    
        Parameters:
        - opt: str, operation type ('train', 'test', 'val').
        - file: str, path to the input image.
        - idx: int | str, index for the output file name.
        """
    

Operation Module (Operation.py)

Class: InitOperation

Constructor

def __init__(self, target_directory: str = 'modified_dataset', src_directory: str = 'dataset', mode: str = 'all') -> None:
    """
    Initializes the InitOperation object.

    Parameters:
    - target_directory: str, path to the target directory.
    - src_directory: str, path to the source dataset directory.
    - mode: str, mode of operation ('all', 'rgb', 'bgr', 'gray', 'hsv', 'crcb', 'lab').
    """

Methods

  1. start_train

    def start_train(self) -> None:
        """
        Creates the modified training dataset.
        """
    
  2. start_test

    def start_test(self) -> None:
        """
        Creates the modified testing dataset.
        """
    
  3. start_val

    def start_val(self) -> None:
        """
        Creates the modified validation dataset.
        """
    
  4. reform_dataset

    def reform_dataset(self) -> None:
        """
        Reformats the entire dataset.
        """
    

Example Usage

# Import the InitOperation class
from ModeYOLO.Operation import InitOperation

# Create an InitOperation object
init_op = InitOperation(target_directory='modified_dataset', src_directory='dataset', mode='all')

# Create the modified dataset
init_op.reform_dataset()

This example assumes that the source dataset is structured according to the specified folder structure. Adjust the paths and parameters accordingly based on your dataset structure.

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

modeyolo-0.1.2.tar.gz (4.8 kB view details)

Uploaded Source

Built Distribution

modeyolo-0.1.2-py3-none-any.whl (5.3 kB view details)

Uploaded Python 3

File details

Details for the file modeyolo-0.1.2.tar.gz.

File metadata

  • Download URL: modeyolo-0.1.2.tar.gz
  • Upload date:
  • Size: 4.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.7.1 CPython/3.10.11 Windows/10

File hashes

Hashes for modeyolo-0.1.2.tar.gz
Algorithm Hash digest
SHA256 fbc58be0b24cd4bb5cd0cfa3ecbf5c7b59607629f4a27c88997d2404648ecaa0
MD5 6861bc4e4a7a582f80e7249d720e7842
BLAKE2b-256 83f1d1c4bc435052771a85ef111e4a9f9912cffd2cddf8173eaa6ee3e7be0849

See more details on using hashes here.

File details

Details for the file modeyolo-0.1.2-py3-none-any.whl.

File metadata

  • Download URL: modeyolo-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 5.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.7.1 CPython/3.10.11 Windows/10

File hashes

Hashes for modeyolo-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 5abea3ebda3cf33cda8c871eb6f2e729b8546ac1d571dd490f9990906a7ef0dd
MD5 94e704430619477df7e7b30419e2abc5
BLAKE2b-256 f6ce45eef0e03772b1976963e3a9a0f8bb3d9d9a7f27cc73a80999b8372f3eaf

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