Skip to main content

imgshape — image shape detection, dataset analysis, preprocessing & augmentation recommendations, reports and PyTorch loader helpers

Project description

🖼️ imgshape — Smart Image Analysis & Preprocessing Toolkit (v2.1.3)

imgshape is a Python toolkit for image shape detection, dataset inspection, preprocessing & augmentation recommendations, visualization, report generation, and PyTorch DataLoader helpers — making it a smarter dataset assistant for ML/DL workflows.

imgshape demo PyPI Downloads

⚡️ Why use imgshape?

  • 📐 Detect image shapes (H × W × C) for single files or whole datasets.
  • 🔍 Compute entropy, edge density, dominant color, and guess image type.
  • 🧠 Get preprocessing recommendations (resize, normalization, suitable model family).
  • 🔄 Augmentation recommender: suggest flips, crops, color jitter, etc., based on dataset stats.
  • 📊 Visualizations: size histograms, dimension scatter plots, channel distribution.
  • Model compatibility checks: verify dataset readiness for models like mobilenet_v2, resnet18, etc.
  • 📝 Dataset reports: export Markdown/HTML/PDF with stats, plots, preprocessing, and augmentation plans.
  • 🔗 Torch integration: generate ready-to-use torchvision.transforms or even a DataLoader.
  • 🌐 GUI mode: run a Gradio app for point-and-click analysis.

🚀 Installation

pip install imgshape

Requires Python 3.8+ Core deps: Pillow, numpy, matplotlib, scikit-image, gradio Optional extras:

  • imgshape[torch] → PyTorch / torchvision support
  • imgshape[pdf] → PDF report generation (weasyprint)
  • imgshape[viz] → prettier plots (seaborn)

💻 CLI Usage

# Shape detection
imgshape --path ./sample.jpg --shape

# Single image analysis
imgshape --path ./sample.jpg --analyze

# Preprocessing + augmentations
imgshape --path ./sample.jpg --recommend --augment

# Dataset compatibility check
imgshape --dir ./images --check mobilenet_v2

# Dataset visualization
imgshape --viz ./images

# Dataset report (md + html)
imgshape --path ./images --report --augment --report-format md,html --out report

# Torch integration (transform/DataLoader)
imgshape --path ./images --torchloader --augment --out transform_snippet.py

# Launch Gradio GUI
imgshape --web

📦 Python API

from imgshape.shape import get_shape
from imgshape.analyze import analyze_type
from imgshape.recommender import recommend_preprocessing
from imgshape.augmentations import AugmentationRecommender

print(get_shape("sample.jpg"))
print(analyze_type("sample.jpg"))
print(recommend_preprocessing("sample.jpg"))

# Augmentation plan
ar = AugmentationRecommender(seed=42)
plan = ar.recommend_for_dataset({"entropy_mean": 6.2, "image_count": 100})
print(plan.recommended_order)

📝 New in v2.1.3

  • 🔄 Augmentation recommender (--augment, augmentations.py)
  • 📝 Dataset report generator (--report, Markdown/HTML/PDF export)
  • 🔗 TorchLoader integration (--torchloader, to_dataloader, to_torch_transform)
  • 📊 Improved visualizations (works even for 1-image datasets)
  • 🌐 Modernized GUI with analysis + recommendations tabs

📎 Resources

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

imgshape-2.1.4.tar.gz (25.2 kB view details)

Uploaded Source

Built Distribution

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

imgshape-2.1.4-py3-none-any.whl (25.0 kB view details)

Uploaded Python 3

File details

Details for the file imgshape-2.1.4.tar.gz.

File metadata

  • Download URL: imgshape-2.1.4.tar.gz
  • Upload date:
  • Size: 25.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.8

File hashes

Hashes for imgshape-2.1.4.tar.gz
Algorithm Hash digest
SHA256 1784edc3b646c85c0b808a24285b35de8e788115e2a5338623abb01db8947a53
MD5 6695586adad548462a7a95d505dc3f6c
BLAKE2b-256 a55957bd74903c2b73b37ef55c052a934280584b318f960bae09c1de3b479ab0

See more details on using hashes here.

File details

Details for the file imgshape-2.1.4-py3-none-any.whl.

File metadata

  • Download URL: imgshape-2.1.4-py3-none-any.whl
  • Upload date:
  • Size: 25.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.8

File hashes

Hashes for imgshape-2.1.4-py3-none-any.whl
Algorithm Hash digest
SHA256 b8149f150afbf77b5e980c0f4428f97e09ae087069a12712531dd3e2ec888b02
MD5 6d0dd21cc8c238b64980f1c786be0d7f
BLAKE2b-256 324397af65463bdc82492d505c52920e3581aa5052785f7847aa07ec461b2540

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