-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #4 from medtune/dev-rest-capsuls
Support custom REST capsules
- Loading branch information
Showing
64 changed files
with
1,143 additions
and
484 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,138 @@ | ||
.dev/ | ||
|
||
# compiled cmd | ||
main | ||
capsul | ||
capsul-cmd | ||
|
||
# exported model | ||
weights/ | ||
|
||
# before exporting models weights | ||
weights-bexp/ | ||
|
||
# github.com/tensorflow/models repo --depth=1 | ||
models/ | ||
|
||
# bins | ||
*.so | ||
*.o | ||
|
||
# tensorflow pacakges | ||
tensorflow | ||
serving | ||
tensorflow_serving | ||
vendor | ||
vendor | ||
|
||
# Weights | ||
weights/ | ||
# Weights subdir | ||
1/ | ||
2/ | ||
3/ | ||
|
||
# python gitignore | ||
# Byte-compiled / optimized / DLL files | ||
__pycache__/ | ||
*.py[cod] | ||
*$py.class | ||
|
||
# C extensions | ||
*.so | ||
|
||
# Distribution / packaging | ||
.Python | ||
build/ | ||
develop-eggs/ | ||
dist/ | ||
downloads/ | ||
eggs/ | ||
.eggs/ | ||
lib/ | ||
lib64/ | ||
parts/ | ||
sdist/ | ||
var/ | ||
wheels/ | ||
*.egg-info/ | ||
.installed.cfg | ||
*.egg | ||
MANIFEST | ||
|
||
# PyInstaller | ||
# Usually these files are written by a python script from a template | ||
# before PyInstaller builds the exe, so as to inject date/other infos into it. | ||
*.manifest | ||
*.spec | ||
|
||
# Installer logs | ||
pip-log.txt | ||
pip-delete-this-directory.txt | ||
|
||
# Unit test / coverage reports | ||
htmlcov/ | ||
.tox/ | ||
.coverage | ||
.coverage.* | ||
.cache | ||
nosetests.xml | ||
coverage.xml | ||
*.cover | ||
.hypothesis/ | ||
.pytest_cache/ | ||
|
||
# Translations | ||
*.mo | ||
*.pot | ||
|
||
# Django stuff: | ||
*.log | ||
local_settings.py | ||
db.sqlite3 | ||
|
||
# Flask stuff: | ||
instance/ | ||
.webassets-cache | ||
|
||
# Scrapy stuff: | ||
.scrapy | ||
|
||
# Sphinx documentation | ||
docs/_build/ | ||
|
||
# PyBuilder | ||
target/ | ||
|
||
# Jupyter Notebook | ||
.ipynb_checkpoints | ||
|
||
# pyenv | ||
.python-version | ||
|
||
# celery beat schedule file | ||
celerybeat-schedule | ||
|
||
# SageMath parsed files | ||
*.sage.py | ||
|
||
# Environments | ||
.env | ||
.venv | ||
env/ | ||
venv/ | ||
ENV/ | ||
env.bak/ | ||
venv.bak/ | ||
|
||
# Spyder project settings | ||
.spyderproject | ||
.spyproject | ||
|
||
# Rope project settings | ||
.ropeproject | ||
|
||
# mkdocs documentation | ||
/site | ||
|
||
# mypy | ||
.mypy_cache/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,138 @@ | ||
build-image: | ||
docker build -t medtune/capsul . | ||
CONTAINER_ENGINE=docker | ||
CAPSUL_VERSION=0.0.2 | ||
CAPSUL_CMD_VERSION=0.0.1 | ||
MAINTAINERS=AEB MAHs | ||
|
||
GOCMD=go | ||
GOVERSION=$(GOCMD) version | ||
GOBUILD=$(GOCMD) build | ||
GOCLEAN=$(GOCMD) clean | ||
GOTEST=$(GOCMD) test | ||
GOGET=$(GOCMD) get | ||
|
||
BINARY_FILE=cmd/main.go | ||
BINARY_NAME=capsul | ||
|
||
build: | ||
CGO_ENABLED=0 GOOS=linux GOARCH=amd64 $(GOBUILD) -o $(BINARY_NAME) -v $(BINARY_FILE) | ||
|
||
test: | ||
$(GOTEST) -v ./... | ||
|
||
clean: | ||
$(GOCLEAN) | ||
rm -f $(BINARY_NAME) | ||
|
||
|
||
test-clean: | ||
rm -f test/testdata/*_cam.png | ||
|
||
|
||
# build base container image | ||
# does not compile binaries | ||
build-base: | ||
@echo building base capsul library ... | ||
docker build \ | ||
-t medtune/capsul:base \ | ||
-f build/base.Dockerfile \ | ||
. | ||
|
||
|
||
# build capsul package and tag version/latest | ||
capsul: build-base | ||
docker tag medtune/capsul:base medtune/capsul:v0.0.2 | ||
docker tag medtune/capsul:base medtune/capsul:latest | ||
|
||
|
||
# alias capsul | ||
capsul-base: capsul | ||
|
||
|
||
# build capsul command line tool | ||
build-cmd: | ||
@echo building base capsul library ... | ||
docker build \ | ||
-t medtune/capsul:cmd \ | ||
-f build/cmd.Dockerfile \ | ||
. | ||
|
||
|
||
# build capsul cmd & tag version/latest | ||
capsul-cmd: build-cmd | ||
docker tag medtune/capsul:cmd medtune/capsul:cmd-v0.0.2 | ||
docker tag medtune/capsul:cmd medtune/capsul:cmd-latest | ||
|
||
|
||
# Build mnist tf server image | ||
build-mnist: | ||
@echo building model capsul mnist ... | ||
docker build \ | ||
-t medtune/capsul:mnist \ | ||
-f build/capsules/mnist.Dockerfile \ | ||
. | ||
|
||
|
||
# Build inception tf server image | ||
build-inception: | ||
@echo building model capsul inception ... | ||
docker build \ | ||
-t medtune/capsul:inception \ | ||
-f build/capsules/inception.Dockerfile \ | ||
. | ||
|
||
|
||
# Build mura inception restnet v2 tf server image | ||
build-mura-irn-v2: | ||
@echo building model capsul mura inception resnet v2 ... | ||
docker build \ | ||
-t medtune/capsul:mura-irn-v2 \ | ||
-f build/capsules/mura_irn_v2.Dockerfile \ | ||
. | ||
|
||
|
||
# Build mura mobilenet v2 tf server image | ||
build-mura-mn-v2: | ||
@echo building model capsul mura mobilenet v2 ... | ||
docker build \ | ||
-t medtune/capsul:mura-mn-v2 \ | ||
-f build/capsules/mura_mobilenet_v2.Dockerfile \ | ||
. | ||
|
||
|
||
# Build mura mobile net grad cam customized server | ||
build-mura-mn-v2-cam: | ||
@echo building grad cam server for mura mobilenet v2 | ||
docker build \ | ||
-t medtune/capsul:mura-mn-v2-cam \ | ||
-f build/csflask/mura_mn_v2_cam.Dockerfile \ | ||
. | ||
|
||
|
||
# build mura main image | ||
build-mura: build-mura-mn-v2 | ||
@echo taging mura-mn-v2 with mura | ||
docker tag medtune/capsul:mura-mn-v2 medtune/capsul:mura | ||
|
||
|
||
# Build mura | ||
build-mura-cam: build-mura-mn-v2-cam | ||
@echo building model capsul mura-cam ... | ||
docker tag medtune/capsul:mura-mn-v2-cam medtune/capsul:mura-cam | ||
|
||
|
||
# Build chexray | ||
build-chexray: | ||
@echo building model capsul chexray ... | ||
docker build \ | ||
-t medtune/capsul:chexray \ | ||
-f build/capsules/chexray.Dockerfile \ | ||
. | ||
|
||
|
||
build-csflask: build-mura-mn-v2-cam | ||
|
||
|
||
build-capsules: build-mnist \ | ||
build-inception \ | ||
build-mura-mn-v2 \ | ||
build-mura-irn-v2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
FROM golang:1.10 | ||
|
||
# Update system (ubuntu) | ||
RUN apt-get update && apt update | ||
|
||
# Add project to default GOPATH | ||
ADD cmd /go/src/github.com/medtune/capsul/cmd | ||
ADD csflask /go/src/github.com/medtune/capsul/csflask | ||
ADD pkg /go/src/github.com/medtune/capsul/pkg | ||
ADD hack /go/src/github.com/medtune/capsul/hack | ||
ADD plugins /go/src/github.com/medtune/capsul/plugins | ||
ADD examples /go/src/github.com/medtune/capsul/examples | ||
ADD test /go/src/github.com/medtune/capsul/test | ||
|
||
# install unzip | ||
RUN apt install unzip -y | ||
|
||
# Download protoc binaries | ||
RUN curl -OL https://github.com/google/protobuf/releases/download/v3.6.1/protoc-3.6.1-linux-x86_64.zip | ||
|
||
# unzip | ||
RUN unzip ./protoc-3.6.1-linux-x86_64.zip -d protoc3 | ||
|
||
# Move protoc binaries | ||
RUN mv protoc3/bin/* /usr/local/bin/ && \ | ||
mv protoc3/include/* /usr/local/include/ | ||
|
||
# Install golang protoc & grpc | ||
RUN go get github.com/golang/protobuf/ptypes/wrappers | ||
RUN go get google.golang.org/grpc | ||
RUN go get github.com/golang/protobuf/protoc-gen-go | ||
|
||
# Git clone tensorflow/tensorflow and tensorflow/serving version 1.7 | ||
#NOTE: earlier version (>1.7) fail to compile ? | ||
RUN git clone \ | ||
--depth 1 \ | ||
-b r1.7 \ | ||
https://github.com/tensorflow/serving.git | ||
|
||
RUN git clone \ | ||
--depth 1 \ | ||
-b r1.7 \ | ||
https://github.com/tensorflow/tensorflow.git | ||
|
||
# Compile proto files using gRPC plugin | ||
RUN PROTOC_OPTS='-I tensorflow -I serving --go_out=plugins=grpc:src' && \ | ||
eval "protoc $PROTOC_OPTS serving/tensorflow_serving/apis/*.proto" && \ | ||
eval "protoc $PROTOC_OPTS serving/tensorflow_serving/config/*.proto" && \ | ||
eval "protoc $PROTOC_OPTS serving/tensorflow_serving/util/*.proto" && \ | ||
eval "protoc $PROTOC_OPTS serving/tensorflow_serving/sources/storage_path/*.proto" && \ | ||
eval "protoc $PROTOC_OPTS tensorflow/tensorflow/core/framework/*.proto" && \ | ||
eval "protoc $PROTOC_OPTS tensorflow/tensorflow/core/example/*.proto" && \ | ||
eval "protoc $PROTOC_OPTS tensorflow/tensorflow/core/lib/core/*.proto" && \ | ||
eval "protoc $PROTOC_OPTS tensorflow/tensorflow/core/protobuf/meta_graph.proto" && \ | ||
eval "protoc $PROTOC_OPTS tensorflow/tensorflow/core/protobuf/saver.proto" | ||
|
||
#TODO: Install gocv: opencv bindings | ||
|
||
# Set work dir | ||
WORKDIR /go/src/github.com/medtune/capsul | ||
|
||
#RUN go install ./example/inception-inference | ||
#RUN go install ./example/model-status | ||
#RUN go install ./example/mnist-inference/main.go |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
FROM baseImage |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
FROM baseImage |
1 change: 1 addition & 0 deletions
1
images/src/inception.Dockerfile → build/capsules/chexray.Dockerfile
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
FROM medtune/tensorflow-serving:bazel-cpu | ||
|
||
RUN mkdir -p /models/chexray |
Oops, something went wrong.