Book Image

Hands-On Java Deep Learning for Computer Vision

By : Klevis Ramo
Book Image

Hands-On Java Deep Learning for Computer Vision

By: Klevis Ramo

Overview of this book

Although machine learning is an exciting world to explore, you may feel confused by all of its theoretical aspects. As a Java developer, you will be used to telling the computer exactly what to do, instead of being shown how data is generated; this causes many developers to struggle to adapt to machine learning. The goal of this book is to walk you through the process of efficiently training machine learning and deep learning models for Computer Vision using the most up-to-date techniques. The book is designed to familiarize you with neural networks, enabling you to train them efficiently, customize existing state-of-the-art architectures, build real-world Java applications, and get great results in a short space of time. You will build real-world Computer Vision applications, ranging from a simple Java handwritten digit recognition model to real-time Java autonomous car driving systems and face recognition models. By the end of this book, you will have mastered the best practices and modern techniques needed to build advanced Computer Vision Java applications and achieve production-grade accuracy.
Table of Contents (8 chapters)

Exploring triplet loss

In this section, we shall look at the finer details of the cost function with a triplet loss. We will train network weights using the triplet cost function or the triplet loss. The idea was introduced in the paper by Schroff in 2015, FaceNet: A unified embedding for face recognition and clustering. We shall also explore the areas to choose the triplet so that our network will learn to achieve really high accuracy.

We begin by choosing the base or anchor image, which will be used as a sample for other comparts. The base image is as follows:

We shall now select a different image that represents the same person; this is known as the positive image, shown as follows:

AS we have seen in the previous section, we want the similarity function d as close to zero as possible. It is mathematically expressed as:

Having this value close to zero means that the...