Code Monkey home page Code Monkey logo

cdle-traininglabs's Introduction

Eclipse Deeplearning4j Training Labs

Sonar Cloud

GitHub Discord Documentation GitHub release Sonar Cloud

Running examples strategically structured to enhance understanding of building models with Eclipse Deeplearning4j.

This repo contains codes for hands-on purpose during training session. All codes had been tested using CPU.

Contents

DL4J-Lab

  • classification: This folder contains various binary and multiple classification task exercises for learners to practice and solutions to refer to.
  • convolution: This folder contains MNIST classification and object detection using transfer learning of TinyYOLO and VGG16.
  • dataexamples: This folder contains model that train neural network to learn drawing.
  • datavec: This folder contains K-Fold cross-validation tutorial, load and transform CSV and Image files using DataVec.
  • feedforward: This folder contains simplest neural network to approximate a function that can map input to an output, and model that can detect the gender of a person based on his/her name.
  • generative: This folder contains a GAN model that can generate MNIST digits.
  • humanactivity: This folder contains a LSTM model and a hybrid CNN-LSTM neural network to perform human activity classification.
  • modelsaveload: This folder contains step-by-step on how to save and load a model.
  • nd4j: This folder contains ND4J tutorial and exercise.
  • recurrent: This folder contains a basic RNN network that learn to create a string, a LSTM model to generate texts, and a LSTM model for mortality prediction.
  • regression: This folder contains neural network that predict ridership demand.
  • VAE: This folder contains a VAE model for bank transaction anomaly detection.

DL4J-cv-labs

  • classification: This folder contains a custom model and a VGG16 model for dog breed classification, and a ResNet-50 model for food classification.
  • facial_recognition: This folder contains facial recognition with a pipeline of video streaming, face detection and face recognition.
  • image processing: This folder contains step-by-step on image processing.
  • object_detection: This folder contains a TinyYOLO model and a YOLOv2 model for Avocado and Banana Object Detection, and a pre-trained YOLOv2 model for metal surface defects detection.
  • segmentation: This folder contains semantic segmentation on the car images and the cell nucleus images from Data Science Bowl 2018 using a pre-trained U-Net.

Built with

  • deeplearning4j 1.0.0-M1.1
  • CUDA 11.2 (Note: Optional if you are using CPU)
  • cuDNN 8.1.1 (Note: Optional if you are using CPU)

Getting Started

Install Java

Download Java JDK here.
(Note: Use Java 8 for full support of DL4J operations)

Check the version of Java using:

java -version

Make sure that 64-Bit version of Java is installed.

Install IntelliJ IDEA Community Edition

Download and install IntelliJ IDEA.

Install Apache Maven Optional

IntelliJ provides a default Maven that is bundled with the installer. Follow these instructions to install Apache Maven.

GPU setup Optional

Follow the instructions below if you plan to use GPU setup.

  1. Install CUDA and cuDNN Requirements:
    • CUDA 11.2
    • cuDNN 8.1.1

CUDA and cuDNN can be downloaded from here and here. Step by step installation guides can be found here.

  1. Dependencies are needed to be included into Maven project if we wish to use GPU for training. Follow the links below for instructions in details.

Usage

All examples are separated into training and solution folders. The download will take some time to download dependencies from maven when you first run these examples.

All codes in training folder have few lines commented out so that they can be taught and demonstrated in the class. The solution folder contains the un-commented version for every line of codes.

For bad internet connection and unable to perform task smoothly, you can go to src\main\resources\config.properties and download necessary dataset before the sessions.

Known Issues

Problem:

jnind4jcpu.dll: Can't find dependent libraries

Solution:
Change the maven dependencies of Javacpp to the latest (1.4.3 works).

Problem:

"C:\Users\LohJZ\.javacpp\cache\cuda-10.0-7.3-1.4.3-windows-x86_64.jar\org\bytedeco\javacpp\windows-x86_64\jnicudnn.dll": Can't find procedure

Solution:
Install latest CUDA (version 7.6 works)

Contributor's Guide

For contributors or someone who wishes to contribute, please take a look at the guideline here to help you in your journey.

cdle-traininglabs's People

Contributors

alvin9964 avatar ameliepeter avatar azhar337 avatar bobbyskymind avatar chiaweilim avatar chooneung avatar choowilson avatar codenamewei avatar devennn avatar devenyantis avatar evanyeohboonkhai avatar fariskamaludin-skymind avatar guanyu-certifai avatar jacklynlxq avatar jingzhi93 avatar kenghooi-skymind avatar kenghooi-teoh avatar kianyang-lee avatar ooixinpeng avatar peirkern-skymind avatar tingweijing avatar williamardianto avatar yinchuangsum avatar yptheangel avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

cdle-traininglabs's Issues

Contributor's guidelines is missing

Faulty/Unclear Documentation

Contributor's guidelines is missing. If one wants to contribute, he or she would not know what are the rules that need to be followed.

License header missing / ill written

Upgrade to beta6

The training UI doesn't work in Beta 5 but works on Beta 6. Suggest upgrading to Beta 6.

Incorrect package path

Describe the bug
Certain scripts still contain the now-outdated package path

package global.skymind.training.image_processing.utils.display;

jfxrt.jar missing from openjdk 8 installation, resulting in failure to run MnistClassifier

Installation of oracle java jdk 8 comes with jfxrt.jar, so no issue.

As oracle installation required sign up and login, some might opt for option openjdk 8 , which missing of jfxrt.jar.
Hence missing in SwingFXUtils dependency in running MnistClassifier.java

Environment : Windows
javafx

How to reproduce:

  1. Download openjdk 8
  2. Run TrainingLabs and you should see the error happened as in the screenshot

Solution:
Use openjfx (Find the workaround, update the repo and readme)
https://gluonhq.com/products/javafx/

Tutorial to refer: https://developer.tizen.org/development/articles/openjdk-and-openjfx-installation-guide

Version Conflict

*** ND4J VERSION CHECK FAILED - INCOMPATIBLE VERSIONS FOUND ***
10:49:20.466 [main] WARN org.nd4j.versioncheck.VersionCheck - *** ND4J VERSION CHECK FAILED - INCOMPATIBLE VERSIONS FOUND ***
10:49:20.467 [main] WARN org.nd4j.versioncheck.VersionCheck - Incompatible versions (different version number) of DL4J, ND4J, RL4J, DataVec, Arbiter are unlikely to function correctly

IndexOutOfBoundsException in PredictGenderTest

Describe the bug
java.lang.IndexOutOfBoundsException occurs when user input more than 11 characters (space included) in the input field.
Affected in both solution and training folder.

Code that causes this error:

for (int i = 0; i < arr.length; i++)
{
features.putScalar(new int[]{0, i}, Integer.parseInt(arr[i]));
}

To Reproduce
Steps to reproduce the behavior:

  1. Go to dl4j-labs/src/main/java/ai/certifai/solution/feedforward/detectgender/PredictGenderTrain.java
  2. Run the java file to train the model.
  3. Go to dl4j-labs/src/main/java/ai/certifai/solution/feedforward/detectgender/PredictGenderTest.java
  4. Run the java file and enter the name with more than 11 characters in input field.

Expected behavior
No error occurs, successfully predict the gender from the name.

Screenshots
image

Desktop:

  • OS: Windows 10 Pro
  • Version: 10.0.19042 Build 19042

Modify License Header

for files created before 2020

  • Copyright (c) 2019 Skymind Holdings Bhd.
  • Copyright (c) 2020 CertifAI Sdn. Bhd.

for files created 2020 onwards

  • Copyright (c) 2020 CertifAI Sdn. Bhd.

WebCamObjectDetection did not terminate automatically

Describe the bug
The program and webcam grabber did not close after user exits the UI. Need to stop the program manually in IDE.

To Reproduce
Steps to reproduce the behavior:

  1. Go to dl4j-cv-labs/src/main/java/ai/certifai/solution/object_detection/WebCamObjectDetection.java
  2. Run the java file
  3. Wait for the webcam to turn on
  4. Press "Q" to close the UI

Expected behavior
The program should terminate after user press "Q".

Desktop:

  • OS: Windows 10 Pro
  • Version: 10.0.19042 Build 19042

Inconsistent code commenting styles

Style Inconsistency

Just a suggestion for improvement in code commenting.

Evidence

  1. Inconsistent block comments

import java.util.List;
/***
* Dataset
* https://www.kaggle.com/zhangjuefei/birds-bones-and-living-habits
*
* @author BoonKhai Yeoh
*/

/**
* Author: Kian Yang, Lee
* Binary Classification Task with Heart Disease DataSet
*
******************************************************
*
* This is a binary classification task example of using feedforward neural network.
* The code for dataset loading and preparation was done for you.
* Also, the code to iterate through training epochs and evaluating the model were provided.
*
* Please complete this exercise by configuring a neural network that can perform a binary classification task.
* Take special note of the different input and output number that is required in order to run the dataset
* successfully.
*
* Remember to uncomment certain parts of code to run the entire script.
*
* *****************************************************
*/

/*
*
* TASKS:
* -----
* 1. Load data using getDataSet() method.
* 2. create a kFoldIterator object. (set k=5)
* 3. loop through the kFoldIterator and print out the observations for each training set and test set.
*
* */

  1. Inconsistent end-of-line comments

// #### Apply normalization here ####
//=====================================================================
// Step 2: Define Model
//=====================================================================

// 5. ======== build and initialise the model ========
MultiLayerNetwork model = build_model(weightsArray); // call the function to build the model
model.init();
// 6. ======== configure listener (UI & Training Loss Value) ========
StatsStorage statsStorage = new InMemoryStatsStorage();

//=========================================================================
// Step 1 : Build Schema to prepare the data
//=========================================================================
//Build Schema to prepare the data

  1. Inconsistent method documentation comment

/*
* =================================
* List of functions to be used
* =================================
*/
/*
************** 1. function to load data **************
*/
private static RecordReader load_data(String filepath) throws Exception{

/**
* Returns a network config that takes in a 10x10 random number and produces a 28x28 grayscale image.
* @return config
*/
private static MultiLayerConfiguration generator() {

Possible solution

Just follow one of the styles and make it all consistent.

Styling references:

Inconsistent repo and artifact name

Describe the bug
Screenshot 2021-07-08 at 4 29 51 PM

repo was changed from traininglabs to cdle-traininglabs awhile ago
faris, can you rename the artifact name to be consistent too?

some of the places to changed

also update the website to certifai.ai thank you

Note: will need to do a wild card search, i might not cover everything

To Reproduce
Steps to reproduce the behavior:

  1. Go to '...'
  2. Click on '....'
  3. Scroll down to '....'
  4. See error

Expected behavior
A clear and concise description of what you expected to happen.

Screenshots
If applicable, add screenshots to help explain your problem.

Desktop (please complete the following information):

  • OS: [e.g. iOS]
  • Browser [e.g. chrome, safari]
  • Version [e.g. 22]

Additional context
Add any other context about the problem here.

Beta-7 different outputs on GPU and CPU regression

OS: Windows
DL4J: deeplearning4j 1.0.0-beta7
CUDA: 10.2
cuDNN: 7.6
Issue: The results of regression (eg. BostonHousePricePrediction.java) running on GPU are not same as results running on CPU. Attached are the screenshot of the results.

CPU:
Using CPU as backend:
CPU
Result running on CPU backend:
CPU_result

GPU:
Using GPU as backend:
GPU
Result running on GPU backend:
GPU_result

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.