クラウドサーバでTensorFlow その7


概要

クラウドサーバでTensorFlowやってみた。
tensorflowのinceptionで1000分類してみた。

環境

クラウド idcf
linux debian-8.11
tensorflow 1.2
gpu 無し

写真

サンプルコード

var url = 'http:// /cgi-bin/test5.py';
var image = new Image();
image.onload = function() {
    canvas = document.getElementById('canv_original');
    canvas.width = 224;
    canvas.height = 224;
    ctx = canvas.getContext("2d");
    ctx.drawImage(image, 0, 0, 224, 224);
    var img = canvas.toDataURL('image/jpeg');
    $.ajax({
        url: url,
        type: 'POST',
        data: {
            img: img
        },
        dataType: 'json',
        success: function(data) {
            if (data.status)
            {
                $('#report').html('This is ' + data.num + '.');
            }
            else
            {
                $('#report').html('これは、分かりません');
            }
        },
        error: function(res) {
            alert('err');
        }
    });
}
image.src = "/assets/9/1/8/P/918PR.jpg";

成果物