BlastML is a Fast Machine Learning Prototyping Library
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.
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:
- Simple (Basic CNN)
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:
- Create data-set folders with data:
- create a /train folder
- create a /validation folder
- create an /inference folder
- create a /model folder (where the model will be saved)
- Create your BlastML configuration (CFG):
- set your train/validation/inference/model folders.
- enter the number of epochs.
- enter number of batches (images to process each batch).
- enter number of classes.
- enter number of thread (if multithreading is enabled).
- select optimizer (e.g: adam, sgd, rmsprop ...etc.).
- select a 'loss function' (e.g: sparse_categorical_crossentropy, binary_crossentropy ...etc.).
- select model name
- class_mode: sparse, categorical, binary (type of classification)
- [optional] enable global saving mode:
- save model
- save weights
- save history
- select your augmentation params
- Create a BlastML(CFG) instance (attach configuration to BlastML)
- Attach a CNN to BlastML.
- Compile the CNN.
- Train (get accuracy+loss for your model + validation accuracy+loss).
- 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
- set number of threads to 1 (makes sure threads don't overlap your data-set)
- load model from disk to memory
- [optional] plot history to /model folder (creates 2 images for loss and accuracy)
- infer the data-set (get embeddings/classification results)
BlastML supports DarkNet (YOLO v3) for Object Detections.
- Converting DarkNet weights to Keras weights (h5 file)
- Training DarkNet with our own dataset (using YOLO v3 pre-trained and converted weights to h5)
- create model/darknet/data
- put anchors.txt
- put classes.txt
- put train.txt
- create model/darknet/data/log/ (for TensorBoard logs results)
- create model/darknet/data
Note: the training part is done in 2 stages:
- 1-50 epochs with freezed 42/44 layers
- 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-50 staged .h5 <project name>.darknet.trained.stage.h5)
- 51-100 trained .h5 (ie: <project name>.darknet.trained.h5)
Next we can inference our videos/images.
- BlastML can Export Keras model to TensorFlow graph
Release history Release notifications | RSS feed
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
|Filename, size||File type||Python version||Upload date||Hashes|
|Filename, size BlastML-0.2.9-py3-none-any.whl (27.1 kB)||File type Wheel||Python version py3||Upload date||Hashes View|
|Filename, size BlastML-0.2.9.tar.gz (27.9 kB)||File type Source||Python version None||Upload date||Hashes View|