zoukankan      html  css  js  c++  java
  • 如何用 tensorflow serving 部署服务

    第一步,读一读这篇博客

    https://www.jb51.net/article/138932.htm (浅谈Tensorflow模型的保存与恢复加载

    第二步:

    参考博客:

    • https://blog.csdn.net/u011734144/article/details/82107610

      按照上述教程配置好相关文件之后(模型是下面tensorflow-serving中产生的,直接移到textcnnrnn中的)然后再执行下面命令:

    首先启动:

    ljj@debian:~$ docker run -p 8501:8501   --mount type=bind,source=/home/ljj/serving/tensorflow_serving/servables/tensorflow/testdata/textcnnrnn,target=/models/find_lemma_category -e MODEL_NAME=find_lemma_category -t tensorflow/serving

    然后调用:

    ljj@debian:~$ curl --tlsv1.2 -d '{"instances": [10,10,10,8,6,1,8,9,1]}'   -X POST http://0.0.0.0:8501/v1/models/find_lemma_category:predict  

    但是出现错误:

    { "error": "instances is a plain list, but expecting list of objects as multiple input tensors required as per tensorinfo_map" }ljj@debian:~$

    事故现场:

    • https://www.jianshu.com/p/2fffd0e332bc
    • https://blog.csdn.net/SEUer_jeff/article/details/75578732
    • https://blog.csdn.net/wangjian1204/article/details/68928656

    参考教程:

    • https://hub.docker.com/r/bitnami/tensorflow-serving

    在这个教程中:https://github.com/tobegit3hub/tensorflow_template_application

    在Ubuntu中命令应如下

    python sparse_classifier.py train_file ./data/cancer/cancer_train.csv.tfrecords validate_file ./data/cancer/cancer_test.csv.tfrecords feature_size 4 label_size 3  enable_colored_log

     python dense_classifier.py train_file ./data/cancer/cancer_train.csv.tfrecords validate_file ./data/cancer/cancer_test.csv.tfrecords feature_size 4 label_size 3  enable_colored_log

    使用dense_classifier.py 即可产生checkpoint文件夹,可供后续在http_service中使用rest_server进行调用。但是具体调用浏览器端仍存在数组越界的问题

    安装一个命令行下使用的文本浏览器便于测试使用

    https://www.cnblogs.com/tsdxdx/p/7221132.html

    Debian/Ubuntu:   apt-get install w3m w3m-img

    Centos:   yum install w3m w3m-img

    常见问题

    不再支持export

      • https://www.jianshu.com/p/91aae37f1da6
  • 相关阅读:
    你欠我的幸福,怎么弥补
    爱,请你走开
    一生为你
    爱你到底
    粒子滤波简介(转载)
    关于小波变换和Gabor变换的一些知识!
    基于Opencv的MeanShift跟踪算法实现
    opencv学习网页
    基于OpenCV库的Gabor滤波器的实现
    Mean Shift算法(CamShift)
  • 原文地址:https://www.cnblogs.com/theWinter/p/10150579.html
Copyright © 2011-2022 走看看