Skip to content

Instantly share code, notes, and snippets.

@wolf1986
wolf1986 / google_api.py
Created February 5, 2019 13:05
Google API
# Dependencies:
from logging import Logger
from pathlib import Path
from typing import List, Union
from google.oauth2 import service_account
from googleapiclient import discovery
from oauth2client import client, tools
from oauth2client.file import Storage
@wolf1986
wolf1986 / benchmark.py
Last active February 18, 2019 17:40
Research Benchmark Framework
# Adapted excerpt from: https://gist.github.com/wolf1986/1759c9b8bcfb09e92faf7e43797e4aef
import io
import traceback
from pprint import pformat
from time import perf_counter
from typing import List, Iterable, Callable, Any
from log_utils.data_logger import DataLogger
import numpy as np

Tensorflow Serving Tutorial - 02 - Using a Custom Model

In this tutorial:

  • Assuming you have an environment that can works with the official inception-v3
  • Adapt an existing model to work with TF Serving
  • Query the server with images and retrieve classification results

Save a model after training

In this example we'll suppose that we want our TF Model to accept base64 strings of image files, i.e. prepared by python:

  with open(PATH_IMAGE, 'rb') as f:
@wolf1986
wolf1986 / Tensorflow Serving Tutorial - 01 - Public Inception Model.md
Last active November 10, 2023 13:33
Tutorial for Running Tensorflow Serving

Tensorflow Serving Tutorial - 01 - Public Inception Model

In this tutorial:

  • Start with a blank Ubuntu
  • Install requirements
  • Download code & pre-tranied inception-v3 model from Google
  • Export the downloaded "checkpoint" format to a TF Graph that is servable with Tensorflow Model Serving
  • Query the server with images of a cat and a dog

General Notes

  • Compiling Tensorflow Serving from source (on docker with their official instructions) produces an internal gcc error (probably specific to tensorflow commit / gcc version used when writing this: tf serving commit: c1ec43508ee57a5d6269116aba82d2a16d383c8a)