11월, 2017의 게시물 표시

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