跳到主要內容

發表文章

目前顯示的是 5月, 2019的文章

tf.squeeze()

Ref: https://blog.csdn.net/qq_31780525/article/details/72280284 tf.squeeze() Function tf.squeeze(input, squeeze_dims=None, name=None) Removes dimensions of size 1 from the shape of a tensor. 从tensor中删除所有大小是1的维度 Given a tensor input, this operation returns a tensor of the same type with all dimensions of size 1 removed. If you don’t want to remove all size 1 dimensions, you can remove specific size 1 dimensions by specifying squeeze_dims.  给定张量输入,此操作返回相同类型的张量,并删除所有尺寸为1的尺寸。 如果不想删除所有尺寸1尺寸,可以通过指定squeeze_dims来删除特定尺寸1尺寸。 如果不想删除所有大小是1的维度,可以通过squeeze_dims指定。 For example: # 't' is a tensor of shape [ 1 , 2 , 1 , 3 , 1 , 1 ] shape(squeeze(t)) ==> [ 2 , 3 ] Or , to remove specific size 1 dimensions: # 't' is a tensor of shape [ 1 , 2 , 1 , 3 , 1 , 1 ] shape(squeeze(t, [ 2 , 4 ])) ==> [ 1 , 2 , 3 , 1 ]

tf.slice()

Ref: https://www.tensorflow.org/api_docs/python/tf/slice tf.slice tf . slice (     input_ ,     begin ,     size ,     name = None ) input_ : A   Tensor . begin : An   int32   or   int64   Tensor . size : An   int32   or   int64   Tensor . name : A name for the operation (optional). t = tf . constant ([[[ 1 , 1 , 1 ], [ 2 , 2 , 2 ]],                   [[ 3 , 3 , 3 ], [ 4 , 4 , 4 ]],                   [[ 5 , 5 , 5 ], [ 6 , 6 , 6 ]]]) tf . slice ( t , [ 1 , 0 , 0 ], [ 1 , 1 , 3 ])   # [[[3, 3, 3]]] tf . slice ( t , [ 1 , 0 , 0 ], [ 1 , 2 , 3 ])   # [[[3, 3, 3],                                     #   [4, 4, 4]]] tf . slice ( t , [ 1 , 0 , 0 ], [ 2 , 1 , 3 ])   # [[[3, 3, 3]],                                     #  [[5, 5, 5]]]

tf.cast()

Ref: https://blog.csdn.net/UESTC_C2_403/article/details/72190282 tf.cast用法 tf.cast:改變tensor的資料型態 例如: import tensorflow as tf; import numpy as np; A = tf.convert_to_tensor(np.array([[ 1 , 1 , 2 , 4 ], [ 3 , 4 , 8 , 5 ]])) with tf.Session() as sess: print A.dtype b = tf.cast(A, tf.float32) print b.dtype 输出: <dtype: 'int64'> <dtype: 'float32'>

{}大括弧在PYTHON的2種用法

Ref: https://stackoverflow.com/questions/9197324/what-is-the-meaning-of-curly-braces {}大括弧在PYTHON的2種用法: "Curly Braces" are used in Python to define a dictionary. A dictionary is a data structure that maps one value to another - kind of like how an English dictionary maps a word to its definition. Python: 1. dict = { "a" : "Apple" , "b" : "Banana" , } 2. They are also used to format strings, instead of the old C style using %, like: ds = [ 'a' , 'b' , 'c' , 'd' ] x = [ 'has_{} 1' . format ( d ) for d in ds ] print x [ 'has_a 1' , 'has_b 1' , 'has_c 1' , 'has_d 1' ]

Haar

Haar Cascade is usually used in face detection, in fact, it can be used to detect any object. There are many trained Haar classifier in OpenCV source code: frank@frank-GL753VD:~$ ls /home/frank/1T/back0529/opencv/data/haarcascades/ haarcascade_eye_tree_eyeglasses.xml haarcascade_eye.xml haarcascade_frontalcatface_extended.xml haarcascade_frontalcatface.xml haarcascade_frontalface_alt2.xml haarcascade_frontalface_alt_tree.xml haarcascade_frontalface_alt.xml haarcascade_frontalface_default.xml haarcascade_fullbody.xml haarcascade_lefteye_2splits.xml haarcascade_licence_plate_rus_16stages.xml haarcascade_lowerbody.xml haarcascade_profileface.xml haarcascade_righteye_2splits.xml haarcascade_russian_plate_number.xml haarcascade_smile.xml haarcascade_upperbody.xml Ref: wiki 它們因為與 哈爾小波轉換  極為相似而得名,是第一種即時的 人臉檢測 運算。

Frameworks overview

Picture courtesy from Paul Huang

StarGAN

Ref: https://github.com/yunjey/stargan https://arxiv.org/pdf/1711.09020.pdf StarGAN 如圖 (b) 與其他 GAN 模型相較 ,  受到關注的特色在於其不同 Domain 間的轉換可以使用同一個模 型 ,  不需要一對一 Domain 的產生很多組模型 ,  如圖 (a). Picture originated from:   https://arxiv.org/pdf/1711.09020.pdf 下圖是使用 StarGAN 生成的圖片 ,  一組有六張 ,  分別是 Input +  Black_Hair  + Golden_Hair  + Brown_Hair  + Gender_Change  + Aged   共 5 個 Domain Train 這個模型在 FX705GE(CPU:INTEL i7-8750H, 32G RAM) 上花了約 39 小時作 Training,  總共 200,000 steps,  執行速度 7 sec/ 10steps , 相對 GL753VE(CPU:INTEL i7-7700HQ, 24G RAM) 90 sec/ 10steps <==  只是 worker node,  未開啟 NVIDIA CUDA 從下列 image 看來效果有好有壞 ,  視人頭比例 , training dataset,  相片品質及背景等條件而異 . 感謝同仁們 ( 含 EX-) 及致中提供玉照協助 !!  使用 celebrity dataset 作 training  及部份 testing         Input               +  Black_Hair        +  Golden_Hair     +  Brown_Hair        +  Gender_Change  +  Aged                Input            +  Black_Hair        +  Golden_Hair      +  Brown_Hair      +  Gender_Change  +

Works at Academia Sinica

384 DNA synthesizer 384 oligonucleotide Synthesizer: PC based systems with GUI sends commands to Parker AT6250 motion control card and IO module to move nozzle seat for reagent injection in X-Y direction via two stepper motors according to the programmed coordinate, and then turn on the solenoid valves to inject a variety of chemical reagents into reaction wells. These synthesizers consume less reagents and synthesize more (384 or 1536) sequences of oligonucleotide at single operation. Their productivity outnumbers any commercial ones. 1536 DNA synthesizer 1536 oligonucleotide Synthesizer: Four modules of 384 oligonucleotide synthesizer were built together to boost the productivity to 1536 custom oligonucleotide in each synthesis operation. Implementation of tile injection nozzles and 4 times of solenoid valves to achieve simultaneous synthesis eliminate the need of 4-fold of time for synthesis. Micro Arrayer Micro Arrayer: A PC