Code Monkey home page Code Monkey logo

deepjulia's Introduction

DeepJulia

Contact

Note: For bug reports and requests, please use the GitHub issues.

Description

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.

Included

  • 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.

  • ResNet & MobilenetV2: All basic ResNet structures & MobileNetV2 with their pretrained weights are included in the library.

  • 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.

Links

  • The pretrained weights can be found in this link. Please download the required ones and place them to ./weights directory.

Usage

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")

Sample Code

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)
    ],
    ["cat.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(preds), dims=1)

Output: You will see that the index output will be 286, which is the correct label to the cat image.

To-Do:

  • Backbone Addition: VGG and other most-used structures will be added to the library with pretrained weights.

  • Test-cases Addition: Tests will be included for checking everything is functioning well even after upgrading a version.

Final Notes

  • 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.

deepjulia's People

Contributors

barisbatuhan avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.