Skip to main content

BlastML is a Fast Machine Learning Prototyping Library

Project description

BlastML

BlastML is a Lightning Fast Machine Learning Prototyping Library

With BlastML, you can prototype CNN networks (NLP to be added in the future) with ease. BlastML uses Keras (TFlow) as an underline library, but it makes it much more easier than Keras itself.

Projects

BlastML let you create a new project which aims to help unite the entire Machine Learning into single folder structure.

How to create a new project:

Note: before doing any training/inferencing on our data, it's best to make sure we collect data before hand. BlastML uses this dataset format:

root/
----project/
---------dataset/
------------Class1/
----------------File1
----------------File2
----------------File3
----------------<...>
------------Class2/
----------------File1
----------------File2
----------------File3
----------------<...>
------------<...>

Once you setup your dataset in that format, and you specified the correct paths in the project configuration settings, you just call create_project() method inside your net instance.

Bt default, BlastML uses the standard 80:20 train, inference, validation file distribution. Once the data has been processed, you can easily train, validate, infer your data with your CNN of your choice.

CNN (Convolutional Neural Networks)

BlastML contains implementations of various well known and tested CNN such as:

  1. Simple (Basic CNN)
  2. VGG-16
  3. ResNet-18

CNN builder

BlastML contains easy CNN building blocks which allows you to focus on building and testing your own CNN without spending too much time on function names, parameters and other mixed setups. To build a custom network you simple call the create() function.

Custom CNN Example:

Net.create()
.add_2d(filters=32, kernel=(3, 3), activation="relu", padding='same', input_shape=(224, 224, 3))
.add_2d(filters=32, kernel=(3, 3), activation='relu')
.add_max_pooling()
.add_dropout()
.add_basic_block()
.add_basic_block()
.add_flatten()
.add_dense(size=512, activation='relu', name="layer_features")
.add_dense(size=cfg.get_num_classes(), activation='softmax', name="layer_classes")
.show_model_summary()
.compile()
.train()
.evaluate()

How to use BlastML

Train and Evaluate

BlastML makes it so easy to use, that all you need is to:

  1. Create data-set folders with data:
    1. create a /train folder
    2. create a /validation folder
    3. create an /inference folder
    4. create a /model folder (where the model will be saved)
  2. Create your BlastML configuration (CFG):
    1. set your train/validation/inference/model folders.
    2. enter the number of epochs.
    3. enter number of batches (images to process each batch).
    4. enter number of classes.
    5. enter number of thread (if multithreading is enabled).
    6. select optimizer (e.g: adam, sgd, rmsprop ...etc.).
    7. select a 'loss function' (e.g: sparse_categorical_crossentropy, binary_crossentropy ...etc.).
    8. select model name
    9. class_mode: sparse, categorical, binary (type of classification)
    10. [optional] enable global saving mode:
      1. save model
      2. save weights
      3. save history
    11. select your augmentation params
  3. Create a BlastML(CFG) instance (attach configuration to BlastML)
  4. Attach a CNN to BlastML.
  5. Compile the CNN.
  6. Train (get accuracy+loss for your model + validation accuracy+loss).
  7. Evaluate (see how your model evaluated against never seen data).

Training is easy:

net = BlastML(cfg=cfg)
net.vgg16().compile().train().evaluate()
Inferencing and Plotting Results
  1. set number of threads to 1 (makes sure threads don't overlap your data-set)
  2. load model from disk to memory
  3. [optional] plot history to /model folder (creates 2 images for loss and accuracy)
  4. infer the data-set (get embeddings/classification results)

Object Detection

BlastML supports DarkNet (YOLO v3) for Object Detections.
see: https://github.com/qqwweee/

Features:

  1. Converting DarkNet weights to Keras weights (h5 file)
  2. Training DarkNet with our own dataset (using YOLO v3 pre-trained and converted weights to h5)
    1. create model/darknet/data
      1. put anchors.txt
      2. put classes.txt
      3. put train.txt
    2. create model/darknet/data/log/ (for TensorBoard logs results)

Note: the training part is done in 2 stages:

  1. 1-50 epochs with freezed 42/44 layers
  2. 51-100 with un-freezed layers.

I have uploaded a demo (zipped) darknet/ folder, get it here: here

Training is easy:

net = BlastML(cfg=cfg)
net.darknet().create().compile().train()

After training is completed, 2 .h5 (weights) file will be created

  1. 1-50 staged .h5 <project name>.darknet.trained.stage.h5)
  2. 51-100 trained .h5 (ie: <project name>.darknet.trained.h5)

Next we can inference our videos/images.

Other Features

  1. BlastML can Export Keras model to TensorFlow graph

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

BlastML-0.2.9.tar.gz (27.9 kB view details)

Uploaded Source

Built Distribution

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

BlastML-0.2.9-py3-none-any.whl (27.1 kB view details)

Uploaded Python 3

File details

Details for the file BlastML-0.2.9.tar.gz.

File metadata

  • Download URL: BlastML-0.2.9.tar.gz
  • Upload date:
  • Size: 27.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.19.1 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.28.1 CPython/2.7.15

File hashes

Hashes for BlastML-0.2.9.tar.gz
Algorithm Hash digest
SHA256 ffb738f8a818ba03bb297ad277adb4e830b971e33b39ecae7c00bfde2ebace59
MD5 3b5dd94866f3675527f08d0cf976e3b0
BLAKE2b-256 cfff9c4bdfb32977c5e770f812fd3bdf825f94c07af57b22e7d345440d9b0d74

See more details on using hashes here.

File details

Details for the file BlastML-0.2.9-py3-none-any.whl.

File metadata

  • Download URL: BlastML-0.2.9-py3-none-any.whl
  • Upload date:
  • Size: 27.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.19.1 setuptools/40.8.0 requests-toolbelt/0.9.1 tqdm/4.28.1 CPython/2.7.15

File hashes

Hashes for BlastML-0.2.9-py3-none-any.whl
Algorithm Hash digest
SHA256 2bae2a8714a8727fd3e96889b14a6e58855d7ef3f6a51a086e0139f7d6230612
MD5 a072a7b60a8d100b67c6a5d790041fb2
BLAKE2b-256 dd15333bff00938cdbb3d333b32d07762e8fd1689c6afb9b9445cabebf865ef2

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