2017년 8월 15일 화요일

fine-tuning with tensorflow

https://www.tensorflow.org/tutorials/image_retraining

찬찬히 잘 따라 하면 된다.

1. 꽃이미지 받고
    curl -O http://download.tensorflow.org/example_images/flower_photos.tgz
    tar xzf flower_photos.tgz
2. bazel build tensorflow/examples/image_retraining:retrain
  q: python -> c++ build & run ?
3. bazel-bin/tensorflow/examples/image_retraining/retrain --image_dir=flower_photos
 ... time is money
 ... 완료 & 테스트
4. bazel-bin/tensorflow/examples/label_image:label_image --graph=/tmp/output_graph.pb \
--labels=/tmp/output_labels.txt \
--output__layer=final_result \
--input_layer=Mul \
--image=$HOME/flower_photo/daisy/xxx.jpg


./bazel-bin/tensorflow/examples/label_image/label_image --graph=/tmp/output_graph.pb --labels=/tmp/output_labels.txt --output_layer=final_result --input_layer=Mul --image=/Users/bcc/flower_photos/daisy/21652746_cc379e0eea_m.jpg

2017년 8월 14일 월요일

TensorFlow Android Camera Demo(bazel version)

https://github.com/tensorflow/tensorflow/tree/master/tensorflow/examples/android

간단히 하려면

build.gradle에서 nativebuildsystem = 'none'로 설정하면

jcenter에서

compile 'org.tensorflow.tensorflow-android:+' 다운로드 하여 실행 한다. 

bazel로 하려면

tensorflow source를 다운 받고

WORKSPACE 파일의 주석을 제거 하고

android-stduio로 tensorflow/example/android를 import하고 

project에서 local.properties에 ndk.dir를 설정한다. 

빌드 하면 된다. 

참고:
온라인 문서에 나와 있는 bazel로 android 빌드 하는 방법은 tensorflow_demo로 시작 했지만 
build.gradle에서는 tensorflow_native_libs로 시작해서 libtensorflow_demo.so, libtensorflow_inference.so를 빌드하는 순서로 된다. 


bazel build -c opt tensorflow/examples/android:tensorflow_demo
adb install -r bazel-bin/tensorflow/examples/android/tensorflow_demo.apk 
이렇게 해도 되지만( 난 에러나서 안했음.)
build.gradle를 사용해서 하는 편이 더 좋은것 같다. 

결론은  build.gradle로 bazel로 사용하려면 WORKSPACE 파일 주석삭제후 bazel system에 알려주면 빌드 된다. 

참고:

build.gradle에  
apply from: "download-models.gradle"은 assets에 4개의 pb파일과 3개의 checkpoints파일이 생성 된다. 





2017년 8월 4일 금요일

Tensorflow-serving Docker image

https://tensorflow.github.io/serving/
->
https://tensorflow.github.io/serving/docker
->
https://tensorflow.github.io/serving/serving_basic

Download Dockerfile.devel
docker build --pull -t zaxrok/tensorflow-serving-devel -f Dockerfile.devel .
docker run -it zaxrok/tensorflow-serving-devel

git clone --recurse-submodules https://github.com/tensorflow/serving
cd serving/tensorflow
./configure
cd ..
bazel test tensorflow_serving/...
.. error


bazel build -c opt --jobs 1 --local_resources 2048,0.5,1.0 --verbose_failures tensorflow_serving/...

INFO: Elapsed time: 11026.956s, Critical Path: 41.09s
많은 시간이 걸리니 어디 갔다 오시길


bazel build -c opt //tensorflow_serving/example:mnist_saved_model

bazel-bin/tensorflow_serving/example/mnist_saved_model /tmp/mnist_model

Exporting trained model to /tmp/mnist_model/1
Done exporting!


2017년 7월 4일 화요일

windows 10 web server & webhook

flask

from flask import Flask, request
app = Flask(__name__)


@app.route('/bcc', methods=['GET', 'POST'])
def bcc():
    print(request.data)
    return ''
@app.route('/products', methods=['GET', 'POST'])
def products():
    print(request.data)
    return ''
if __name__ == '__main__':
    app.run()



example:
Cart updatehttp://85dfc6a9.ngrok.io/bcc

2017년 6월 23일 금요일

pos agent system

https://panel.omnivore.io/docs/guides/agent_installation/micros_3700#supported-versions

2017년 6월 17일 토요일

python3 swig openframeworks windows tensorflow

1. install python3 64bit
2. modify python3/include/pyconfig.h => #ifdef _DEBUG
//# define Py_DEBUG
#endif
pragma comment(lib,"python35.lib")
3. modify python3/lib/argparse.py => props = ''
4. clone ofxPython
cd swig-additional, swig -c++ -python -fcompact -fvirtual -I../../../libs/openFrameworks -I../src openframeworks_extra.i
openframeworks_extra_wrap.cxx to *.cpp
5. install tensorflow
6. if cuda, add cuda include & lib path in MSVC2015
7. add python3 include & lib in MSVC2015
8. add PyImport_AppendInittab("_openframeworks_extra", PyInit__openframeworks_extra);
9. modif #define PyString_AsString(str) PyUnicode_AsUTF8String(str)
10. modify return string(PyBytes_AsString(PyString_AsString(get()->obj)));
11. build Debug, x64
12 ofLog() << lines[j].asString() -> lines[j].str() in ofxPython.cpp
13 ofLog() << "\t" << "Error: " << opvalue.str() -> opvalue.repr() in ofxPython.cpp


cuda error
numpy error
arch error

2017년 6월 13일 화요일

tensorflow-gpu with openframeworks on windows 10

1. Python35\Lib\argparse.py

if prog is None:
            prog = '' #_os.path.basename(_sys.argv[0])


2. ofxPython.cpp
ofLog() << lines[j].str()


3. #define PyString_AsString(str) PyUnicode_AsUTF8(str)

2017년 5월 28일 일요일

install foxPython & tensorflow on OS X

osx에서 python 작업시 주의해야할 사항

osx 기본 python. 버전은  /usr/bin/python

 python download후. install 했을때는  /usr/local/bin/python 이다.

자 그럼 ofxPython example에서 python include & python lib path에 따라 실행이 달라 진다.

그리고 tensorflow 64bit이다.

openframeworks api 사용 하지 않으면 swig compile 된 bindings 없이 ofxPython으로만 써도 된다.

1.  python.h 없는 에러
 => Other C++ flags에 include path 추가

2. import openframeworks 에러
 => ofxPython.cpp "sys.path.append('.')\n"
"sys.path.append('data')\n"


3. python_d.lib  없는 에러
 => python/include/pyconfig.h에서 debug 관련 코드 제거 또는 수정
 => // #define Py_DEBUG

4. pip install package 설치후 import 에러시
 => python --version 확인 해서 같지 않으면 include & library path를 같은 버전으로 설정한다. (매우 중요)

5. tensorflow 설치 후 아키텍처 및 심볼 에러
 =>  tensorflow는 64bit이므로 32bit app 실행 시 아키텍처 충돌이 나서 같은 버전으로 컴파일 하고 실행 해야 한다. (매우 중요)


6. sys.argv 에러
 => 해당 파일 라인 주석 또는 props = '' 추가

7.

2017년 5월 16일 화요일

install ofxPython windows 10

ofxPython와 함께 디버그로 컴파일 하면
python27_d.lib이 없다고 나오는데
http://stackoverflow.com/questions/38860915/lnk2019-error-in-pycaffe-in-debug-mode-for-caffe-for-windows
pyconfig.h에 다 있음.
이렇게 하면 되고

에러도 나오는데 이것으로 다 해결됨.


mac에서 swig로 만든 openframeworks.py와 openframeworks_extra.py를
본인이 만든 of project /data 폴더에 복사후 사용한다.
문제가 있다면 런타임시 에러 이므로 swig가 잘못된것임.

# This file was automatically generated by SWIG (http://www.swig.org).
# Version 3.0.12

위의 두 파일은 swig 3.0.12로 만듬



2017년 3월 23일 목요일

intel realsense with faceshift studio

faceshift stduio
https://docs.google.com/uc?id=0B10zXV570eMgTEhQa01uOWhhX3c&export=download

intel realsense sdk 2014
https://communities.intel.com/thread/111793
본문:

Intel RealSense Installation

  • Download the SDK and the DCM (Depth Camera Manager).
  • Install the SDK first. Note that for using the Intel RealSense camera with faceshift studio, you don’t need all the modules selected for installation by default, but only those selected in the screenshot below.
SR300 DCM은 최신 인스톨 상관없음.
http://faceshift.com/studio/2015.2/introduction.html


2017년 3월 8일 수요일

install pm2 on dawinop (ubuntu 12.04)

robotis@robotis:~$ npm i pm2 -g
npm http GET https://registry.npmjs.org/pm2

npm ERR! Error: failed to fetch from registry: pm2
npm ERR!     at /usr/share/npm/lib/utils/npm-registry-client/get.js:139:12
npm ERR!     at cb (/usr/share/npm/lib/utils/npm-registry-client/request.js:31:9)
npm ERR!     at Request._callback (/usr/share/npm/lib/utils/npm-registry-client/request.js:136:18)
npm ERR!     at Request.callback (/usr/lib/nodejs/request/main.js:119:22)
npm ERR!     at Request. (/usr/lib/nodejs/request/main.js:212:58)
npm ERR!     at Request.emit (events.js:88:20)
npm ERR!     at ClientRequest. (/usr/lib/nodejs/request/main.js:412:12)
npm ERR!     at ClientRequest.emit (events.js:67:17)
npm ERR!     at HTTPParser.onIncoming (http.js:1261:11)
npm ERR!     at HTTPParser.onHeadersComplete (http.js:102:31)
npm ERR! You may report this log at:
npm ERR!     
npm ERR! or use
npm ERR!     reportbug --attach /home/robotis/npm-debug.log npm
npm ERR!
npm ERR! System Linux 3.2.66-op2
npm ERR! command "node" "/usr/bin/npm" "i" "pm2" "-g"
npm ERR! cwd /home/robotis
npm ERR! node -v v0.6.12
npm ERR! npm -v 1.1.4
npm ERR! message failed to fetch from registry: pm2
npm ERR!
npm ERR! Additional logging details can be found in:
npm ERR!     /home/robotis/npm-debug.log
npm not ok

sudo add-apt-repository ppa:chris-lea/node.js  
sudo apt-get update  
sudo apt-get install nodejs
node -v
npm -v
npm install pm2 -g
robotis@robotis:~$ npm install pm2 -g
npm ERR! Error: EACCES, mkdir '/usr/lib/node_modules/pm2'
npm ERR!  { [Error: EACCES, mkdir '/usr/lib/node_modules/pm2']
npm ERR!   errno: 3,
npm ERR!   code: 'EACCES',
npm ERR!   path: '/usr/lib/node_modules/pm2',
npm ERR!   fstream_type: 'Directory',
npm ERR!   fstream_path: '/usr/lib/node_modules/pm2',
npm ERR!   fstream_class: 'DirWriter',
npm ERR!   fstream_stack:
npm ERR!    [ '/usr/lib/node_modules/npm/node_modules/fstream/lib/dir-writer.js:36:23',
npm ERR!      '/usr/lib/node_modules/npm/node_modules/mkdirp/index.js:46:53',
npm ERR!      'Object.oncomplete (fs.js:108:15)' ] }
npm ERR!
npm ERR! Please try running this command again as root/Administrator.

npm ERR! System Linux 3.2.66-op2
npm ERR! command "/usr/bin/node" "/usr/bin/npm" "install" "pm2" "-g"
npm ERR! cwd /home/robotis
npm ERR! node -v v0.10.37
npm ERR! npm -v 1.4.28
npm ERR! path /usr/lib/node_modules/pm2
npm ERR! fstream_path /usr/lib/node_modules/pm2
npm ERR! fstream_type Directory
npm ERR! fstream_class DirWriter
npm ERR! code EACCES
npm ERR! errno 3
npm ERR! stack Error: EACCES, mkdir '/usr/lib/node_modules/pm2'
npm ERR! fstream_stack /usr/lib/node_modules/npm/node_modules/fstream/lib/dir-writer.js:36:23
npm ERR! fstream_stack /usr/lib/node_modules/npm/node_modules/mkdirp/index.js:46:53
npm ERR! fstream_stack Object.oncomplete (fs.js:108:15)
npm ERR!
npm ERR! Additional logging details can be found in:
npm ERR!     /home/robotis/npm-debug.log
npm ERR! not ok code 0


sudo npm install pm2 -g

pm2 -v

2017년 2월 14일 화요일

robotis op2 wlan0 setting

user/password: robotis/111111

wpa_passphrase "YOUR_SSID" SSID_PASSWORD | sudo tee /etc/wpa_supplicant/wpa_supplicant.conf

sudo vi /etc/network/interfaces

auto lo
iface lo inet loopback

#auto eth0
#iface eth0 inet static
  address    192.168.123.1
  netmask    255.255.255.0
  broadcast  192.168.123.255
  network    192.168.123.0

auto wlan0
iface wlan0 inet dhcp
netmask 255.255.255.0
gateway 192.168.1.1
wpa-driver nl80211
wpa-ssid isan1
wpa-ap-scan 1
wpa-proto WPA
wpa-pairwise CCMP
wpa-group CCMP
wpa-key-mgmt WPA-PSK
wpa-psk c39a3cda7b61153a5fc324e628cb0113365f69a3b3d985e9f56ef688b57ff133


vi /etc/wpa_supplicant.conf

ap_scan=1
ctrl_interface=/var/run/wpa_supplicant
network={
ssid="isan1"
scan_ssid=1
psk=c39a3cda7b61153a5fc324e628cb0113365f69a3b3d985e9f56ef688b57ff133
key_mgmt=WPA-PSK
proto=WPA
pairwise=CCMP
group=CCMP
}


2016년 12월 21일 수요일

ng2-bcc.blogspot.kr 개설

angular framework를 사용해서 웹앱 마스터하기

1. ng2 기본기 익히기
2. 고수들이 만든 ng2기반 webapp 따라해 보기
3.

ng2-bcc.blogspot.kr

bing cognitive api 사용하기

2016년 12월 13일 화요일

angularjs shareplace

https://www.quora.com/Is-there-a-marketplace-for-AngularJS-templates

2016년 12월 10일 토요일

What happens after the trial period of Windows has expired?

After a month when you get the "Activate Windows Today" message you can open a command prompt (as administrator) and type "slmgr -rearm" (without the quotes). This will extend the trial license for 1 month. You can do this three times.

2016년 12월 2일 금요일

Can MICROS' POS integrate with 3rd party applications?

Yes, if you want to spend $25k for their SDK and 12-18 months in their product approval pipeline.  The large companies (NCR and Micros) are monolithically slow because of their size. They just have so much other stuff to deal with handling relatively small integrations is not a huge urgency. You are better trying to work with other POS vendors who are more open with their technologies.

MICROS myreservation API

MICROS offers a cloud-based reservation system that enables customers to look up and book reservations at a restaurant's website in real time. When customers book their reservations and receive e-mail confirmation, the bookings are posted to and maintained within the MICROS Point-of-Sale system. Developers may define the number of reservations to offer in each time slot and configure this availability directly. These functions can be accessed programmatically using the SOAP-based MICROS myreservation API.

I have developed a restaurant menu app for samsung galaxy tab 8.9 .I want to send all ordered details to micros pos eg item name,table name qty ordered , item price to pos .I have deeveloped this application using flash builder 4.6 ie used flex 4.6 and actionscript as technologies .So how do i integrate my application with micros pos to send all data ordered to it with micros pos??

Easy : you need a server and an application on that server , did you develop it too ? then it should not be hard to send your datas via http/https back to your server from your app. Your flash app is only a client app , like the app on the samsung , they are clients , you need a server app.

MICROS will allow you to integrate, but you generally have to pay the price of admission. They even tell you on their site that it starts at $15,000. This fee, like everything in business, is based on your benefit to them and is negotiable based on what you bring to the table.

xml-rpc ? amf ? soap ? rest ?

MICROS RES 3700 POS integration using the webservice API.

2016년 11월 22일 화요일

google speech api

gcloud.cmd auth activate-service-account --key-file=F:\speechrecognitiontest-c93d3aa2093d.json

curl -s -k -H "Conent-Type: application/json" -H "Authorization: Bearer ya29.El6eA3oHYeOhGx64MqPBVCqwZWzAGiG5yWYYt6o0wF8DY74bkdMbdNFcd0GWZYd7ojjaKIBULqtnEDnIxRLBCq14fPMLQQ7eg221dIrTuA1b_Y35ghE8U6cTEql4N7p7" https://speech.googleapis.com/v1beta1/speech:syncrecognize-d @sync-request.json

https://cloud.google.com/speech/docs/getting-started#set_up_your_project 따라하기

GCLOUD_PROJECT=speechrecognitiontest-150301 node recognize.js listen

gcloud.cmd auth application-default login

https://console.cloud.google.com/iam-admin/iam/project?project=speechrecognitiontest-150301

speechrecognitiontest project에서 IAM 권한에  zaxrok@gmail.com 계정 과
서비스 계정이 등록되어 있어야 한다. 

GCLOUD_PROJECT=speechrecognitiontest-150301 node recognize.js sync ./resources/audio2.raw

테스트 결과 latency(호출대기시간)가 심함

2016년 9월 30일 금요일

bitbucket ssh

search git-bash.exe
ssh-keygen
clip < id_rsa.pub

2016년 9월 9일 금요일

Electron과 Annyang(STT) 연동



https://github.com/augustogoncalves/personal-assistant.git 좋은 예제

electron main.js 후 안되는 경우가 있는데
마이크 문제인것 같다

그리고  Annyang.js or min.js 2.0.0으로 실행 한다. 2.5.0은 annyang undefined 에러 발생한다.

https://github.com/zaxrok/annyang-electron-demo는 2.5.0으로 됨.