Skip to main content

A comprehensive OCR and computer vision model library with support for SVTRV2, YOLO, EfficientNet, PPLCNet, and more.

Project description

MemoLib

A comprehensive OCR and computer vision model library built on PyTorch, providing a unified interface for text recognition, object detection, image segmentation, and image classification.

Features

  • Text Recognition - SVTRV2 model with GTC (Generative Text Context) pipeline, SMTR decoder, and RCTC loss
  • Object Detection - YOLO family (v5, v8, v11, v26) with detection and segmentation variants
  • Image Segmentation - DINO + UperNet semantic segmentation
  • Image Classification - EfficientNet, PPLCNet, YOLO classification
  • Unified Interface - Consistent API across all models: LoadWeight, Predict, BatchPredict, Train, Export
  • Model Export - Export to ONNX, OpenVINO, or TensorRT formats

Installation

pip install memolib

Optional dependencies

# For YOLO models
pip install memolib[yolo]

# For PPLCNet models
pip install memolib[pplcnet]

# For development
pip install memolib[dev]

Quick Start

Text Recognition with SVTRV2

from MemoLib import SVTRV2, TrainingConfig

# Load a pre-trained recognition model
model = SVTRV2()
model.LoadWeight("path/to/weights.pth")

# Single prediction
result = model.Predict(image)

# Batch prediction
results = model.BatchPredict([img1, img2, img3])

Object Detection with YOLO

from MemoLib import Yolo, TrainingConfig
from MemoLib.Model.BaseModel import eYoloDetectionModel

# Load a YOLO detection model
model = Yolo()
model.LoadWeight(eYoloDetectionModel.YoloV8n)

# Single prediction
result = model.Predict(image)

Semantic Segmentation with DINO UperNet

from MemoLib.Model.DinoUperNet import DinoUperNet, TrainingConfig

model = DinoUperNet()
model.LoadWeight("path/to/weights.pth")
result = model.Predict(image)

Model Export

from MemoLib.Model.BaseModel import eModelExportType

# Export to ONNX
model.Export("model.onnx", eModelExportType.ONNX)

# Export to OpenVINO
model.Export("model.xml", eModelExportType.OpenVINO)

# Export to TensorRT
model.Export("model.engine", eModelExportType.TensorRT)

Project Structure

MemoLib/
├── Model/
│   ├── BaseModel/       # Base interfaces and model type enums
│   │   ├── IModel.py    # Abstract model interface
│   │   └── eModelBase.py # Model type enumerations
│   ├── STVRV2/          # SVTRV2 OCR recognition model
│   ├── YOLO/            # YOLO detection & classification
│   ├── DinoUperNet/     # DINO + UperNet segmentation
│   ├── Efficientnet/    # EfficientNet classification
│   └── PPLCNet/         # PPLCNet classification

Available Model Types

Category Models
Recognition SVTRV2 (GTC/SMTR/RCTC)
Detection YOLOv5, YOLOv8, YOLO11, YOLO26, RF-DETR
Segmentation YOLO Segment, DINO UperNet
Classification EfficientNet (B0-B7, V2), PPLCNet, YOLO Class, RF-DETR Class
Anomaly Detection DInomaly, INFormerly

Requirements

  • Python 3.9+
  • PyTorch >= 1.10.0
  • torchvision >= 0.11.0
  • numpy >= 1.21.0
  • opencv-python >= 4.5.0

License

MIT License

Project details


Release history Release notifications | RSS feed

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

memolib-1.0.1.tar.gz (60.6 kB view details)

Uploaded Source

Built Distribution

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

memolib-1.0.1-py3-none-any.whl (70.7 kB view details)

Uploaded Python 3

File details

Details for the file memolib-1.0.1.tar.gz.

File metadata

  • Download URL: memolib-1.0.1.tar.gz
  • Upload date:
  • Size: 60.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.9

File hashes

Hashes for memolib-1.0.1.tar.gz
Algorithm Hash digest
SHA256 6f356e01e1be027a1cada2d9b33dfa2c7d645ef2f1d7f3d0ec78ebf363521bde
MD5 9a4a0e8bc56ee01d1950f605c8bb2a54
BLAKE2b-256 5554d21ec7f21c0775c2e02d31cfb29f8816b6bcd629c365b224f8a34e9c3436

See more details on using hashes here.

File details

Details for the file memolib-1.0.1-py3-none-any.whl.

File metadata

  • Download URL: memolib-1.0.1-py3-none-any.whl
  • Upload date:
  • Size: 70.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.11.9

File hashes

Hashes for memolib-1.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 cf149948286a00ac37ff746deea07bdaf7bb7db4696f90d1708744fbb4496161
MD5 2963d0d7d43d53d3e6f073b8f3560d34
BLAKE2b-256 2661a38901a998a4cde5aab19b3803f4a68bd9764fdace2a40da9f7288f00ff8

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