- Email: [email protected] / [email protected]
Note: For bug reports and requests, please use the GitHub issues.
DeepJulia is a Deep Learning library implemented in Julia Programming Language using Knet Deep Learning Framework. Knet includes low level operations but not high-level layers and classes for constructing more complex deep learning structures. This library provides some initial layer structures and most commonly used backbone models such as ResNet, VGG, MobileNet out-of-the-box with their pretrained weights.
-
Basic Layers: Linear, Convolution, Batch Normalization, ReLU, Pooling, Global Pooling, Dropout, etc.
-
GPU/CPU Devices: With only one function call, your models can be moved to a GPU or CPU device.
-
Kaiming Initializer: Initialization with Kaiming is added especially for Convolution operations.
-
Pretrained Models: All basic ResNet structures, MobileNetV2 and VGG (thanks to @gsoykan for VGG) models are included in the library out-of-the-box. Also the pretrained ImageNet weights are available for all ResNet models and MobileNetV2 (work on progress for VGG).
-
Preprocessing Methods: For image data, preprocessing methods are added, which include random & center crops, horizontal flip, square-image conversion and color distortion.
-
Smooth L1 Loss: Smooth L1 Loss is defined and included, since it is not present in Knet library.
- The pretrained weights can be found in this link. Please download the required ones and place them to
./weights
directory.
Clone the whole repository to your working directory and just include the DeepJulia.jl
file to the files you will use this library.
include("<DeepJulia_DIR>/DeepJulia.jl")
model = MobileNetV2(pretrained=true)
model = to_gpu(model)
model = set_eval_mode(model)
tr = Transforms(
[
RandomCrop(min_ratio=0.6),
Resize(224, 224),
Flip(horizontal=true),
DistortColor(probs=0.5)
],
["./data/robin.jpeg"],
img_size=224,
return_changes=true,
batch_size=1
)
imgs, _, vals = get_batch(tr)
imgs = convert(KnetArray{Float32}, imgs)
preds = model(imgs)
print(findmax(softmax(preds, dims=1), dims=1))
Output: You will see that the index output will be 16, which is the correct label for the robin image.
-
Backbone Addition: Other most-used structures (DenseNet, Inception, etc.) will be added to the library with their pretrained weights.
-
Test-cases Addition: Tests will be included for checking everything is functioning well even after upgrading a version.
- Since this library is built on top of the Knet framework, please check Knet Documentation for non-existing features. Please keep in mind that this library only supports some basic operations & models additional to Knet and currently, it is only developed by a single person.