Skip to main content

Customized library for preprocessing images

Project description

Library: img-preprocess-pipeline

Python TensorFlow NumPy Matplotlib

GitHub License GitHub Commits

📋 Table of Contents

  1. 📖 Project description
  2. 🔨 Installation
  3. ⚙️ Functions
  4. Author and contact
  5. ©️ License

📖 Project description

The img-preprocess-pipeline package provides a comprehensive solution for loading, displaying, and preprocessing images, streamlining their use in machine learning projects. Its features include:

  • Image Loading: Import images from various sources and formats.
  • Image Displaying: Quickly and intuitively visualize images.
  • Image Preprocessing: Prepare images for use in machine learning models through:
    • Reshaping: Adjust the dimensions of images as needed.
    • Normalization: Scale pixel values to a specific range, enhancing model performance.
    • Data Augmentation: Apply techniques to expand the dataset and increase model robustness.

This package aims to simplify and automate image preprocessing steps, optimizing the workflow in machine learning projects, the library link can be found here.

🔨 Installation

Use the package manager pip to install img-preprocess-pipeline

pip install img-preprocess-pipeline

Import

from image_preprocessing.preprocessing import tools, pipeline
from image_preprocessing.utils import io, display_images

⚙️ Functions

Load image

image_path = "your_image.png"
io.load_image(image_path,grayscale=False)
  • Input:

    • image_path: directory of image
    • grayscale: load image with grayscale or RGB
  • Output:

    • image (PIL Jpeg)

Description:

Load the image from the directory in scale RGB (with grayscale=False) and returns a tensor array.

Output example:

alt text


Save image

io.save_image(image,save_path) 
  • Input:

    • image: choosen image file
    • save_path: directory to save the image
  • Output:

    • None

Description:

Saves a image converting into a numpy array.


Reshape image

tools.reshape_image(image)
  • Input:
    • image or dict: {title_of_image: image}
  • Output:
    • dict: {'Reshaped': reshaped_image}

Description:

Reshapes a image and returns a dictionary with the title "Reshaped" and the resulting image.

Output example:

alt text


Scaling image

tools.scale_image(image)
  • Input:
    • image or dict: {title_of_image:image}
  • Output:
    • dict: {'Scaled':scaled_image}

Description: Scales a image (with range 0 to 1) and returns a dictionary with the title "Scaled" and the resulting image"""

Output example:

alt text


Random augumentation

tools.random_augumentation(image)
  • Input:
    • image or dict: {title_of_image:image}
  • Output:
    • dict: {'Augumented image':augumented_image}

Description: Create a new image modifying the saturation, brightness and rotation (in a random approach) of the original image and returns a dictionary with the title "Augumented image" and the resulting image.

Output example:

alt text


Preprocessing pipeline

pipeline.preprocess_pipeline(image) 
  • Input:
    • image or dict: {title_of_image:image}
  • Output:
    • dict: {'Preprocessed':preprocessed_image}

Description:

Create a new image using all the other functions in "tools" in combined into a pipeline. Returns a dictionary with the title "Preprocessed" and the resulting image.

Output example:

alt text


Display images

display_images.plot_images(image,image1,...,image_x) 
  • Input:

    • dict of multiple images files. Ex:
      image1_with_label={'Original': image1}
      
  • Output:

    • None

Description:

Displays the images and the respective labels of the images (Scaled,Preprocessed...) in a matrix of images with shape of (1,X) images.

Output example:

alt text

☕ Author and contact

Pablo Francisco Melo Bezerra

Linkedin

©️ License

MIT

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

img-preprocess-pipeline-0.0.2.tar.gz (5.3 kB view details)

Uploaded Source

Built Distribution

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

img_preprocess_pipeline-0.0.2-py3-none-any.whl (6.6 kB view details)

Uploaded Python 3

File details

Details for the file img-preprocess-pipeline-0.0.2.tar.gz.

File metadata

  • Download URL: img-preprocess-pipeline-0.0.2.tar.gz
  • Upload date:
  • Size: 5.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.10.11

File hashes

Hashes for img-preprocess-pipeline-0.0.2.tar.gz
Algorithm Hash digest
SHA256 004da1948177ac4d359aebec19ecb2e53ed9b87e41bb9356a6c2d5f74dcbb70b
MD5 780380a32eb499e9c7412625cbed7c0b
BLAKE2b-256 7930a58c5d1f934984d811a9e4ec3aefe57ac4b04b3d1751cd5f503370568d68

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for img_preprocess_pipeline-0.0.2-py3-none-any.whl
Algorithm Hash digest
SHA256 acd8661ebafef33afac5aaf5bce685a27dfa58f4941dc4125f189eb73da71ca2
MD5 8f02d01cbf68ec14cad229ecbe94f933
BLAKE2b-256 730bd63d3e27720845db484f54b24ae0c60483381381191b5d9ffc19b9ba3444

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