Tuesday, November 24, 2020

Online latex editor

very easy to use and quick! https://www.codecogs.com/latex/eqneditor.php

Sunday, September 6, 2020

use case of decorator function in python

def layer(func): def layer_decorated(self): print('func is wrapped'); func(self) return self return layer_decorated class Network(object): data = 0 def __init__(self): self.data = 1024 # conv = layer(conv)와 같은 의미 @layer def conv(self): print('conv is called')

Saturday, September 5, 2020

Tuesday, August 4, 2020

landmark CNN

1. Output size

This model generate 68 landmarks and coordinate of the landmarks are 2D. (x,y)
so output size will be 68 * 2 = 136

self.dense_2 = keras.layers.Dense(units=self.output_size,
                                        activation=None,
                                        use_bias=True)

2. Layers

self.conv_1 = keras.layers.Conv2D(filters=32,
                                kernel_size=(3, 3),
                                activation='relu')
self.conv_2 = keras.layers.Conv2D(filters=64,
                                kernel_size=(3, 3),
                                strides=(1, 1),
                                padding='valid',
                                activation='relu')
self.conv_3 = keras.layers.Conv2D(filters=64,
                                kernel_size=(3, 3),
                                strides=(1, 1),
                                padding='valid',
                                activation=tf.nn.relu)
self.conv_4 = keras.layers.Conv2D(filters=64,
                                kernel_size=(3, 3),
                                strides=(1, 1),
                                padding='valid',
                                activation='relu')
self.conv_5 = keras.layers.Conv2D(filters=64,
                                kernel_size=[3, 3],
                                strides=(1, 1),
                                padding='valid',
                                activation='relu')
self.conv_6 = keras.layers.Conv2D(filters=128,
                                kernel_size=(3, 3),
                                strides=(1, 1),
                                padding='valid',
                                activation='relu')
self.conv_7 = keras.layers.Conv2D(filters=128,
                                kernel_size=[3, 3],
                                strides=(1, 1),
                                padding='valid',
                                activation='relu')
self.conv_8 = keras.layers.Conv2D(filters=256,
                                kernel_size=[3, 3],
                                strides=(1, 1),
                                padding='valid',
                                activation='relu')

Generally when we construct CNN networks, first parameter of Conv2D function is the count of filters. Don't be confused with the size of the images. size of the images will be reduced by polling layers not conv layers. Like above layers, filters will be 32 -> 64 -> 128 -> 256 at the end all of the filters are going to be connected with Dense layer and use flatten function.

3. Input shape.
I used (128, 128, 3) shape. (Height, Width, Channel)

4. Who call the call() function in the keras's Model.
When we call build() function, it will call the call() function and pass the input shape. after this we can use summary() function.

Wednesday, July 29, 2020

Select non-NA values from the Pandas dataframe.

Used to be like this.

iselect=np.nonzero(LMs.left_eye_center_x.notna() & LMs.right_eye_center_x.notna() &
         LMs.nose_tip_x.notna() & LMs.mouth_center_bottom_lip_x.notna())[0]


instead we can use dropna function.

iselect = LMs.dropna(subset=['left_eye_center_x', 'right_eye_center_x', 'nose_tip_x', 'mouth_center_bottom_lip_x'])

much simpler right?

Task in UnrealEngine

 https://www.youtube.com/watch?v=1lBadANnJaw