In this talk, I will share my journey of using machine learning in Java to build a visual recognition system that can identify Lego blocks. As a Java developer, I wanted to use Java for this project rather than Python, which is more commonly used for machine learning projects. I will explain the basics of machine learning and give an overview of the current Java libraries for machine learning and transferring pre-trained models. I will demonstrate how to train and modify existing models using transfer learning. The goal of the project is to create a Java solution that can identify the top 1000 most popular Lego bricks. I will explain all of this without using any complex mathematical formulas, making it accessible to those with no prior knowledge of machine learning.
7. JAVA MACHINE LEARNING FRAMEWORKS*
• deeplearning4j
• Elki
• DeepJavaLibrary (djl)
• Apache MXNet
• PyTorch
• Tensorflow
• ONNX Runtime
* With a release in the last year and free
8. JAVA MACHINE LEARNING FRAMEWORKS*
• deeplearning4j
• Elki
• DeepJavaLibrary (djl)
• Apache MXNet
• PyTorch
• Tensorflow
• ONNX Runtime
* With a release in the last year and free
34. The number of samples that are processed at once
during each iteration of training.
BATCH SIZES
The presented results confirm that using small
batch sizes achieves the best training stability and
generalization performance, for a given
computational cost, across a wide range of
experiments. In all cases the best results have
been obtained with batch sizes m = 32 or
smaller, often as small as m = 2 or m = 4.
arxiv.org/abs/1804.07612
48. ACCURACY
The lower the value of the entropy loss, the better the
model's predictions are aligned with the labels, and
take into account the confidence of the predictions
accuracy measures the proportion of
correctly classified instances out of the total
number of instances
VS
ENTROPYLOSS
80. CONVERT THE MODEL
import tensorflow as tf
import tensorflow.keras as keras
loaded_model = keras.models.load_model("flowers.h5")
tf.saved_model.save(loaded_model, "model/1")