(Day 35) TensorFlow Advanced techniques

Ivan Ivanov · February 5, 2024

Hello :) Today is Day 35!

A quick summary of today:

Some of the material is summarised below ^^

Sequential vs Functional API

image

image

When using a functional API, the input layer must be defined directly and each layer must be attached at the end of the next layer. And the input and output of the model must also be defined. Because a model composed of functional APIs can have various inputs and outputs

image

Functional APIs allow complex models to be configured

image

Rather than that model, I’ll describe it as a simpler model

image

In addition, the performance and loss functions of each output can be defined separately

image

Siamese network model

The Simesen network is a model with two inputs and one output

image

image

For example, you can make a model that can compare clothes

image

The T-shirts were similar, so I classified them as 1.0 (conversely, it would have classified them as 0).

Custom loss function

image

If the absolute value of a is less than the threshold we defined, 1/2 * a**2, conversely, threshold * (abs(a) - 1/2 * threshold) Simple version can be used as follows

image

image

Still, there is a better way to organize threshold values (with Class)

image

Custom layers

image

image

image

Custom models

We can make custom/complex models using the functional API

image

image

But we can do more complicated models than that

This is an example of ResNet.

image

I first learned about ResNet on Day 28, but I didn’t understand how to do it. But today I found out how functional api can be used.

image

image


That is all for today!

See you tomorrow :)

Original post in Korean