Leon

May happiness be with you


  • Home

  • About

  • Tags

  • Categories

  • Archives

  • Sitemap

  • Search

Docker multi-stage builds

Posted on 2018-12-28 | In Tutorial

Docker多阶段构建是17.05以后引入的新特性,旨在解决编译和构建复杂、镜像太大的问题。因此要使用多阶段构建特性必须使用高于或等于17.05的Docker。

Read more »

Python: Decorator

Posted on 2018-09-19 | Edited on 2019-11-05 | In Tutorial

Python 的修饰器的英文名叫 Decorator, 当你看到这个英文名的时候, 你可能会把其跟 Design Pattern 里的 Decorator 搞混了, 其实这是完全不同的两个东西. 在介绍装饰器之前, 我们先来点直观的认识, 下面一个 Python 修饰器的示例代码

1
2
3
4
5
6
7
8
9
10
11
12
13
14
def tags(tag_name):
def tags_decorator(func):
def func_wrapper(name):
return "<{0}>{1}</{0}>".format(tag_name, func(name))
return func_wrapper
return tags_decorator

@tags("div")
@tags("p")
@tags("span")
def get_text(name):
return "Hello " + name

print(get_text("John"))

运行这段代码时, 会有如下输出

1
<div><p><span>Hello John</span></p></div>

参考: https://www.cnblogs.com/zh605929205/p/7704902.html

Read more »

Merging Models for TensorFlow Serving

Posted on 2018-09-15 | Edited on 2018-09-19 | In Tool

This tool can merge TensorFlow frozen models(.pb file) into the same model. The advantage of doing this is that

  • When deploying, you only need to place the updated version of the model(merged model) in the corresponding location without restart the TensorFlow Serving service.
  • Hot switching can be done easily. That is, the service will not be interrupted when updating the model.

See more details on GitHub.

Usage

  1. Put frozen models(.pb file) into ./frozen directory.
  2. Add serving information in export_serving_model.py.
    • Set update messages UPDATE_MESSAGE.
    • Define a export(merging) function.
    • Put ServingInfo.export decorator on export function(if not, then this model will not export).
  3. Run export_serving_model.py.
  4. Copy the serving model ./serving/{version} to your serving model directory on the server, it will be automatically loaded.
  5. Call it by RPC, such as gRPC.
Read more »

Commonly Used Docker Commands

Posted on 2018-09-08 | Edited on 2018-09-15 | In Tutorial

常用的 Docker 命令

本文集中了一些常用的 Docker 命令, 详细还请查看 官方文档.

  • 查看容器: docker ps
  • 查看镜像: docker images
  • 运行镜像: docker run <IMAGE>
  • 进入容器: docker exec -t -i <CONTAINER> /bin/bash
Read more »

LabelMe-Docker: Online Annotaion Tool Docker Image

Posted on 2018-09-07 | Edited on 2018-12-05 | In Tool

LabelMe 是一个用 Javascript 编写的图像标注工具, 可以用于 在线 图像标注. 也就是说, LabelMe 可以部署在服务器, 然后使用浏览器进行访问.

与传统图像标注工具相比, 优势在于可以从任何地方访问该工具, 而且不需要在自己机器上安装或复制整个大型数据集. 它有如下优势

  • 添加待标图片和获取标注结果方便.
  • 降低外包人员招聘成本: 之前需要招聘专职标注人员到公司进行标注, 招聘难度大.
  • 降低标注成本: 因为能够远程标注, 自由度高, 可以适当降低标注价格.
  • 降低标注数据泄露的风险: 待标图片和标注结果均在服务器上.
Read more »
12
Leon Lau

Leon Lau

Plodding wins the race

9 posts
2 categories
16 tags
RSS
© 2019 Leon Lau
Powered by Hexo v3.7.1
|
Theme – NexT.Gemini v6.4.1