2017-11-24 2 views
0

私はTensorflowを使ってオンライン画像分類チュートリアルに従って、宝石の種類によって画像を分類するバリエーションを作成しました。それはすべて稼働しています。私は新しい画像でモデルをテストするために端末でこのスクリプトを実行しなければなりません:機械学習:bashスクリプトをPythonに変換

python -m scripts.label_image \ 
    --graph=tf_files/retrained_graph.pb \ 
    --image=tf_files/jewellery_photos/new_images/1.jpg 

これは機能します。

ここで、ユーザーがイメージをアップロードできるオンラインフロントエンドインターフェイスを作成したい場合、スクリプトが実行され、インターフェイスにはどのような種類のジュエリーアイテムが表示されるかを示します。

1)どのように私は、フロントエンドには、この機械学習スクリプトを結ぶ行くのです...

a) Do I store the script in my front-end repository and call it 
    when an image has been uploaded by the user? 

b) I need to convert the bash script into python. Do I have to 
    convert the retrained_graph.pb file into something else to be 
    able to import it as a module into a python file? 

答えて

2

フラスコサーバー上でそれを入れて、ファイルをアップロードするためのインタフェースを作ります。 ロジックとグラフファイルはそのサーバー上にあり、ファイルがアップロードされるたびにその関数を実行して結果を返します。