NaMAZU: Pretty Usefull Library


Keywords
deep-learning, python, pytorch, pytorch-lightning
License
MIT
Install
pip install NaMAZU==0.0.61

Documentation

Libray including many(not yet) utilities

PyPI - Python Version PyPI version pl st numpy sklearn


NaMAZU

Lightning API

PyTorch PL

They are all written in PyTorch following best practice to be used with pytorch lightning. They are all GPU enabled controlled by Lightning API. You will never need to call to("cuda") to use the model on any device even with multi-GPU training!

import pytorch_lightning as pl
from NaMAZU import KNN, GMM

class YourLitModule(pl.LightningModule):
    def __init__(self,*args, **kwargs):
        ...
        self.encoder = SomeEncoder()
        self.head_classifier = KNN(
            n_neighbors=5, 
            distance_measure="cosine", 
            training_data=some_known_data
        )
        self.estimator = GMM(5, 10)

    def training_step(self, batch):
        x, t = batch
        y = self.encoder(x)
        y_hat = self.head_classifier(y)
        probability = self.estimator.predict_proba(y)

Statistical Model

  • KNN: Available with euqlidean, manhattan, cosine and mahalanobis distance.
  • NBC: GPU enabled naive bayes classifier.
  • GMM: Gaussian Mixture probabability estimator. Of course GPU enabled.

Deep Learning

  • LitU2Net: LightningModule U2Net. Trainable and ready for prediction.
  • AniNet: LightningModule image classifier pretrained for japanese animations.
  • PredictionAssistant: Coming soon.

Functional API

NumPy FFmpeg OpenCV

You can use below functions via

import NaMAZU.functional as F

F.change_frame_rates_in("./test_data.mp4",fps=5)

image_control

  • npy_to_img
  • img_to_npy
  • split_image
  • compose_two_png
  • apply_mask_to
  • apply_to_all
  • change_frame_rates_in
  • save_all_frames

file_control

  • rename_file
  • collect_file_pathes_by_ext
  • zip_files

data_science

  • train_linear_regressor

🚀 Coming

  • 1. st_integration. Usuful snipets and fast deoployment of LitModule to streamlit. (clf_template)
  • 2. Video Recognition Model
  • 3. Feature Learning
  • 4. Few-shot Learning
  • 5. Audio-Visual Multimodal