LoginSignup
0
0

More than 5 years have passed since last update.

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

Last updated at Posted at 2017-07-16

概要

クラウドサーバでTensorFlowやってみた。
tensorflowのinceptionで1000分類してみた。
ローカルファイルに、対応してみた。

環境

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

写真

サンプルコード

var uploadFile;
document.getElementById('imageFile').addEventListener("change", function() {
    var image = new Image();
    var reader = new FileReader();
    reader.onload = function(e) {
        canvas = document.getElementById('canv_original');
        canvas.width = 224;
        canvas.height = 224;
        ctx = canvas.getContext("2d");
        image.onload = function() {
            ctx.drawImage(image, 0, 0, 224, 224);
        }
        image.src = reader.result;
    };
    uploadFile = this.files[0];
    reader.readAsDataURL(uploadFile);
}, true);
document.getElementById('upload').addEventListener("click", function() {
    var img = canvas.toDataURL('image/jpeg');
    $.ajax({
        url: 'http:///cgi-bin/test5.py',
        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');
        }
    });
}, true);


成果物

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0