Skip to main content

A deep learning library for computer vision tasks (CUDA ≥11.8 compatible)

Project description

DeepLib

A unified PyTorch library for computer vision tasks, focusing on object detection, semantic segmentation, and anomaly detection.

Installation

Prerequisites

DeepLib requires PyTorch and torchvision to be installed first. For optimal performance, CUDA 11.8 or above is recommended.

You can install PyTorch with CUDA support using:

pip install torch torchvision --index-url https://download.pytorch.org/whl/cu118

For other installation options (CPU-only, different CUDA versions), see the PyTorch installation guide.

Installing DeepLib

Full Installation

Install DeepLib with all optional dependencies (recommended):

pip install deeplib

Core Installation

Install only the core functionality (no logging backends):

pip install deeplib[core]

Documentation

Full documentation is available at https://jonleinena.github.io/deeplib/

Features

  • Semantic Segmentation Models (✅ Implemented)

    • UNet
    • DeepLabV3
    • DeepLabV3+
  • Experiment Tracking (✅ Implemented)

    • TensorBoard
    • MLflow
    • Weights & Biases (W&B)
  • Object Detection Models (🚧 In Progress)

    • YOLOv4
    • YOLOv5
    • YOLOX
    • YOLOv7 and YOLOv9
    • Faster R-CNN
  • Anomaly Detection Models (🚧 In Progress)

    • PatchCore
    • FastFlow
    • PADIM
    • Other anomalib implementations

Quick Start - Semantic Segmentation

from deeplib.models.segmentation import UNet
from deeplib.trainers import SegmentationTrainer
from deeplib.datasets import SegmentationDataset
from deeplib.loggers import WandbLogger  # or TensorBoardLogger, MLFlowLogger
from torch.utils.data import DataLoader

# Initialize model
model = UNet(num_classes=4)

# Prepare dataset
train_dataset = SegmentationDataset(
    root="path/to/data",
    images_dir="images",
    masks_dir="masks",
    num_classes=4,
    split="train"
)
val_dataset = SegmentationDataset(
    root="path/to/data",
    images_dir="images",
    masks_dir="masks",
    num_classes=4,
    split="val"
)

# Create dataloaders
train_loader = DataLoader(train_dataset, batch_size=8, shuffle=True)
val_loader = DataLoader(val_dataset, batch_size=8)

# Configure loss function (e.g., Dice Loss)
model.configure_loss('dice', {'ignore_index': 255})

# Initialize logger (choose one)
logger = WandbLogger(
    experiment_name="segmentation_experiment",
    project="deeplib-segmentation"
)
# Or use TensorBoard:
# logger = TensorBoardLogger(experiment_name="segmentation_experiment")
# Or use MLflow:
# logger = MLFlowLogger(experiment_name="segmentation_experiment")

# Initialize trainer with logger
trainer = SegmentationTrainer(
    model=model,
    train_loader=train_loader,
    val_loader=val_loader,
    monitor_metric='iou',  # Monitor IoU for LR scheduling
    logger=logger
)

# Train model
trainer.train(
    num_epochs=100,
    save_path='best_model.pth'
)

For more examples and detailed usage, check the examples directory.

Project Structure

deeplib/
├── models/
│   ├── segmentation/  # ✅ Semantic segmentation models
│   ├── detection/     # 🚧 Object detection models (TODO)
│   └── anomaly/       # 🚧 Anomaly detection models (TODO)
├── trainers/          # Training logic and utilities
├── datasets/          # Dataset implementations
├── loggers/           # ✅ Experiment tracking (TensorBoard, MLflow, W&B)
└── utils/             # Utility functions

Development Roadmap

High Priority

  • Implement experiment tracking
    • TensorBoard support
    • MLflow support
    • W&B support
  • Add comprehensive documentation
    • API Reference
    • Examples
    • Installation Guide
  • Implement object detection models
    • YOLOv4
    • YOLOv5
    • Faster R-CNN
  • Add anomaly detection support
    • PatchCore
    • FastFlow
    • PADIM
  • Add data augmentation pipeline
  • Add model export (ONNX, TorchScript)

Medium Priority

  • Add more segmentation models
    • FPN
    • SegFormer
    • BEiT
  • Add test suite
  • Add model benchmarks
  • Add visualization tools

Low Priority

  • Add multi-GPU training support
  • Add quantization support
  • Add model pruning
  • Add hyperparameter tuning

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

License

This project is licensed under the MIT License - see the LICENSE file for details.

Acknowledgments

This library is inspired by the following projects:

  • torchvision
  • anomalib
  • segmentation-models-pytorch
  • YOLOMIT

Installation Options

Full Installation (Recommended)

pip install deeplib

Core Installation (without logging backends)

pip install deeplib[core]

CUDA Requirements

This package requires PyTorch with CUDA 11.8 or newer. To install PyTorch dependencies:

pip install torch torchvision --index-url https://download.pytorch.org/whl/cu118

For other CUDA versions or CPU-only installation, see https://pytorch.org/get-started/locally/

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

deeplib-1.1.0.tar.gz (36.2 kB view details)

Uploaded Source

Built Distribution

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

deeplib-1.1.0-py3-none-any.whl (22.2 kB view details)

Uploaded Python 3

File details

Details for the file deeplib-1.1.0.tar.gz.

File metadata

  • Download URL: deeplib-1.1.0.tar.gz
  • Upload date:
  • Size: 36.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.0.1 CPython/3.12.8

File hashes

Hashes for deeplib-1.1.0.tar.gz
Algorithm Hash digest
SHA256 bb53d98749dcf2ddf2f4631c52121df87a74c091f2c75efa26960ed7a85b7ff6
MD5 73d56839929db6910c9a8fdc39a398d6
BLAKE2b-256 345bd8e02041233bcf9865e9df3e5b3e72c0d5c0ff3e0847ffbe4aa406e41e0c

See more details on using hashes here.

Provenance

The following attestation bundles were made for deeplib-1.1.0.tar.gz:

Publisher: publish.yml on jonleinena/deeplib

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file deeplib-1.1.0-py3-none-any.whl.

File metadata

  • Download URL: deeplib-1.1.0-py3-none-any.whl
  • Upload date:
  • Size: 22.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.0.1 CPython/3.12.8

File hashes

Hashes for deeplib-1.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 a2b5a259088351e7e56b35ba5185946bbec24b29ec32209cc1873939c58024e2
MD5 a04376115d10e5618df312dd1a136ab3
BLAKE2b-256 15e1ff029507c4aa7a826e3137cdf9940b4c50a524415952e5e0824d8948e0c9

See more details on using hashes here.

Provenance

The following attestation bundles were made for deeplib-1.1.0-py3-none-any.whl:

Publisher: publish.yml on jonleinena/deeplib

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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