Skip to main content

DeepToolKit

PyPI Downloads GitHub Travis (.com) Build Status CodeQL

DeepToolKit provides implementations of popular machine learning algorithms, extensions to existing deep learning pipelines using TensorFlow and Keras, and convenience utilities to speed up the process of implementing, training, and testing deep learning models. In addition, DeepToolKit includes an inbuilt computer vision module containing implementations of facial detection and image processing algorithms.

Installation

Python Package

DeepToolKit can be installed directly from the command line:

pip install deeptoolkit

You can then work with it either by importing the library as a whole, or by importing the functionality you need from the relevant submodules.

# Complete library import.
import deeptoolkit as dtk

# Module and function imports.
from deeptoolkit.data import plot_data_cluster
from deeptoolkit.blocks import SeparableConvolutionBlock
from deeptoolkit.losses import CategoricalFocalLoss

From Source

If you want to install DeepToolKit directly from source, (i.e. for local development), then first install the git source:

git clone https://github.com/amogh7joshi/deeptoolkit.git

Then install system requirements and activate the virtual environment. A Makefile is included for installation:

make install

Features

DeepToolKit provides a number of features to either use standalone or integrated in a deep learning model construction pipeline. Below is a high-level list of features in the module. Proper documentation is under construction.

Model Architecture Blocks: deeptoolkit.blocks

  • Generic model architecture blocks, including convolution and depthwise separable convolution blocks, implemented as tf.keras.layers.Layer objects so you can directly use them in a Keras model.
  • Applied model architecture blocks, including squeeze and excitation blocks and ResNet identity blocks.

For Example:

from tensorflow.keras.models import Model
from tensorflow.keras.layers import MaxPooling2D
from tensorflow.keras.layers import Input, Dense, Flatten
from deeptoolkit.blocks import ConvolutionBlock

# Construct a Keras Functional model like normal.
inp = Input((256, 256, 3))
x = ConvolutionBlock(32, kernel_size = (3, 3), activation = 'relu')(inp)
x = MaxPooling2D(pool_size = (2, 2))(x)
x = ConvolutionBlock(16, kernel_size = (3, 3), activation = 'relu')(x)
x = MaxPooling2D(pool_size = (2, 2))(x)
x = Flatten()(x)
x = Dense(1024, activation = 'relu')(x)
x = Dense(10, activation = 'relu')(x)
model = Model(inp, x)

Loss Functions: deeptoolkit.losses

  • Custom loss functions including binary and categorical focal loss, built as tf.keras.losses.Loss objects so you can use them in a Keras model training pipeline as well.

For Example:

from tensorflow.keras.optimizers import Adam
from deeptoolkit.losses import BinaryFocalLoss

# Using the model from the above example.
model.compile(
   optimizer = Adam(),
   loss = BinaryFocalLoss(),
   metrics = ['accuracy']
)

Data Processing and Visualization: deeptoolkit.data

  • Data preprocessing, including splitting data into train, validation, and test sets, and shuffling datasets while keeping data-label mappings intact.
  • Data visualization, including cluster visualizations.

For Example:

import numpy as np
from deeptoolkit.data import train_val_test_split

X = np.random.random(100)
y = np.random.random(100)
X_train, X_val, X_test, y_train, y_val, y_test = train_val_test_split(X, y, split = [0.6, 0.2, 0.2])

Model Evaluation: deeptoolkit.evaluation

  • Model evaluation resources, including visualization of model training metrics over time.

Computer Vision: deeptoolkit.vision

  • A pre-built facial detection model: deeptoolkit.vision.FacialDetector. A large number of modern computer vision algorithms include a facial detection component, and DeepToolKit's facial detection module provides fast and accurate face detection using OpenCV's DNN implementation. To use it, simply execute the following:
import cv2
from deeptoolkit.vision import FacialDetector

# Initialize detector.
detector = FacialDetector()

# Detect face from image path and save image to path.
detector.detect_face('image/path', save = 'image/save/path')

# Detect face from existing image and continue to use it.
image = cv2.imread('image/path')
annotated_image = detector.detect_face(image)

Facial Detection Cartoon

License

All code in this repository is licensed under the MIT License.

Issue Reporting

If you notice any issues or bugs in the library, please create an issue under the issues tab. To get started and for more information, see the issue templates.

Metadata

Release files for deeptoolkit 0.2.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for deeptoolkit 0.2.1
File Size Uploaded Provenance
deeptoolkit-0.2.1.tar.gz 21.9 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for deeptoolkit 0.2.1
File Interpreter ABI Platform
deeptoolkit-0.2.1-py2.py3-none-any.whl Python 2, Python 3 none any Details

Total release size: 48.8 kB

Release files / deeptoolkit-0.2.1.tar.gz

Download URL deeptoolkit-0.2.1.tar.gz
Size 21.9 kB
Tags Source
SHA-256 checksum
How to use checksums
7ebb0daacf150dae2364ea5da25b4b36669ed9f1a7bcb5bb9d58e530f45ab58b
BLAKE2b-256 checksum
How to use checksums
a80f8ae56b47f9dc019255f868ff1bcbb06ed16a5f9b63db31a34bffe2e5e0cd
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/49.6.0 requests-toolbelt/0.9.1 tqdm/4.56.0 CPython/3.8.3

Release files / deeptoolkit-0.2.1-py2.py3-none-any.whl

Download URL deeptoolkit-0.2.1-py2.py3-none-any.whl
Size 26.9 kB
Tags Python 2 Python 3
SHA-256 checksum
How to use checksums
27f143e7feda0d698d19c949894e84eb4b9ccd71f759141c453fa4278d50713b
BLAKE2b-256 checksum
How to use checksums
ca25a5fa15b9af4e47db702f064248fce99368aaa545c13d3399ffd7cd65f542
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/49.6.0 requests-toolbelt/0.9.1 tqdm/4.56.0 CPython/3.8.3

Security for deeptoolkit 0.2.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page