2018년 6월 8일 금요일

keras gpu config session

import keras

config = tf.ConfigProto( device_count = {'GPU': 0 , 'CPU': 30} )
sess = tf.Session(config=config) 
keras.backend.set_session(sess)

model.fit(x_train, y_train, epochs=epochs, validation_data=(x_test, y_test))

2018년 5월 29일 화요일

RNN , LSTM 관련

http://aikorea.org/blog/rnn-tutorial-2/
여기서RNN의 Numpy 구현이 들어있다. 한번 해봐야 겠다.
RNN -> LSTM -> Attention 쪽 공부 필요. 

파이썬 비동기 , 정적 타입 사용 방법. 제너레이터

비동기 파이썬 :
https://mingrammer.com/translation-asynchronous-python/

타이핑 :
https://docs.python.org/3/library/typing.html

https://item4.github.io/2017-09-14/Python-Typing-with-mypy/


제너레이터 :
https://item4.github.io/2018-03-04/What-is-The-Yield-From-Keyword-in-Python/
https://item4.github.io/2016-05-09/Generator-and-Yield-Keyword-in-Python/


2018년 5월 24일 목요일

2018년 5월 18일 금요일

plotting 에 대해서

https://seaborn.pydata.org/tutorial/distributions.html


f, axes = plt.subplots(2, 2, figsize=(14, 14), sharex=True)


sns.heatmap(similarities, vmax=1.0 , vmin = 0.0 , square=True , ax = axes[0,0])
sns.distplot(histo , hist = True , bins = 10 , rug = True , ax = axes[0,1] )
plt.show()


기본적인 패턴이다. 


다음 링크는 페어 플롯 이란 것아ㅣ다 

https://towardsdatascience.com/visualizing-data-with-pair-plots-in-python-f228cf529166


데이터 비주얼 라이즈에 관한 링크1
https://cacm.acm.org/magazines/2010/6/92482-a-tour-through-the-visualization-zoo/fulltext

2018년 5월 17일 목요일

차원에 대해서

http://terryum.io/korean/2016/05/05/FeatureSelection_KOR/
차원 축소에 관해 . latent space 에 관한 이야기도 있다.

https://arxiv.org/pdf/1601.07996.pdf


차원 축소 기술 모음 !! 매우 좋다.
http://www.cs.cmu.edu/~efros/courses/AP06/presentations/melchior_isomap_demo.pdf

2018년 5월 15일 화요일

jupyterlab 단축키 지정법


commands 에 Notebook operations 에  restart kernel and run all cells 라는 것을

단축키 지정 하고 싶다.

먼저 https://github.com/jupyterlab/jupyterlab/blob/master/packages/notebook-extension/src/index.ts#L224

여기에 보면 command 안의 명령들의 명칭들을 볼 수 있다.

export
const restartRunAll = 'notebook:restart-run-all';

이렇게 되어있다.

"notebook:@@여기에는 소문자오 command 안의 내용을 쓴다. 스페이스는 - 로": {
      "command": @@ 여기에 위의 '' 안의 내용을 써준다.

이렇게

command 에는 Restart Run All 로 되어있으므로 restart-run-all 이라고

"notebook:restart-run-all": {
      "command": "notebook:restart-run-all",
      "keys": [
        "Shift 2"
      ],
      "selector": "[data-jp-kernel-user]:focus"
    },
     
       

---- 내 설정
{
"kernelmenu:restart": {
      "command": "kernelmenu:restart",
      "keys": [
        "Shift 1"
      ],
      "selector": "[data-jp-kernel-user]:focus"
    },
       
"notebook:restart-run-all": {
      "command": "notebook:restart-run-all",
      "keys": [
        "Shift 2"
      ],
      "selector": "[data-jp-kernel-user]:focus"
    },
       
"notebook:notebook:run-all-above": {
      "command": "notebook:run-all-above",
      "keys": [
        "Shift 3"
      ],
      "selector": "[data-jp-kernel-user]:focus"
    },
       
"notebook:close-and-shutdown": {
      "command": "notebook:close-and-shutdown",
      "keys": [
        "Shift 4"
      ],
      "selector": "[data-jp-kernel-user]:focus"
    },

       
  "notebook:collapse-selected-outputs": {
    "command": "notebook:hide-cell-outputs",
    "keys": [
      "Q"
    ],
    "selector": ".jp-Notebook:focus"
  },   

    "notebook:expand-selected-outputs": {
    "command": "notebook:show-cell-outputs",
    "keys": [
      "Q",
      "Q"
    ],
    "selector": ".jp-Notebook:focus"
  },   
 

  "notebook:collapse-selected-code": {
    "command": "notebook:hide-cell-code",
    "keys": [
      "W"
    ],
    "selector": ".jp-Notebook:focus"
  },
     
"notebook:expand-selected-code": {
    "command": "notebook:show-cell-code",
    "keys": [
      "W",
      "W"
    ],
    "selector": ".jp-Notebook:focus"
  },
     
     
             
"notebook:expand-all-inpouts": {
    "command": "notebook:show-all-cell-inputs",
    "keys": [
      "E",
      "E"
    ],
    "selector": ".jp-Notebook:focus"
  },
     
"notebook:collapse-all-inputs": {
    "command": "notebook:hide-all-cell-inputs",
    "keys": [
      "E"
    ],
    "selector": ".jp-Notebook:focus"
  },
     
   
"notebook:expand-all-code": {
    "command": "notebook:show-all-cell-code",
    "keys": [
      "R",
      "R"
    ],
    "selector": ".jp-Notebook:focus"
  },
     
"notebook:collapse-all-code": {
    "command": "notebook:hide-all-cell-code",
    "keys": [
      "R"
    ],
    "selector": ".jp-Notebook:focus"
  },
     
       
"notebook:change-to-cell-heading-1": {
      "command": "notebook:change-cell-to-heading-1",
      "keys": [
       
      ],
      "selector": ".jp-Notebook:focus"
    },
       
    "notebook:change-to-cell-heading-2": {
      "command": "notebook:change-cell-to-heading-1",
      "keys": [
       
      ],
      "selector": ".jp-Notebook:focus"
    },
        "notebook:change-to-cell-heading-3": {
      "command": "notebook:change-cell-to-heading-1",
      "keys": [
       
      ],
      "selector": ".jp-Notebook:focus"
    },
        "notebook:change-to-cell-heading-4": {
      "command": "notebook:change-cell-to-heading-1",
      "keys": [
       
      ],
      "selector": ".jp-Notebook:focus"
    },
        "notebook:change-to-cell-heading-5": {
      "command": "notebook:change-cell-to-heading-1",
      "keys": [
       
      ],
      "selector": ".jp-Notebook:focus"
    },
           
"notebook:change-cell-to-raw": {
      "command": "notebook:change-cell-to-raw",
      "keys": [
     
      ],
      "selector": ".jp-Notebook:focus"
    }
   
}

2018년 5월 1일 화요일

딥러닝 정보

- 오브젝트 디텍트 관련 정리 블로그
https://handong1587.github.io/deep_learning/2015/10/09/object-detection.html


- one show learning
https://blog.lunit.io/tag/one-shot-learning/

- 트리
https://ratsgo.github.io/machine%20learning/2017/03/26/tree/


- CNN 주요 모델
https://ratsgo.github.io/deep%20learning/2017/10/09/CNNs/

- 딥러닝 스터디 정보
http://deeplearningstudy.github.io/doc_deeplearning_paper.html

- 2017 딥러닝 정보
http://www.wildml.com/2017/12/ai-and-deep-learning-in-2017-a-year-in-review/

- 2017 딥러닝 토픽
https://iclr.cc/archive/www/2017.html

- 2017 최고의 논문에 관한 논의
https://www.reddit.com/r/MachineLearning/comments/6oyg1w/r_cvpr_2017_best_paper_awards/

- 영상처리 카이스트 강좌 - 최적화?
http://kooc.kaist.ac.kr/optimization2017

- 레딧 - 머신러닝 강좌
https://www.reddit.com/r/learnmachinelearning/

- 상받은 논문 소개 블로그
https://stair.center/archives/601

- http로 딥러닝 런 사이트 만들기
https://www.linkedin.com/pulse/complete-guide-build-convnet-http-based-application-using-ahmed-gad

- 2018 이미지 트랜스포트 유명 논문
https://arxiv.org/abs/1804.04732

- 논문 리뷰 (설명 잘되있다.)
https://blog.lunit.io/category/paper-review/

- 이상한 딥러닝 관련 비디오
http://www.evolvingai.org/deep-learning

-딥러닝 관련 웃긴 글
http://kr.deductiontheory.com/2017/01/blog-post.html

-score
http://blog.acronym.co.kr/557

- 인셉션 모델 자세한 설명
https://hacktilldawn.com/2016/09/25/inception-modules-explained-and-implemented/

- 여러 슬라이드 모음
https://www.slideshare.net/ssuser06e0c5?utm_campaign=profiletracking&utm_medium=sssite&utm_source=ssslideview

- 텐서플로우 최신 기능 리뷰 블로그
https://hiseon.me/2018/04/15/tensorflow-dataset/

2018년 4월 12일 목요일

quiver_engine 설치 오류 해결 방법

https://github.com/keplr-io/quiver/issues/32


agree with upstair, detail desrcription:
  1. search keyword "quiver“ at pypi webside (https://pypi.python.org/pypi);
  2. download one of quiver package name "quiver_engine 0.1.4.1.4";
  3. unzip it on local disk and "cd ....\quiver_engine 0.1.4.1.4\”;
  4. just run "pip install -e .", it will auto call setup.py, then quiver_engine installed without any problem;
  5. run python under dos "cmd";
  6. just for test, type "from quiver_engine impor server" and no error is reported;
  7. just for use in keras, look detail on function server.lunch, type "help(quiver_engine.server.lanuch", you will find it suggest only 5 parameter like below and NEEDN'T CLASSES MEAN STD TOP these 4 parameters!!!"

help(server.launch)
Help on function launch in module quiver_engine.server:
launch(model, temp_folder='./tmp', input_folder='./', port=5000, html_base_dir=None)

  1. it you add codes below, you MUST first make dir you need first!
    server.launch(model = model,temp_folder='./quiver/tmp',input_folder='./quiver/input_imgs',port=5000)
    9, run codes with launch function in pycharm or python, quiver_engine will OPEN A WEBPAGE show your images (you FIRST copy to input_folder before run codes) and select it to see feature maps in your diagram show also on web page's left frame.
  2. if it run OK as mentioned in step 9, you trains will BLOCKED by quiver_engine!

[tensorflow] tensorboard 사용

f://test/program/log/log1

안에 이벤트가 있으면

tensorboard --logdir=f://test/program/log/log1

라고 하면 된다.

여기서 띄어쓰기 하면 안된다.

-- 가끔 안되는 사람들은 f://test/program/log 까지 이동한 후

tensorboard --logdir=log1

이렇게 실행했더니 된다고 하는 사람들이 있었다.

( https://github.com/tensorflow/tensorflow/issues/9701 )

info_bio

https://followthedata.wordpress.com/2015/12/21/list-of-deep-learning-implementations-in-biology/

2018년 4월 9일 월요일

[numpy] one hot encoding

import numpy as np

x = [ 3 , 4 , 1]

x = np.asarray( x )

eye = np.eye(5)

print(eye)

x = x.reshape(-1)
print(x)

res = eye[x]

print(res)

2018년 4월 7일 토요일

[tensorflow] 옵티마이저에서 그라디언트구해서 업데이트 하는 두가지 방법.

https://stackoverflow.com/questions/45473682/difference-between-apply-gradients-and-minimize-of-optimizer-in-tensorflow?rq=1


텐서 플로우에서 옵티마이저로 구한 그래디언트를 적용하는 방법은 두가지 이다.


1. 자동으로
optimizer = tf.train.AdamOptimizer(1e-3)
train_op = optimizer.minimize(cnn.loss, global_step=global_step)







2. 수동으로


optimizer = tf.train.AdamOptimizer(1e-3)
grads_and_vars = optimizer.compute_gradients(cnn.loss)
train_op = optimizer.apply_gradients(grads_and_vars, global_step=global_step)


수동으로 할때는 구해진 그라디언트를 바로 적용하기 전에 다른일을 할 수 있다.



2018년 2월 26일 월요일

[opencv] blob 관련 설명 블로그

https://www.learnopencv.com/blob-detection-using-opencv-python-c/

[wpf] 윈도우 스타일 none으로 설정후 맨위에 흰줄 남는거 제거 방법

https://stackoverflow.com/questions/36631165/how-to-remove-white-strip-on-top-of-wpf-window-with-windowstyle-none/36631416


ResizeMode="CanResizeWithGrip" AllowsTransparency="True"

이 옵션 추가하자

[python] opencv SIFT 함수 사용법

일반적으로 아나콘다에서 opencv설치시 이 함수는 포함이 안되어 있다.

먼저
https://www.lfd.uci.edu/~gohlke/pythonlibs/#opencv

여기서


이파일을 다운 받는다. 
이 파일은 파이썬 3.5 에 contrib이 포함되어 있다. 

이 contrib 에 sift등의 함수들이 포함되어있다. 


conda uninstall opencv 및 
혹시  pip에 opencv-python이 깔려잇으면 지워준다. 
pip uninstall opencv-python 으로.. 

다운 받은 폴더에 가서 

pip install  파일명 

으로 설치를 한다. 

혹시 import cv2  에서  numpy 관련 에러 나올시 

pip install --upgarde numpy
 
로 업글한다. 


[WPF] Hidden window instead of closing window

private void Window_Closing(object sender, System.ComponentModel.CancelEventArgs e)
{
e.Cancel = true;
Visibility = Visibility.Collapsed;
}

private void Window_Closing(object sender, System.ComponentModel.CancelEventArgs e)
{
e.Cancel = true;
this.Hide();
}

2018년 2월 21일 수요일

docfx 사용법

1.비주얼 스튜디오 내에서 폴더 만들고,

toc.md를 만들어서 헤드 상단 메뉴를 추가할 수 있다.
(md파일은 빌드시 자동으로 html파일로 바뀐다. )

추가한 폴더에 roc.md 에는 다음과 같이 사이드 메뉴를 추가할 수 있다.
메뉴이름. 바인딩 파일 (같은 폴더)
#[mmm1](menu1.md)
#[mmm2](menu2.md)



2.그 후에는 탑레벨 폴더의
toc.yml에 다음을 추가해 준다.


- name: Articles
  href: articles/
- name: API Documentation
  href: obj/api/
- name: ScondMenu 상당 바 메뉴에서 표시될 이름
  href: Second/  폴더이름
  homepage: api/index.md


탑레벨의  Index.md파일은 홈페이지 대문 페이지 이다. 



3. 추가한 폴더에 메뉴 대문용 페이지파일은 만든다. 
ex: intro.md

 
4. 빌드후 _site폴더에 toc.html 을 편집하자. 

여기에 보면 


 
   
     
       
       
     
   
   
     
          
         
           
  •               Articles
               
               
  •               API Documentation
               
               
  •               ScondMenu
               
             
         
       
     

    저부분이 멋대로 써져있는데 이부분은 _site/Second 폴더안의 파일로 바꿔 줘야 한다. 

    bref는 대문용 페이지를 , name 은 toc.html로 바꾼다. 

    그러면 끝
    r

    2018년 2월 18일 일요일

    task cancelation

    void Main()
    {
        Thread thread = null;
    
        Task t = Task.Run(() => 
        {
            //Capture the thread
            thread = Thread.CurrentThread;
    
            //Simulate work (usually from 3rd party code)
            Thread.Sleep(1000);
    
            //If you comment out thread.Abort(), then this will be displayed
            Console.WriteLine("Task finished!");
        });
    
        //This is needed in the example to avoid thread being still NULL
        Thread.Sleep(10);
    
        //Cancel the task by aborting the thread
        thread.Abort();
    }

    2018년 1월 29일 월요일

    바이트 <-> 더블 간 변형 방법

    https://stackoverflow.com/questions/7832120/how-to-convert-a-byte-array-to-double-array-in-c

    바이트 <-> 더블 간 변형 방법

    emgucv stitch

      Mat i1 = new Mat("D:/New folder/images/Fit01.jpg", LoadImageType.Color);
                Mat i2 = new Mat("D:/New folder/images/Fit02.jpg", LoadImageType.Color);
                Mat i3 = new Mat("D:/New folder/images/Fit02.jpg", LoadImageType.Color);
                using (VectorOfMat vmsrc = new VectorOfMat(i1, i2, i3))
                {
                    Image<Bgr, byte> res = new Image<Bgr, byte>(1000, 750);
                    Mat result = new Mat();
                    Stitcher stitcher = new Stitcher(false);
                    stitcher.Stitch(vmsrc, result);
                    ImageViewer.Show(result);
                } 

    2018년 1월 11일 목요일

    Paket에 대해

    paket은 오픈소스 프로젝트로 3년정도 되었다.

    F#으로 작성 되었지만, C#에서도 똑같이 동작한다.

    목적은 복잡한 Dependency를 편하게 관리하도록 하는것이다.

    Nuget과 목적도 같고, Add-on 성격을 지닌고 있다.

    **
    In other words, you can have a dependency on a given file from a specific commit on GitHub. For example, you could have a dependency on the SqlMapper.cs in the Dapper project, instead of downloading a whole NuGet package. Or you could share a single cs file across multiple solutions without the need to have a private NuGet server to share them.

    Nuget의 경우는 만약에 참조중인 프로젝트와 참조한 프로젝트가 같은 dll을 참조하고있고 버전이 다를경우는, 하위버전으로 다 통일 시켜버린다. 


     Paket은 3대의 파일로 이루어져있다. 

    1.  paket.dependencies : 각각의 프로젝트의  dependency에 대한 정보. 
    2. paket.lock : dependency 간의 관계 
    3. paket.references  : 유저가 수정 할 수 있는 파일 

    https://cockneycoder.wordpress.com/2017/08/07/getting-started-with-paket-part-1/