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.1.tar.gz (4.1 kB view details)

Uploaded Source

Built Distribution

modeyolo-0.1.1-py3-none-any.whl (4.5 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: modeyolo-0.1.1.tar.gz
  • Upload date:
  • Size: 4.1 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.1.tar.gz
Algorithm Hash digest
SHA256 3229f1859ae221cb9e70c3624088d21e178b899bdb5312e49129c3f6d31be756
MD5 da34fb5ba85a9740808d5f9e86177ff1
BLAKE2b-256 f62e7dd34629ea9e9f3457ad0f3041df6461d191b19a99fc539fd1674e56267c

See more details on using hashes here.

File details

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

File metadata

  • Download URL: modeyolo-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 4.5 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.1-py3-none-any.whl
Algorithm Hash digest
SHA256 215588fd0caa586f622ad0d03ec2a15e07b79d7150dddd49ac4bdb73da4ef5d6
MD5 d684d21a99ea9931a60b147021d42181
BLAKE2b-256 0331b6e08be651c664ac25dbf1f960f008ab0aab6a8a6a314afb804565b46097

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