金子邦彦研究室データ処理オープンデータとビッグデータ処理

Python のデータフレーム

目次


オープンデータ (open data) とソースデータ (source data)

資料: ../../rinkou/od/data

オープンデータ (open data)

rdataset.html よりデータを充実メタデータの作成。その2点を目指す.

データフレーム

オープンでないソースデータ (source data)


データのバリエーション, 種々の演算 (type)

資料: ../../docs/type

段階的に 「オープンデータ の Web ページ」でも公開中

DEM

画像 (image)

OpenData

距離行列を求め、多次元尺度法で2次元あるいは3次元にマッピングしたとする。 その後、mutiviarate gaussian モデルをあてはめるのは容易である。 次元ののろいがあるかも知れぬ。そこで、距離行列に非線形の関数を当てはめたい。もともと N 次元のランダムな点を 2,3 次元にマッピングするわけである。 このとき、関数を決めるという問題がある.

icp

icp.zip

配列 (array)

配列の change point

library(changepoint)
data(Lai2005fig4)
plot(Lai2005fig4[,4])
plot( cpt.mean(Lai2005fig4[,5],method='PELT') )
cpts( cpt.mean(Lai2005fig4[,5],method='PELT') )

時系列 (time series)

配列データ

ftp://ftp.ddbj.nig.ac.jp/ddbj_database/dra/DRA000/DRA000583/DRX001619/


ソーシャルビッグデータ基盤, センサネットワークデータベース基盤 (plat)

資料: ../../docs/plat

計測データ、合成データ、単位、プロファイルの記述体型. 計測日時、計測機器(誤差等)の記述体型. データ探索システムでの処理フローの記録. 合成されたデータの検算・算出プロセスの記録

前提知識


データエクスプローラ,Web インタラクションとデータベース (interact)

資料: ../../docs/interact

フォーム、データフロー、Web インタラクション、データの提示における一般性の抽出と、データ記述. 課題の例:

前提知識

キーワード: redis, redis-cli, redis to object mapping

http://memo.saitodev.com/home/arm/arm_cross_compile/, http://absolutearea.blogspot.jp/2012/07/android.html


統計基礎、機械学習基礎、画像特徴基礎 (stat)

資料: ../../docs/stat

統計演算の見える化、統計演算の一貫性と検算.視点移動画像の挙動分析.データエクスプローラ

前提知識

OpenCV sample program code 特徴量のバリエーション imop.html and od/data/opencv/opencv_surf.cpp human retima opencv_folder/samples/cpp/tutorial_code/contrib/retina_tutorial.cpp Image Stitching opencv_stitching command Feature Matching with FLANN https://docs.opencv.org/doc/tutorials/features2d/feature_flann_matcher/feature_flann_matcher.html#feature-flann-matcher Create training and testing samples opencv_createsamples command, train_cascade command http://www.makelinux.net/man/1/O/opencv_createsamples Poisson Blending http://opencv.jp/opencv2-x-samples/poisson-blending 2値化 http://opencv.jp/opencv2-x-samples/image_binarize Segmentation http://opencv.jp/sample/segmentation_and_connection.html#meanshiftsegm Denoise non local mean filter, bilateral filter denoise.cpp // g++ -o a.out denoise.cpp -I/usr/local/include/opencv2 -I/usr/local/include/opencv -L/usr/local/lib -lopencv_highgui -lopencv_imgproc -lopencv_core ./a.out

DOT によるフローの記述

関連する外部ページhttp://cran.r-project.org/web/views/Multivariate.html

参考Webページ http://mjin.doshisha.ac.jp/R/

Deep Learning Building high-level features using large scale unsupervised learning Quoc Le and Marc'Aurelio Ranzato and Rajat Monga and Matthieu Devin and Kai Chen and Greg Corrado and Jeff Dean and Andrew Ng, 2012, International Conference in Machine Learning

画像特徴

  • Matlab codes

    URL: http://www.cse.oulu.fi/CMV/Downloads

    see www.cse.oulu.fi facerec image garally

  • Outex Texture Database

    see also: ../../tools/od/data/Outex

  • Columbia-Utrecht Reflectance and Texture Database

    URL: http://www.cs.columbia.edu/CAVE/software/curet/html/download.html

    see CUReT


    集団行動解析、交通解析 (group)

    資料: ../../docs/group

    前提知識

    キーワード:カメラ式検知器の研究開発、人や商店や駅の集団行動分析.転倒転落、シチュエーション分析、個体識別、交通情報

    アンドロイドセンサーアプリ

    BT タグ・アプリ (BT tag)

    提供されたサンプルプログラム /home/kkaneko/docs/group/2_06_2014.tar を使用

    1. Android SDK manager を起動し、実機と同じバージョンの Android SDK をインストール
    2. Android Studio で import project 操作

      import 元として Android/sample/BTBoxManagerSample を指定

    3. インポートしたプロジェクトの External Library を右クリック.Newを選び、Android を選び、プロジェクトの External Libraries 下に Android API 19 Platform を入れる
    4. 「Build」→「Rebuild」操作
    5. 「Run」→「Run」操作

    1. BaseDeviceListActivity
      findViewById の DeviceListActivity, FilteredDeviceListActivity の部分を削除

    背景除去と動体検知 (background subtraction and object tracking) (group)

    画像処理、機械学習の機能をもったソフトウェア

  • Scene GPS カメラ用の背景除去と動体検知ソフトウェア

    http://sourceforge.net/projects/scene/files/?source=navbar

    cd /tmp
    sudo dkpg -i  Scene-1.0.3-i386.deb
    


    地図データベースの高度応用 (map)

    前提知識

  • 超グラフ
    source("http://bioconductor.org/biocLite.R") 
    biocLite("hypergraph")
    biocLite("RBGL")
    biocLite("GraphPart")
    biocLite("Rgraphviz")
    # to turn the snacoreex.gxl (from RBGL package) graph to a hypergraph
    # this is a rough example 
    kc_hg_n <- c("A", "C", "B", "E", "F", "D", "G", "H", "J", "K", "I", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U")
    kc_hg_e <- list(c("A", "C"), c("B", "C"), c("C", "E"), c("C", "F"), c("E", "D"), c("E", "F"), c("D", "G"), c("D", "H"), c("D", "J"), c("H", "G"), c("H", "J"), c("G", "J"), c("J", "M"), c("J", "K"), c("M", "K"), c("M", "O"), c("M", "N"), c("K", "N"), c("K", "F"), c("K", "I"), c("K", "L"), c("F", "I"), c("I", "L"), c("F", "L"), c("P", "Q"), c("Q", "R"), c("Q", "S"), c("R", "T"), c("S", "T"))
    kc_hg_he <- lapply(kc_hg_e, "Hyperedge")
    kc_hg <- new("Hypergraph", nodes=kc_hg_n, hyperedges=kc_hg_he)
    plot(
    kCoresHypergraph(kc_hg)
    

    一人称型・視点移動画像 (motion)

    コーナー

    コーナー検出(EigenValue,Harris,FAST) | OpenCV.jp http://opencv.jp/opencv2-x-samples/corner_detection

    keypoints

  • openSURF

    インストール手順

    1. OpenSURF の Web ページ http://www.chrisevansdev.com/computer-vision.html

    2. 「OpenSURF C++」をクリックして、ダウンロード

    3. ダウンロードした OpenSURFcpp.zip を解凍
      cd /tmp
      unzip OpenSURFcpp.zip
      

    4. ビルド

      ◆ Ubuntu でのビルド手順例

      1. Makefile.gcc の CFLAGS に -fPIC を追加
      2. make -f Makefile.gcc

      [image]
    5. Web カメラをつなぎ ./surf を実行

    情報源

    see https://aidiary.hatenablog.com/entry/20091030/1256905218 see https://github.com/YusukeSuzuki/opencv_sample_list_jp/blob/master/samples_cpp.rst
  • Lowe's SIFT 9 robust algorithm

    D. G. Lowe. Distinctive image features from scale-invariantkeypoints. International Journal of Computer Vision (IJCV), 60(2):91-110, 2004.

  • PCA SIFT 8

    Y. Ke and R. Sukthankar. PCA-SIFT: A More Distinctive Representation for Local Image Descriptors. 2004.

  • GLOH 12 K. Mikolajczyk and C. Schmid. A performance evaluation of local descriptors. IEEE Transactions on Pattern Analysis and Machine Intelligence (PAMI), 2:1115-1125, 2005.
  • BRISK

    URL: http://www.asl.ethz.ch/people/lestefan/personal/BRISK

    see BRISK

  • SURF 2 http://opencv.jp/opencv2-x-samples/surf_extraction

    H. Bay, A. Ess, T. Tuytelaars, and L. V. Gool. SURF: Speeded up robust features. Computer Vision and Image Un- derstanding (CVIU), 110(3):346-359, 2008.

  • FAST 14 E. Rosten and T. Drummond. Machine learning for high- speed corner detection. In Proceedings of the European Con- ference on Computer Vision (ECCV), 2006.
  • BRIEF 4 M. Calonder, V. Lepetit, C. Strecha, and P. Fua. BRIEF: Binary Robust Independent Elementary Features. In Pro- ceedings of the European Conference on Computer Vision (ECCV), 2010.

    applications using keypoints

  • SLAM

  • RANSAC

    https://docs.opencv.org/doc/tutorials/features2d/feature_homography/feature_homography.html


    3次元再構成,パノラマ画像,3次元物の特徴量化 (3d)

    屋内全域の再構成、平面成分の分析、法線ベクトルのクラスタリング、色とテクスチャの分析

    必要となる知識


    3次元顔 (human face)

    資料: ../../docs/humanface

  • analytical 3D model of the face
  • fiducial point detector アルゴリズム
  • searching for similar fiducial-points configurations from an external dataset to infer
  • unsupervised methods that find a similarity transformation for the pixels [17, 15].
  • face alignment アルゴリズム, frontalization (warp a facial crop to a 3D frontal mode)
  • deep learning アルゴリズム
  • 顔認証システム: DeepFace
  • 3D file formats: STL, color STL, PLY
  • www-bl20.spring8.or.jp
  • labeled face dataset:

    関連する外部ページhttps://docs.opencv.org/trunk/modules/contrib/doc/facerec/

  • to be: ColorFERETDatabase に付属の face2norm norm2cova, norm2samp, cova2eigv, eigne_regog_MANG の手順

  • ColorFERETDatabase の顔画像操作
    #!/bin/bash
    # 64x96 サイズの pgm 画像生成
    cd /home/kkaneko/rinkou/od/data/ColorFERETDatabase/colorferet/dvd2/data/images/00740
    cp *.bz2 /tmp
    cd /tmp
    bzip2 -d *.ppm.bz2
    for i in *.ppm; do
      echo $i
      convert -resize 64x96 $i `basename $i .ppm`.pgm
    done
    

    情報源

    プログラムなど

    see: od/data/att_faces.tar.Z

  • motion を用いた動態検知と顔抽出の例

    数値ベクトルの集合 (a set of numeric vectors)

    ベクトルの classifier (classifier)

     

    SVD using OpenCV Matrix3d P = Matrix3d::Random(3, 3); JacobiSVD svd(P, Eigen::ComputeFullU | Eigen::ComputeFullV); MatrixXd S = svd.singularValues(); Matrix3d U = svd.matrixU(); Matrix3d V = svd.matrixV();





    cascade classifier https://docs.opencv.org/doc/tutorials/objdetect/cascade_classifier/cascade_classifier.html#cascade-classifier

    rubust pca robust pca sample

    image histogram

    グラフ作成

    この Web ページで行うこと: プログラムによるグラフ作成


    Point Cloud

    key word: libpcl, in-hand 3d scanner, data capture

  • ../../tools/od/data/progs/convert_bmp.cpp g++ -I/usr/include/eigen3 -I/usr/include/pcl-1.7 -o a.out convert_bmp.cpp -lpcl_io -lpcl_common -lboost_system
  • meshlab を用いてポリゴンに変換
  • 全国基準地域メッシュデータ (mesh05.html)

    asc to off converter

    require "csv"
    # 行数カウント
    lines=0
    reader = CSV.open("/tmp/Sinus_pts.asc", "r") 
    reader.each do |row|
      lines = lines + 1
    end
    reader.close
    # 出力
    print "OFF\n" 
    print "#{lines} 0 0 \n"
    reader = CSV.open("/tmp/Sinus_pts.asc", "r") 
    reader.each do |row|
      print "#{row[0]} #{row[1]} #{row[2]}\n"
    end
    reader.close
    
    Computer Vision and Geometry Group https://www.google.co.jp/url?sa=t&rct=j&q=&esrc=s&source=web&cd=1&sqi=2&ved=0CCsQFjAA&url=http%3A%2F%2Fwww.cvg.ethz.ch%2Fteaching%2F2012spring%2F3dphoto%2FSlides%2F3dphoto_pcl_tutorial.pdf&ei=M1B0UoSrLof3lAX3s4EQ&usg=AFQjCNHg0Zje3kCIxP2c7PucrMDg_ndarg&sig2=sEKO4QmbX0XJI5eFO-Gupg&bvm=bv.55819444,d.dGI unzip data_capture.zip 'cmake ../data_capture' and then execute 'make'.

    3次元地図

    PCL / STL / PLY

    http://www.archeos.eu/wiki/doku.php/

    http://www.blensor.org/ # python3.3 sudo apt-get install python-software-properties sudo add-apt-repository ppa:fkrull/deadsnakes sudo apt-get update sudo apt-get install python3.3 sudo apt-get install python3.3-dev wget https://bitbucket.org/pypa/setuptools/raw/bootstrap/ez_setup.py sudo python3.3 ez_setup.py git clone https://github.com/mgschwan/blensor.git cd blensor mkdir a cd a cmake -DWITH_PYTHON=OFF -DPYTHON_VERSION=3.3m PYTHON_INCLUDE_DIR=/usr/include/python3.3m -DWITH_OPENIMAGEIO=OFF -DWITH_IMAGE_OPENJPEG=OFF -DWITH_OPENAL=OFF -DWITH_SPACENAV=OFF -DWITH_CYCLES=OFF -DWITH_SYSTEM_GLEW=OFF -DWIGH_GPU=OFF .. some features BSS-1 implementation of a Kinect Sensor Support to obtain accurate depth map information Support the output to the PCD format from the PCL (Point cloud library) Starting with version 1.0.10 the RGB values of the material are stored in the PCD and EVD file Tutorial for PCL developers/users Render a pointcloud in blender

    http://graphics.stanford.edu/data/3Dscanrep/

    https://d.hatena.ne.jp/etopirika5/20101027/1288152036



    辞書


    * bio の例(normalize を例題に) * R のパッケージ https://github.com/ajdamico/usgsd/blob/master/National%20Health%20Interview%20Survey/download%20all%20microdata.R usgsd / National Health Interview Survey / download all microdata.R library(rgl) --- library(rgl) open3d() x <- sort(rnorm(1000)) y <- rnorm(1000) z <- rnorm(1000) + atan2(x,y) plot3d(x, y, z, col=rainbow(1000)) --- points3d(x, y = NULL, z = NULL, ...) lines3d(x, y = NULL, z = NULL, ...) segments3d(x, y = NULL, z = NULL, ...) triangles3d(x, y = NULL, z = NULL, ...) quads3d(x, y = NULL, z = NULL, ...) --- library(foreign) --- library(foreign) read.spss() write.foreign( "SPSS" ) library(misc3d) --- library(misc3d) contour3d(...) kde3d(...) d <- kde3d(quakes$long, quakes$lat, quakes$depth, n = 40) contour3d(d$d, exp(-12), d$x/22, d$y/28, d$z/640, color = "green", color2 = "gray", scale=FALSE, engine = "standard") plot3d(quakes$lat, quakes$long, quakes$depth, col=rainbow(1000)) --- ----- terasvirta test library(tseries) x <- runif(1000, -1, 1) y <- x^2 - x^3 + 0.1*rnorm(x) plot(x,y) terasvirta.test(x, y) terasvirta.test(cbind(x,x^2,x^3), y) x[1] <- 1.0 for(i in (2:n)) { x[i] <- 0.98*x[i-1] + 0.01 } x <- as.ts(x) plot(x) terasvirta.test(x) terasvirta.test(cbind(x,x^2,x^3)) help.zelig("models") https://www.google.com/url?sa=t&rct=j&q=&esrc=s&source=web&cd=4&cad=rja&ved=0CE0QFjAD&url=http%3A%2F%2Fwww.slideshare.net%2Fizahn%2Frstatistics&ei=S3DyUYPPIcKnkAXA1YGACg&usg=AFQjCNF_FBDkMjpj7vEC-nJ17igMYTmKaQ&sig2=CjWahfa1dXy-O3hLWffgTg http://cran.r-project.org/web/views/TimeSeries.html library( forecast ) tsdisplay( LakeHuron ) data1 <- auto.arima( LakeHuron ) plot( forecast( data1, h=10 ) ) 現在あるいは直近の測定値に加えて、 過去の測定値の集積から、統計的手法などを用いて、直近の測定値と現在時刻の時間のずれの補償や、 測定漏れの補間や、将来の予測を行うとする. たとえば、 ありえる事象の集合である母集団の個々の観測値を表す確率変数Xについて、 Xが正規分布に従うことが前もって分かっていたり、 母集団の観測の集積から、Xが正規分布の従うということがある確からしさで言えるとする。 確率モデルから、観測値あるいは観測値の時系列集合を自動的に生成できるし、 観測値の集積から確率モデルを導くことができる。 この両方向の処理を繰り返しても、確率モデルが変化しないとき、この確率モデルは安心して使うことができる。 Xが time-variable (時系列変数)であるとき、 この場合、  ずれの補償:   補間:  将来の予測: 過去の測定値の集計から、ある時刻tでの値を予測し、これを実測値にあてはめることで、予測の良さを評価することもできる。 <要因とランダム性> 要因のランダム性によって、ある変数Yの値が変化するとする.要因Xがランダム変数であり、要因YがXの積分値とすると、Yは典型的なランダムウオークである. このときYの統計モデルではなく、要因の統計モデルが作られる 要因の統計モデルと観測値 派生変数の観測値、 <要因の予測とランダム性> 要因がランダムであるというからには、予測はしがたい. 単に「平均E,分散sの正規分布で値集合を合成し、その中から、ランダムに選ぶ」ということになる(モンテカルロシミュレーションのような状況になる. 予測と言っているのは、無限区間での一様分布(まったくの無知識)よりも、統計モデルがあったほうが、現実に近い要因知を合成できると言っているに過ぎない。  要因をすべて無視して、「速度」は正規分布であるという仮説を立てることもできる。  (要因なし。派生変数を直接、統計モデル化)  ある要因を入れることで、精度がAだけ向上する確率(精度の尺度は別途定義する)はPだということができるようになる.例えば混合ガウス分布。この場合には、要因は確率変数だが、派生変数は、要因に従属する変数である。  要因、派生変数ともに観測可能な値であるとする。 3章 では、  ・緯度経度のプロット  ・バス停の到着と発車はわかる  ・バス停の到着と発車の集積もある このとき、 要因と派生変数の関連の仮設を立て、 派生変数の観測値から、要因の統計モデルと観測値を作りたいとする.  要因   曜日区分:平日、土曜・日曜・祝日、土曜、日曜、祝日、三連休、年末年始、お盆   天候   時間帯   未知の突発行事  始点の出発時刻。始点の乗客数はある確度で言える。  観測される派生変数は、  各バス停における到着時刻と乗客数である.  将来、各バス停における到着時刻、各バス停における乗客数、現在位置、現在速度を推定したい。(例えば、信頼区間やp値を使って) <検定> 時系列の変数Yの任意の時刻の観測値Y(t)を、t以前の値から推定し、観測値との差の平均の差、標準偏差、尖度、歪度を求める さまざまな表示法 <地図での、あなたはここです。バスはここです。お探しの場所はここです表示> <地図での、バスに固有の表示法> <バス時刻表だが。。。> 10 | 10 30 50 10 | 14 33 50-54 下段は過去の実績だったり、予測値だったりする。 予測値の区間 [l, u]について、lの値は、100%どんなことがあっても、これより早くは来ない。という意味になる。 l は、いまのバスまでの走行距離/法定速度、あるいは、過去の実績の最高速度 <いまは混んでいるのか、空いているのかの予測表示> 状態そのものの表示 先行するバスがあると、後ろのバスは早いという現象



    ビデオ素材 (video)

    連続する2フレームから keypoint の時間特徴量をとりだす。 さらに、離れたフレームの列から大域的な情報を出す(x, y, size, angle 等の時間変化になる)。 これで分析を行う。

    Optical Flow (OpenCV 2.4.7) farneback tvl1 brox pyrlk