2018의 게시물 표시

[Deep learning] Gradient Descent Optimizer

이미지
https://icim.nims.re.kr/post/easyMath/70 알기 쉬운 산업수학 알기 쉬운 산업수학 Gradient Descent Optimizer 2017년 12월 13일(수) | 김민중 URL  (1) 주어진 목적함수  f f 의 최솟값(minimum)을 찾아가는 알고리즘으로 다음과 같은 방식으로 최솟값을 찾아간다. 초기값  x 0 x 0 을 임의로 설정, 적당한 Learning rate  α α  설정 n ≥ 0 n ≥ 0 인 정수에 대해서  x n + 1 x n + 1 은 다음과 같이 정의한다. x n + 1 : = x n − α ⋅ ∇ f ( x n ) x n + 1 := x n − α ⋅ ∇ f ( x n ) 주의사항 함수 f f 의 모양이 convex가 아닌 경우 global minimum이 아닌 local minimum으로  x n x n 이 수렴할 가능성이 있다. Learning rate  α α  값이 큰 경우 최솟값으로  x n x n 이 수렴하는 것이 아니라 발산할 수 있다. Learning rate  α α  값이 작은 경우 수렴하는 속도가 지나치게 느릴 수 있다. 방정식  2 ⋅ x = 10 2 ⋅ x = 10  의 근을 Gradient Descent를 이용해서 찾아보자. 목적함수  f ( x ) : = ( 10 − 2 x ) 2 f ( x ) := ( 10 − 2 x ) 2 으로 설정하겠다( f f 의 최솟값인 0이 되게 하는  x x 값이 우리가 원하는 방정식의 근이다). 초기값  x 0 = 0 x 0 = 0 , Learning rate  α = 0.05 α = 0.05 으로 설정 f ′ ( x ) = 4 ( 2 x − 10 ) f ′ ( x ) = 4 ( 2 x − 10 ) 이므로  x 1 x 1 은 다음과 같이 구할 수 있다. x 1 = x 0 − α ⋅ f ′ ( x 0 ) = 0 − 0.05 ⋅ ( − 40 ) = 2 x

[python][pip] [virtualenvwrapper] Install virtualenvwrapper with python3

 < Problem > How to install virtualenvwrapper with python3? <Solution> $ sudo apt-get install python3-pip $ sudo pip3 install virtualenvwrapper $ nano ~/.bashrc export VIRTUALENVWRAPPER_PYTHON=/usr/bin/python3 #The lines linked to above should come before the line shown below source   /usr/local/bin/virtualenvwrapper.sh <Reference> https://medium.com/@gitudaniel/installing-virtualenvwrapper-for-python3-ad3dfea7c717

[Visual Studio] visual studio 2015 intellisense problem

< Problem > Intellisense stoped working. <Solution> 1. Close VS. 2. Delete the hidden ".vs" folder next to your solution file. 3. Restart VS and load the solution. <Reference> https://developercommunity.visualstudio.com/content/problem/105595/intellisense-shows-error-for-every-project-referen.html

[Docket][VirtualBox] Switching between Docker and VirtualBox on Windows 10

Switching between Docker and VirtualBox on Windows 10 <Solution> 1. For Virtualbox run # Run from elevated prompt (admin privileges)  bcdedit /set hypervisorlaunchtype off 2. For Docker run # Run from elevated prompt (admin privileges)  bcdedit /set hypervisorlaunchtype auto 3. Both cases A reboot is required in both cases. <Reference> https://fredrikaverpil.github.io/2018/03/15/switching-between-docker-and-virtualbox-on-windows-10/

[Visual Studio][Tesseract] Error C2872 'remove_reference': ambiguous symbol

1. Problem Error C2872 'remove_reference': ambiguous symbol 2. Solution The thing is that the latest C++ has a definition of  remove_reference  in  std  , and  tesscallback.h  contains another definition. When you use  using namespace std , compiler will give an error due to redefinition. You can either  delete all  using namespace std  and use  std::  (recommended and explained  here ) or  uncomment all  definitions of remove_reference  in  tesscallback.h . 3. Reference https://stackoverflow.com/questions/23740431/tesseract-remove-reference-ambiguous-symbol-in-project-on-visual-studio-2012

[OpenCL] How to get libopencl.so

1. How to get libopencl.so for the device To use OpenCL on your mobile device's GPU, you must obtain the compatible libOpenCL.so library and the corresponding OpenCL headers. I initially thought I could just use the C++ OpenCL header available from Khronos website for development, however that didn't work. I faced compilation errors because of incompatible OpenGL headers. There are couple of ways to get the compatible headers. You can either use the  headers  provided along with the example application or extract them from Adreno/Mali SDK. For Adreno SDK, you can find the headers at  <Adreno_SDK>/Development/Inc/CL . For Mali SDK, you can find the headers at  <MALI_SDK>/include/CL . For newer devices such as Samsung Galaxy Note 3 and Samsung Galaxy S5, it is very likely the library is already present on the mobile device. My test device is a Note 3 for which i found the library under  /system/vendor/lib . You can do  adb pull /system/vendor/lib/libOpenCL.so .

[Install .Net SDK][Ubuntu] Install .Net SDK on Ubuntu 16.04 LTS

1. Register Microsoft key and feed wget -q https://packages.microsoft.com/config/ubuntu/16.04/packages-microsoft-prod.deb sudo dpkg -i packages-microsoft-prod.deb 2. Install .NET SDK sudo apt-get install apt-transport-https sudo apt-get update sudo apt-get install dotnet-sdk-2.1 3. Reference https://www.microsoft.com/net/learn/get-started/linux/ubuntu16-04

[visual studio code][code][ubuntu] Install visual studio code on Ubuntu

1. Install editer : visual studio code 1-1. download code for ubuntu [64bit] https://go.microsoft.com/fwlink/?LinkID=760868 1-2. de-package sudo dpkg -i code_1.24.1-1528912196_amd64.deb 1-3. install sudo apt-get install -f 1-4. open terminal and run code $> code 2. Reference https://code.visualstudio.com/docs/setup/linux *** Ubuntu os version check :   cat /etc/*release

[Tensorflow][Mobile][Windows] TensorFlow for Poets 2: TFMobile

1. Install TensorFlow https://sunggukim.blogspot.kr/2018/05/tensorflow-install-tensorflow-with.html 2. download source for TFMobile for Poets2 git clone https://github.com/googlecodelabs/tensorflow-for-poets-2 cd tensorflow-for-poets-2 git checkout end_of_first_codelab dir tf_files/ 3. test model python -m scripts.label_image \ --graph=tf_files/retrained_graph.pb \ --image=tf_files/flower_photos/daisy/3475870145_685a19116d.jpg 4. Optimize model python -m tensorflow.python.tools.optimize_for_inference \ --input=tf_files/retrained_graph.pb \ --output=tf_files/optimized_graph.pb \ --input_names="input" \ --output_names="final_result" 5. Quantize weights python -m scripts.quantize_graph \ --input=tf_files/optimized_graph.pb \ --output=tf_files/rounded_graph.pb \ --output_node_names=final_result \ --mode=weights_rounded 6. Check compress rate gzip -c tf_files/rounded_graph.pb > tf_f

[Tensorflow] install tensorflow with anaconda 3.5 [ python 3.5]

이미지
1. download anaconda3.5 https://repo.continuum.io/archive/index.html ** my case : for windows x64 : https://repo.continuum.io/archive/Anaconda3-4.2.0-Windows-x86_64.exe 2. install anaconda ** my case : C:\Users\[user-account]\Anaconda3 3. Run anaconda prompt 4. Create anaconda virtual environment for tensorflow conda create -n tensorflow python=3.5 5. Activate tensorflow virtualenvironment activate tensorflow 6. Upgrade pip version python -m pip install --upgrade pip 7. Install tensorflow pip install tensorflow 8. Test and confirm python import tensorflow as tf hello = tf.constant("Hello tensorflow!") sess = tf.Session() print(sess.run(hello)) ** output :  b'Hello tensorflow!'

[AWS][Ubuntu AMI] install virtualenv virtualenvwrapper

0. Set root password $ su passwd and enter password two times. 1. Install pip, virtualenv , virtualenvwrapper for separate python environments $ wget https://bootstrap.pypa.io/get-pip.py $ sudo python get-pip.py $ sudo pip install virtualenv virtualenvwrapper $ sudo rm -rf get-pip.py ~/.cache/pip 2. Update .bashrc file [ nano ~/.bashrc ] *** we are going to use python3 because AWS Ubuntu AMI has no default python command # virtualenv and virtualenvwrapper export WORKON_HOME=$HOME/.virtualenvs export VIRTUALENVWRAPPER_PYTHON=/usr/bin/python3 source /usr/local/bin/virtualenvwrapper.sh 3. Make workplace with virtual environment $ source ~/.bashrc $ mkvirtualenv myVirtualEnv ( myVirtualEnv is name , it means you can name it , after this command run prompt of terminal will change. ) <Reference> https://medium.com/@gitudaniel/installing-virtualenvwrapper-for-python3-ad3dfea7c717

[Blogger][Syntax Highlight] How to syntax highlight in blogger

<HowTo> Edit template Insert bleow lines between <head> and </head> <!-- INCLUDE SyntaxHighlighter Components (css and javascript) --> <link href='http://alexgorbatchev.com/pub/sh/current/styles/shCore.css' rel='stylesheet' type='text/css'/> <link href='http://alexgorbatchev.com/pub/sh/current/styles/shThemeDefault.css' rel='stylesheet' type='text/css'/> <script src='http://alexgorbatchev.com/pub/sh/current/scripts/shCore.js' type='text/javascript'/> <!-- END INCLUDE SyntaxHighlighter Components --> <!-- INCLUDE YOUR BRUSHES WHICH YOU WANT TO USE HERE --> <script src='http://alexgorbatchev.com/pub/sh/current/scripts/shBrushCpp.js' type='text/javascript'/> <script src='http://alexgorbatchev.com/pub/sh/current/scripts/shBrushCSharp.js' type='text/javascript'/> <script src='http://alexgorbatchev.com/pub/sh/curre

[Game] Cute Monsters Brick Breaker, Classic Ball Game

이미지
https://appadvice.com/app/cute-monsters-brick-breaker-classic-ball-game/1230844281

[pythonanywhere.com] OSError('Tunnel connection failed: 403 Forbidden',)))

이미지
1. Error message requests.exceptions.ProxyError: HTTPSConnectionPool(host='www.bbc.com', port=443): Max retries exceeded with url: /weather/0/1835848 (Caused by ProxyError('Cannot connect to proxy.', OSError('Tunnel connection failed: 403 Forbidden',))) 2.  If you are using a free account at pythonanywhere.com then keep in mind that access to external sites via  urllib2  is restricted to a set of  white listed hosts . Paid account can access any external sites. share improve this answer answered  Nov 19 '13 at 5:46 Miguel 38.1k 6 72 91 3. Reference https://stackoverflow.com/questions/20063726/getting-error-tunnel-connection-failed-403-forbidden-with-mechanize-and-pytho

ing~~~~ [Android][NDK] How to use c++ source in android?

이미지
1. Two method 1-1. NDK [Ref] https://developer.android.com/ndk/samples/sample_hellojni.html?hl=ko 1-2. CMake [Ref] https://developer.android.com/studio/projects/add-native-code.html?hl=ko [Ref] https://developer.android.com/ndk/samples/sample_hellojni.html?hl=ko 2. NDK detail : [Ref : https://www.youtube.com/watch?v=RmPuwdxR1qs ] [Ref : http://kn-gloryo.github.io/Build_NDK_AndroidStudio_detail/] [Ref : http://intellij.my/2017/05/10/how-to-create-a-c-library-with-ndk-on-android-studio/ ] 2-1. Android.mk LOCAL_PATH := $(call my-dir) OPENCV_INSTALL_MODULES := on include $(CLEAR_VARS) include D:/Data/Libraries/opencv-2.4.13.3-android-sdk/OpenCV-android-sdk/sdk/native/jni/OpenCV.mk LOCAL_C_INCLUDES := D:/Data/Libraries/opencv-2.4.13.3-android-sdk/OpenCV-android-sdk/sdk/native/jni/include LOCAL_C_INCLUDES += D:/Data/Libraries/opencv-2.4.13.3-android-sdk/OpenCV-android-sdk/sdk/native/jni/include/opencv LOCAL_C_INCLUDES += D:/Data/Libraries/opencv-2.4.13.3-android-sdk/Op

[Android] Android Studio: Change the Cache Location

1. Problem Too big cache size for gradle / android studio 2. Solution1 Locate the place where you’ve installed you AS (e.g.  C:\Program Files\Android Studio ) Go to the  bin  directory and edit  idea.properties  file Search for  idea . config . path  and  idea . system . path  and edit those. I ended up having something like: 1 2 3 4 5 6 7 #--------------------------------------------------------------------- # idea .config .path = $ { user .home } / no - backup / .AndroidStudioBeta / config   idea .system .path = $ { user .home } / no - backup / .AndroidStudioBeta / system # #--------------------------------------------------------------------- 3. Solution2 In the following example  settings.gradle  file we configure our build cache directory to be the directory  build-cache  in the root directory of our project where we store our  settings.gradle  file:   1 2 3 4 5 6 // File: settings.gradle buildCache