Skip to main content

Define preprocessing pipelines using nested callable functions and parameter grids for them.

Project description

Auto-Preprocessing for Computer Vision

This Python module helps you automate the selection of the best preprocessing pipeline for your computer vision tasks. It uses a combination of parameter grid search, interactive visualization, and caching to efficiently find and apply optimal preprocessing steps to your images.

Features

  • Define Multiple Pipelines: Create and store multiple preprocessing pipelines, each with different sequences of cv2 functions and a range of parameter values.
  • Grid Search: The module performs an exhaustive grid search across all defined pipelines and parameter combinations.
  • Interactive Visualization: A user-friendly image selector allows you to visually compare the results of different preprocessing steps and choose the best one.
  • Caching: The module caches the results of the search process, so repeated runs with the same pipelines and image will be much faster.
  • Preprocessor Construction: Once the best pipeline is selected, the module automatically constructs a Preprocessor object that you can use to apply the optimal preprocessing to new images.

Installation

  1. Git Clone: Clone this repository into your working directory:

    git clone https://github.com/Kalmy8/auto_preprocessing
    
  2. Requirements: Make sure you have the required libraries installed:

    pip install -r requirements.txt
    

Alternatively:

  1. Install as package using pip:

    pip install prepCV
    
  2. Import dependencies:

    from prepCV import PipelineDescription, PipelineManager
    # This classes usage cases are provided below
    

Usage

  1. Define Pipelines: Create PipelineDescription objects to define your preprocessing pipelines.

    import cv2
    from .auto_preprocessing.prepCV import PipelineDescription, PipelineManager
    
    pipeline1 = PipelineDescription({
        cv2.cvtColor: {'code': [cv2.COLOR_BGR2GRAY]},
        cv2.adaptiveThreshold: {
            'maxValue': [255],
            'adaptiveMethod': [cv2.ADAPTIVE_THRESH_MEAN_C], 
            # ... other parameters ...
        },
        # ... other cv2 functions ...
    })
    
    pipeline2 = PipelineDescription({
        # ... define another pipeline ...
    })
    
  2. Add Pipelines to Manager:

    pipeline_manage = PipelineManager()
    pipeline_manage.add_pipeline(pipeline1)
    pipeline_manage.add_pipeline(pipeline2) 
    
  3. Run Search:

    # Load your image
    image = cv2.imread('your_image.jpg')
    
    # Run the search and select the best preprocessor
    pipeline_manage.run_search(image, 'GridSearch') 
    
    # Get the best preprocessor
    best_preprocessor = pipeline_manage.get_best_preprocessor()
    
  4. Use the Preprocessor:

    processed_image = best_preprocessor.process(new_image)
    # Now you can use the `processed_image` for your tasks. 
    

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

prepcv-0.0.2.tar.gz (13.9 kB view details)

Uploaded Source

Built Distribution

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

prepcv-0.0.2-py3-none-any.whl (13.9 kB view details)

Uploaded Python 3

File details

Details for the file prepcv-0.0.2.tar.gz.

File metadata

  • Download URL: prepcv-0.0.2.tar.gz
  • Upload date:
  • Size: 13.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.9.19

File hashes

Hashes for prepcv-0.0.2.tar.gz
Algorithm Hash digest
SHA256 e10b596f44393d1d935f73db9da1024d16fa62fa5b761ae885461026c289b500
MD5 bc1f5486e050cc61e16fd815ff2faeb6
BLAKE2b-256 81ad44f0d2da83ecbc8a8c45bbe6d7a3d85476c948a4f28c74cb76f2c7ce85d3

See more details on using hashes here.

File details

Details for the file prepcv-0.0.2-py3-none-any.whl.

File metadata

  • Download URL: prepcv-0.0.2-py3-none-any.whl
  • Upload date:
  • Size: 13.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.9.19

File hashes

Hashes for prepcv-0.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 44c2c286390a7c24ad8d8d186f5d6b6b7185881e7ea0f9b98a2d6bb153674cbe
MD5 98d85d9f793490bc1b925dec0a7b2217
BLAKE2b-256 d0b170f33df08c46c603ce22a5f2ddd387f8246ebbb82775fa6c073a9e2a4e77

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