A Python library for machine learning model training and inference
Project description
MemoLib
A comprehensive Python library for machine learning model training and inference, supporting both classification and object detection tasks with state-of-the-art models.
Features
-
Multiple Model Architectures
- EfficientNet (B0-B7, EfficientNetV2)
- YOLO series for object detection
-
Flexible Task Support
- Image Classification
- Object Detection
-
Export Capabilities
- ONNX format for cross-platform deployment
- OpenVINO format for Intel hardware optimization
-
Training Pipeline
- Built-in training loops with customizable callbacks
- Support for custom loss functions (FocalLoss, etc.)
- Easy model configuration via YAML/JSON
-
Utilities
- Dataset format conversion tools
- Data serialization and configuration management
- Image preprocessing and augmentation
Installation
Install MemoLib using pip:
pip install MemoLib
For development with optional dependencies:
# With OpenVINO support
pip install MemoLib[openvino]
# All optional dependencies
pip install MemoLib[all]
# Development tools
pip install MemoLib[dev]
Quick Start
Classification Example
from MemoLib import MemoModel, eModelTask, eClassifyModel
# Create a classification model (EfficientNet-B0)
model = MemoModel(eModelTask.Classification, eClassifyModel.EfficientNetB0)
# Load pretrained weights and class labels
model.LoadWeight("path/to/weights.pth")
model.LoadLabelName("path/to/labels.txt")
# Make predictions on an image
result = model.Predict("path/to/image.jpg")
print(f"Prediction: {result.label}")
print(f"Confidence: {result.confidence:.2f}")
Object Detection Example
from MemoLib import MemoModel, eModelTask, eDetectModel
# Create a YOLO detection model
model = MemoModel(eModelTask.ObjectDetection, eDetectModel.YOLOv8)
# Load weights
model.LoadWeight("yolov8n.pt")
# Detect objects in image
results = model.Predict("path/to/image.jpg")
for detection in results:
print(f"Class: {detection.label}, Confidence: {detection.confidence:.2f}")
print(f"BBox: {detection.bbox}")
Model Export
# Export to ONNX
model.ExportToONNX("model.onnx")
# Export to OpenVINO (requires openvino package)
model.ExportToOpenVINO("model.xml")
Package Structure
MemoLib/
├── Model/ # Core model implementations
│ ├── Data/ # Data loading and preprocessing
│ ├── EfficientNet/ # EfficientNet model variants
│ └── YOLO/ # YOLO detection models
├── DataSerializer/ # Configuration management
├── DatasetFormatConvert/ # Dataset conversion utilities
└── Loss/ # Custom loss functions (FocalLoss, etc.)
Supported Models
Classification
- EfficientNet-B0 to B7
- EfficientNetV2-S, M, L
Object Detection
- YOLOv5
- YOLOv8
- YOLOv9
- YOLO11
Requirements
- Python >= 3.8
- PyTorch >= 1.12.0
- TorchVision >= 0.13.0
- OpenCV >= 4.5.0
- Ultralytics >= 8.0.0
- EfficientNet-PyTorch >= 0.7.0
See pyproject.toml for full dependency list.
Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
- Fork the repository
- Create your feature branch (
git checkout -b feature/AmazingFeature) - Commit your changes (
git commit -m 'Add some AmazingFeature') - Push to the branch (
git push origin feature/AmazingFeature) - Open a Pull Request
Issues
If you encounter any problems or have suggestions, please open an issue.
License
This project is licensed under the MIT License - see the LICENSE file for details.
Author
NghiaKTHP
- GitHub: @NghiaKTHP
- PyPI: MemoLib
Changelog
Version 0.1.5
- Added GitHub repository links
- Improved documentation
- Updated package metadata
Version 0.1.4
- Initial PyPI release
- Support for EfficientNet and YOLO models
- ONNX and OpenVINO export capabilities
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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file memolib-0.1.7.tar.gz.
File metadata
- Download URL: memolib-0.1.7.tar.gz
- Upload date:
- Size: 20.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6bcc2c1affe5c00ba3f3641a2500e323a80aedb7b3e6dd0ae0f97c99e4c11c20
|
|
| MD5 |
b6dbd1042827ced1c7a11486b24e2274
|
|
| BLAKE2b-256 |
ddeec59e6f3893b25952602354aab5fd7f7eb36772c733f9ebc30589967eeb34
|
Provenance
The following attestation bundles were made for memolib-0.1.7.tar.gz:
Publisher:
publish-pypi.yml on NghiaKTHP/MemoLib
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
memolib-0.1.7.tar.gz -
Subject digest:
6bcc2c1affe5c00ba3f3641a2500e323a80aedb7b3e6dd0ae0f97c99e4c11c20 - Sigstore transparency entry: 691348700
- Sigstore integration time:
-
Permalink:
NghiaKTHP/MemoLib@bd7b099c16ed8d51a4150b816f834e5121c09c68 -
Branch / Tag:
refs/tags/v0.1.7 - Owner: https://github.com/NghiaKTHP
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-pypi.yml@bd7b099c16ed8d51a4150b816f834e5121c09c68 -
Trigger Event:
release
-
Statement type:
File details
Details for the file memolib-0.1.7-py3-none-any.whl.
File metadata
- Download URL: memolib-0.1.7-py3-none-any.whl
- Upload date:
- Size: 22.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b888f77cd24b85bd843d5b1d4c083b487a3d42fda70e7cc407ee9566900b6e5f
|
|
| MD5 |
f35fb6ef5c1679603905ed0f21f4d901
|
|
| BLAKE2b-256 |
2f8e092e884e45f37c3ebe87df9d2bb9b5e8d0d49d1d07ee7d6a8521919c9417
|
Provenance
The following attestation bundles were made for memolib-0.1.7-py3-none-any.whl:
Publisher:
publish-pypi.yml on NghiaKTHP/MemoLib
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
memolib-0.1.7-py3-none-any.whl -
Subject digest:
b888f77cd24b85bd843d5b1d4c083b487a3d42fda70e7cc407ee9566900b6e5f - Sigstore transparency entry: 691348797
- Sigstore integration time:
-
Permalink:
NghiaKTHP/MemoLib@bd7b099c16ed8d51a4150b816f834e5121c09c68 -
Branch / Tag:
refs/tags/v0.1.7 - Owner: https://github.com/NghiaKTHP
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish-pypi.yml@bd7b099c16ed8d51a4150b816f834e5121c09c68 -
Trigger Event:
release
-
Statement type: