2017의 게시물 표시

StackOverFlow Code Indent

Ctrl+K

CNN 으로 월리 찾기

https://github.com/tadejmagajna/HereIsWally.git

PyTorch Ensembler

https://github.com/QuantScientist/Deep-Learning-Boot-Camp/tree/master/Kaggle-PyTorch

얼굴표정 검출 by TF

https://github.com/barkdong123/face_expression_detector.git

imBalanced Learning by python

https://github.com/scikit-learn-contrib/imbalanced-learn.git

Jetson TX1 + OFX + TensorRT

http://takesan.hatenablog.com/entry/2017/01/17/214203

Jetson TX1 + OFX

http://takesan.hatenablog.com/entry/2016/12/19/214455

Video CoSegmentation

https://github.com/GYZHikari/Semantic-Cosegmentation.git

SKORCH = scikitlearn + PyTorch

https://github.com/dnouri/skorch/blob/master/README.rst

ONNX install for Mac

git clone --recursive https://github.com/onnx/onnx.git   git submodule update --init

Jupyter notebook + Python3 kernel install in mac/Linux

sudo pip3 install ipython [ notebook ]

POC Stitching

https://thilinasameera.wordpress.com/2012/03/24/translation-invariant-image-registration-using-phase-correlation-panorama-imaging-on-matlab/

ConvNet의 인퍼런스 속도를 높이는 4가지 방법

Play with your model and training hyper parameters. You might be able to use a lighter model without a significant degradation in performance, for example, decrease the network’s depth, width, number of filters, floating point accuracy… etc. This and methods #2,4 will allow you to increase your batch size and increase your inference bandwidth. Explore network architectures that are optimized for ‘lighter’ hardware such as  Squeeze Net . NVIDIA offers a network inference optimizer called  TensorRT  that is designed exactly for your need - optimize your network for deployment. This is a more novel solution to increase inference speed but it should work -  a famous paper by Geoffrey Hinton allows you to distill the knowledge in the network  and compress it into a smaller network. This will somewhat degrade your performance, but the paper showed that the accuracy penalty is not very significant compared to the savings in model complexity.

Homomorphic by C++

https://github.com/LaurentBerger/HomomorphicFiltering.git

QML for julia

https://github.com/barche/QML.jl

Genie Manual for Julia

https://github.com/essenciary/JuliaCon-2017-Slides/blob/master/v1.1/f-1.pdf

LPF HPF by Julia

julia> using ImageFiltering, TestImages julia> img = testimage( "mandrill" ); julia> imgg = imfilter(img, Kernel.gaussian( 3 )); julia> imgl = imfilter(img, Kernel.Laplacian());

Speed of Julia

이미지

Julia Manual

https://juliabyexample.helpmanual.io/

Julia package Lists

https://pkg.julialang.org/

Image registration by Julia

> using Images, TestImages > img = testimage ( " mandril_gray " ); > img2 = subpixelshift (img, 40.3 , 30.7 ); > dftReg (img2,ref = img,ufac = 10 ) 1 x3 Array{Float64, 2 } : 0.332617 - 40.3 - 30.7

Bayesian filtering in the frequency domain¶

https://github.com/AllenDowney/ProbablyOverthinkingIt/blob/master/convolution.ipynb

Lena on TX1 by OpenCV C++

이미지

Edit CMakeLists.txt for OpenCV in Linux

https://www.youtube.com/watch?v=lQfWANnqmps&t=365s

LHT by Octave

https://github.com/taochenshh/Find-Lines-and-Circles-in-an-Image-Hough-Transform-.git

OFXCodeMenu for Xcode

https://github.com/openframeworks/OFXcodeMenu.git

FFT with OFX

https://github.com/kylemcdonald/ofxFft.git

StarGAN by PyTorch

https://github.com/yunjey/StarGAN.git

Spectral Saliency with QuaternionFT by Python

https://github.com/wandering007/spectral-based-saliency.git

3D kMeans T-SNE with XCode

이미지
https://github.com/tespin/ofxKMeans-TSNE.git

Rotation Invariant POC by Python

https://gist.github.com/daisukekobayashi/8559562

Spectral Residual Saliency by Python-OpenCV, cpp

https://github.com/uoip/SpectralResidualSaliency.git

deblurGAN by PyTorch

https://github.com/KupynOrest/DeblurGAN.git

open finder in mint terminal

xdg-open .

트랜스퍼런닝과 차별 러닝레이트

https://towardsdatascience.com/transfer-learning-using-differential-learning-rates-638455797f00

weight-norm GAN by PyTorch

https://github.com/stormraiser/GAN-weight-norm.git

spectral-norm GAN by TF

https://github.com/minhnhat93/tf-SNDCGAN

모든 jpg을 가로로 뒤집어 floped 디렉토리로 png로 저장.

mogrify -path ../floped -format png -flop *.jpg

wGAN-GP by PyTorch

https://github.com/caogang/wgan-gp.git

Actor Critic by PyTorch

https://github.com/ikostrikov/pytorch-a3c.git

DiracNet by PyTorch

https://github.com/szagoruyko/diracnets.git

GAN 슈도코드

이미지

맥오에스 재설치시에 복구설치가 안될때 ..

설치메뉴 유틸 > 터미널에서 date MMDDhhmmYY 로 현재 시각으로 변경.

Run PyTorch in XCode

이미지

Various Kurtogram

이미지

Saving model in pytorch

torch.save(model_ft, "modelFT_60.pth")

six windows

#!/bin/bash for file in *.wav do     outfile= "${file%.*}1.png"     sox "$file" -n spectrogram -x 512 -w hann -a -r -o "$outfile"     outfile= "${file%.*}2.png"     sox "$file" -n spectrogram -x 512 -w hamming -a -r -o "$outfile"     outfile= "${file%.*}3.png"     sox "$file" -n spectrogram -x 512 -w bartlett -a -r -o "$outfile"     outfile= "${file%.*}4.png"     sox "$file" -n spectrogram -x 512 -w rectangular -a -r -o "$outfile"     outfile= "${file%.*}5.png"     sox "$file" -n spectrogram -x 512 -w kaiser -a -r -o "$outfile"     outfile= "${file%.*}6.png"     sox "$file" -n spectrogram -x 512 -w dolph -a -r -o "$outfile" done

bin2Gray.py

#!/usr/bin/python import os import re import numpy import scipy.misc import os, array from scipy import ndimage, misc # aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa images = [] for root, dirnames, filenames in os.walk( "." ):     for filename in filenames:         if re.search( "\.(vir)$" , filename):             filepath = os.path.join(root, filename)             f = open(filename, 'rb' );             ln = os.path.getsize(filename); # length of file in bytes             width = numpy.int(numpy.ceil(numpy.sqrt(ln)));             rem = ln % width;                          a = array.array( "B" ); # uint8 array             a.fromfile(f, ln-rem);        ...

wav to scalogram

#!/usr/bin/python import os import re import numpy import scipy.misc import os, array from scipy import ndimage, misc from wavelets import WaveletAnalysis import wave import sys import matplotlib.pyplot as plt images = [] for root, dirnames, filenames in os.walk("."): for filename in filenames: if re.search("\.(wav)$", filename): filepath = os.path.join(root, filename) f = open(filename,'rb'); ln = os.path.getsize(filename); # length of file in bytes spf = wave.open(filename,'r') #Extract Raw Audio from Wav File signal = spf.readframes(-1) signal = numpy.fromstring(signal, 'Int8') # and a sample spacing dt = 10 wa = WaveletAnalysis(signal, dt=dt) # wavelet power spectrum power = wa.wavelet_power # scales scales = wa.scales # associated time vector t = wa.time # reconstruction of the original dat...

PyTorch DataParallel

https://github.com/hunkim/PyTorchZeroToAll/blob/master/tutorials/PyTorchDataParallel.ipynb

dstat option

이미지

CapsNet by PyTorch

https://github.com/gram-ai/capsule-networks.git

rename from CSV

path = 'Malware500' tmp_path = 'data' with open('Malware500.csv','rb') as csvfile:     reader = csv.reader(csvfile, delimiter = ',')     for row in reader:        oldname = os.path.join(path, row[0])        if os.path.exists(oldname):            newname = os.path.join(tmp_path, row[1])            os.rename(oldname, newname)            print >> sys.stderr, "renamed '%s' to '%s'" % (oldname, newname)        else:            print >> sys.stderr, "file '%s' not found" % oldname

train data scaling in PyTorch

# Data augmentation and normalization for training # Just normalization for validation data_transforms = {     'train' : transforms.Compose([         transforms.Scale( 256 ),         transforms.RandomSizedCrop( 224 ),         transforms.RandomHorizontalFlip(),         transforms.ToTensor(),         transforms.Normalize([ 0.485 , 0.456 , 0.406 ], [ 0.229 , 0.224 , 0.225 ])     ]),     'val' : transforms.Compose([         transforms.Scale( 256 ),         transforms.CenterCrop( 224 ),         transforms.ToTensor(),         transforms.Normalize([ 0.485 , 0.456 , 0.406 ], [ 0.229 , 0.224 , 0.225 ])     ]), }

specify GPU ID

.cuda(1)

files split by csv column

cat Malware_random_list_1st_500_noHeader.csv | awk -F "," '{print "cp Malware_samples_1st_500/"$1".vir Malware_samples_1st_500_class/"$3}' | sh 헤더 제거,

BlackBox Explain by PyTorch

https://github.com/jacobgil/pytorch-explain-black-box.git

preTrained ResNet151, InceptionV4

https://github.com/Cadene/pretrained-models.pytorch

SPN by Pytorch

https://github.com/yeezhu/SPN.pytorch.git

MFCC by librosa

이미지
import librosa import librosa.display # Generate mfccs from a time series y, sr = librosa.load( '0acdb43dae5a7a66945bc44ee87ee67cd64f4e9dabf2817ab59ffe8bf9093778.wav' ) librosa.feature.mfcc(y=y, sr=sr) # array([[ -5.229e+02,   -4.944e+02, ...,   -5.229e+02,   -5.229e+02], # [   7.105e-15,   3.787e+01, ...,   -7.105e-15,   -7.105e-15], # ..., # [   1.066e-14,   -7.500e+00, ...,   1.421e-14,   1.421e-14], # [   3.109e-14,   -5.058e+00, ...,   2.931e-14,   2.931e-14]]) # Use a pre-computed log-power Mel spectrogram S = librosa.feature.melspectrogram(y=y, sr=sr, n_mels= 128 ,                                    fmax= 8000 ) librosa.feature.mfcc(S=librosa.power_to_db(S)) # array([[ -5.207e+02,   -4.898e+02, ...,   -5.207e+02,   -5.207e+02], # [ -2.576e-14,   4.054e...

rename file by a csv column

import os import csv with open ( 'names.csv' ) as f : lines = csv . reader ( f ) for line in lines : os . rename ( line [ 0 ], line [ 1 ])

capsNet by TF

https://github.com/debarko/CapsNet-Tensorflow

image processing with scikit-learn

http://scikit-image.org/docs/dev/auto_examples/index.html

POC by scikit-image

http://scikit-image.org/docs/dev/auto_examples/transform/plot_register_translation.html

another tensorBoard 4 pytorch

https://github.com/lanpa/tensorboard-pytorch.git

RCN Recursive Cortical Network

이미지
(RCN·Recursive Cortical Network)를 개발해 캡차를 94.3%의 확률로 뚫었다고 밝혔다. 캡차는 텍스트를 의도적으로 비틀거나 덧칠해 컴퓨터가 인식하기 어렵게 만든 암호다. 주로 6~8자의 알파벳이나 숫자를 일그러뜨려 제시한 뒤 이를 올바르게 인식하면 사람으로 판명한다. 자동화한 프로그램이 캡차를 해독할 확률은 1% 이하라고 알려져 있었다. 비카리어스AI가 개발한 RCN은 사람이 물체를 인식하는 방식을 따라한 알고리즘이다. 사람은 알파벳 A를 몇 번 따라 쓰며 학습하면 그 글자를 뒤집고, 기울이고, 비틀어도 알아볼 수 있다. 이를 AI에 접목한 것이다. 비카리어스AI가 개발한 알고리즘이 텍스트를 인식하는 과정. - 비카리어스AI 제공 RCN은 두 번의 과정을 거쳐 정보를 처리한다. 우선 문자의 윤곽선에 점을 찍어 좌표로 만들어 형태를 읽어낸다. 이후 윤곽선 내부 표면의 색이나 균일도 등을 읽는다. RCN은 새로운 글자를 접하면 이 과정을 거쳐 정보를 처리하고, 기존에 배운 글자와 비교해 결론을 낸다. 기존 딥러닝으로 학습한 텍스트인식 AI는 암호의 형태가 조금만 달라져도 암호를 풀지 못한다. 가령 글자의 자간을 15%만 넓히면 38.4%, 25% 넓히면 7% 수준으로 해독률이 급격히 떨어진다. 반면 RCN은 자간이 달라지거나 비트는 방식을 바꿔도 해독률은 그대로다. 2300만 건의 이미지를 통해 학습한 딥러닝 알고리즘이 89.9%의 확률로 캡차를 해독하는 반면 RCN은 고작 500개의 이미지로 학습하고도 해독률이 더 높다. 효율을 5만 배가량 높인 셈이다. 딜립 조지 비카리어스AI 연구원은 “사람이 리캡차를 해독하는 확률도 87.4%에 그칠 정도로 암호의 형태가 복잡해졌지만 AI가 간단한 학습을 통해 이를 풀어낼 수 있다는 것을 실증했다. 더 발전된 보안 기술이 필요할 것”이라고 말했다.

feature importance in label view

http://scikit-learn.org/stable/auto_examples/ensemble/plot_forest_importances.html

image save using matplotlib

import numpy as np import matplotlib . pyplot as plt # some data (512x512) import scipy . misc data = scipy . misc . lena () # a colormap and a normalization instance cmap = plt . cm . jet norm = plt . Normalize ( vmin = data . min (), vmax = data . max ()) # map the normalized data to colors # image is now RGBA (512x512x4) image = cmap ( norm ( data )) # save the image plt . imsave ( 'test.png' , image )

2D FFT by R & Imager Processing

https://dahtah.github.io/imager/imager.html#ffts-and-the-periodicsmooth-decomposition

Plot accuracy in train time

https://github.com/yunjey/pytorch-tutorial/blob/master/tutorials/02-intermediate/convolutional_neural_network/main.py#L83-L90

OpenNMT by PyTorch

https://github.com/OpenNMT/OpenNMT-py.git

Network Pruning by PyTorch

https://jacobgil.github.io/deeplearning/pruning-deep-learning

DeepDream by pytorch

https://github.com/SherlockLiao/Deep-Dream.git

Visual Attention by Pytorch

https://github.com/eladhoffer/seq2seq.pytorch.git seq2seq

cifar10 dataset loading by pytorch

https://github.com/kyuhyoung/pytorch_60min_blitz.git

Policy Gradient by PyTorch

https://github.com/spro/practical-pytorch.git

CUDA POC by Python

https://github.com/FelixLaufer/CUDARegistration.git

얼굴책의 협상가능 챗봇 by PyTorch

https://github.com/facebookresearch/end-to-end-negotiator.git

VQA1 by PyTorch

https://github.com/Cadene/vqa.pytorch.git

Kind PyTorch Tut

https://github.com/GunhoChoi/Kind-PyTorch-Tutorial.git

PyTorch API

https://github.com/j-min/pytorch_exercise/blob/master/torch_API.ipynb

attention-is-all-you-need-pytorch

https://awni.github.io/pytorch-tensorflow/

csv split by one column values

import pandas csv = pandas . read_csv ( 'test.csv' , sep = ',' , header = 3 , skipinitialspace = True ) # header=3 because your header is on the third line # skipinitialspace is set to True because your example data has spaces after commas csv_apples = csv [ csv [ 'Fruit' ] == 'Apple' ] csv_bananas = csv [ csv [ 'Fruit' ] == 'Banana' ] csv_apples . to_csv ( 'apples.csv' , index = False , sep = ',' ) csv_bananas . to_csv ( 'bananas.csv' , index = False , sep = ',' )

VGG face2 Dataset

http://www.robots.ox.ac.uk/~vgg/data/vgg_face2/

tensorBoard logging for pytorch

1. 로거 패키지 로딩 import torch import torch.nn as nn import torchvision.datasets as dsets import torchvision.transforms as transforms from torch.autograd import Variable # 로거 패키지 로딩 *********(1) from logger import Logger 2. 로거 경로 설정 # 로거의 로그경로 설정 logger = Logger( './logs' ) 3. 텐서보드 로깅         # (1) Log the scalar values ************** (3)         info = {             'loss' : loss.data[ 0 ],             'accuracy' : accuracy.data[ 0 ]         }         for tag, value in info.items():              logger.scalar_summary(tag, value, step +1 )

딥러닝은 더이상 블랙박스 툴이 아니다.

- 알비엠은 스토케스틱이고 딥러닝은 디터미니스틱 접근방법이다. - 인간생체신호 펄스처럼 작동하는 스파이킹 뉴럴네트웍 - 덴스넷은 레즈넷에서 아이덴티티루프를 더하는게 아니라 옆에 붙이는 것이다. - 이미지넷 사진갯수는 2017년 현재 천만장이다. - 아담보다 네스테로브가 더 학습을 잘할때도 있다. - 사람도 아기때는 비지도학습, 청소년이되선 지도학습을 한다. - 드랍아웃은 요즘 많이 안쓴다 - 배치노멀라이제이션은 데이타 분포를 시그모이드의 중앙으로 이동시키는 것이다. - 네트웍을 가지치기한후 재학습시켜 성능을 높이기도 한단다. 비임베디드 넷 프루닝. - KLD > JSD > 와써스타인 다이버젼스 - 안정정인 학습을 시켜주는 wGAN - 텍스트 같은 디스크릿 데이타는 갠 학습이 어렵다. - 텍스트를 생성해주는 seqGAN - 쌍을 이루지 않는 무작위 클래스데이타로부터 규칙을 학습하는 CycleGAN - 딥러닝의 결과에 대한 설명을 가능하게 해주련ㄴ 노력들. CAM, LIME 등등 - 클래스판단 근거를 샐리언시맵으로 보여주는 CAM - 입력 주변의 랜덤벡터로 선형모델을 만들어 해석하는 LIME - 결과에 가장크게 기여하는 학습데이타를 알려주는 influence Function - 분류결과를 겸손하게 만들어주는 기술. - 경제적 앙상블인 셈인 드랍아웃은 가우시안 프로세스와 유사하다고. - 성격이 다른 학습데이타들을 합치는 VAE 멀티모덜 트레이닝 기법 - 스스로 규칙을 찾아내는 VQA 와 RN의 원리. - VQA는 이미 인간 성능을 넘어섰다고.. - RN은 CNN과 FC의 중간이다. - RN은 피쳐들 뿐 아니라 피쳐들의 위치정보 또한 공유한다. - CNN 입력에 약간에 노이즈를 섞으면 ...

Wasserstein Estimate on GAN

이미지

Tensor var appeding to file

f = open( 'anoScore0728n.txt' , 'w' )      f.write(str(aScoreMean.data[ 0 ]))       f.write( '\n' )                    sumASM += aScoreMean       k += 1 f.close()