转自:爱可可-爱生活
Or, I just trained a machine learning model - now what?
This post goes over a quick and dirty way to deploy a trained machine learning model to production.
Read this if: You've successfully trained a ML model using an ML framework such as Tensorflow or Caffe that you would like to put up as a demo, preferably sooner rather than later, and you prefer lighter solutions rather than spinning up an entire tech stack.
Reading time: 10-15 mins
TL;DR check out the repo
Check your tensorflow installation
Run online classification from stdin
Run online classification on localhost
Put classifiers behind a hardcoded proxy
Put classifiers behind a proxy with service discovery
Call classifiers using a pseudo-DNS
When we first entered the machine learning space here at Hive, we already had millions of ground truth labeled images, allowing us to train a state-of-the-art deep convolutional image classification model from scratch (i.e. randomized weights) in under a week, specialized for our use case. The more typical ML use case, though, is usually on the order of hundreds of images, for which I would recommend fine-tuning an existing model. For instance, https://www.tensorflow.org/tutorials/image_retraining has a great tutorial on how to fine-tune an Imagenet model (trained on 1.2M images, 1000 classes) to classify a sample dataset of flowers (3647 images, 5 classes).
For a quick tl;dr of the linked Tensorflow tutorial, after installing bazel and tensorflow, you would need to run the following code, which takes around 30 mins to build and 5 minutes to train:
链接::
https://thehive.ai/blog/simple-ml-serving
github链接:
https://github.com/hiveml/simple-ml-serving
原文链接:
https://m.weibo.cn/1402400261/4199226748064166