Skip to content

Commit

Permalink
Docker and more games
Browse files Browse the repository at this point in the history
  • Loading branch information
s32x committed Mar 16, 2019
1 parent 044554f commit 333ff52
Show file tree
Hide file tree
Showing 40 changed files with 218 additions and 295 deletions.
58 changes: 24 additions & 34 deletions Dockerfile
@@ -1,45 +1,35 @@
# ============================== BINARY BUILDER ==============================
FROM golang:latest as builder
FROM golang:1.12.1 as builder

# Copy in the source
COPY . /service
WORKDIR /service
COPY . /src
WORKDIR /src

# Dependencies
RUN GO111MODULE=on go mod vendor

# Install Tensorflow
RUN wget https://storage.googleapis.com/tensorflow/libtensorflow/libtensorflow-cpu-linux-x86_64-1.12.0.tar.gz
RUN tar -C /usr/local -xzf libtensorflow-cpu-linux-x86_64-1.12.0.tar.gz
# Download and Install Tensorflow CPU
RUN mkdir local && \
curl -L https://storage.googleapis.com/tensorflow/libtensorflow/libtensorflow-cpu-linux-x86_64-1.12.0.tar.gz | \
tar -C local -xz && \
cp -a local /usr

# Test before building
# Vendor, Test and Build the Binary
RUN GO111MODULE=on go mod vendor
RUN go test ./...

# Build the binary
RUN CGO_ENABLED=1 GOOS=linux GOARCH=amd64 go build -o ./bin/server
RUN CGO_ENABLED=1 go build -o ./bin/server

# ================================ FINAL IMAGE ================================
FROM ubuntu:latest
FROM ubuntu:18.04

# Dependencies
RUN apt-get update -y && \
apt-get upgrade -y && \
apt-get install -y wget

# Install Tensorflow
RUN wget https://storage.googleapis.com/tensorflow/libtensorflow/libtensorflow-cpu-linux-x86_64-1.12.0.tar.gz
RUN tar -C /usr/local -xzf libtensorflow-cpu-linux-x86_64-1.12.0.tar.gz
RUN rm -f libtensorflow-cpu-linux-x86_64-1.12.0.tar.gz

# Graph/Labels and static files
COPY graph /graph
COPY service/templates /service/templates
COPY service/static /service/static

# Environment
ENV LIBRARY_PATH=$LIBRARY_PATH:/usr/local/lib
ENV LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/lib

# Binary
COPY --from=builder /service/bin/server /usr/local/bin/server
RUN apt-get update -y && apt-get upgrade -y

# Copy Tensorflow
COPY --from=builder /src/local /usr
ENV LIBRARY_PATH $LIBRARY_PATH:/usr/local/lib
ENV LD_LIBRARY_PATH $LD_LIBRARY_PATH:/usr/local/lib

# Copy Graph/Labels, static files and Binary
COPY --from=builder /src/graph /graph
COPY --from=builder /src/service/templates /service/templates
COPY --from=builder /src/service/static /service/static
COPY --from=builder /src/bin/server /usr/local/bin/server
CMD ["server"]
3 changes: 3 additions & 0 deletions Makefile
Expand Up @@ -2,6 +2,7 @@ deps:
-rm -rf vendor
-rm -f go.mod
-rm -f go.sum
-rm -rf service/static/test/.DS_Store
go clean
GO111MODULE=on go mod init
GO111MODULE=on go mod vendor
Expand All @@ -10,6 +11,8 @@ test:
install:
make deps
go install
run:
DEMO=true go run main.go
deploy:
make deps
heroku container:login
Expand Down
2 changes: 2 additions & 0 deletions README.md
Expand Up @@ -20,6 +20,8 @@ curl -X POST https://gamedetect.io -F image=MY_GAME_SCREENSHOT.png

Excited yet? I sure am! gamedetect is a fun project I've been playing with in my free time to learn about Computer Vision, Neural Networks, and Tensorflow. It's sort of my own hello world app that also could potentially serve a real use-case on Twitch or any other streaming platform that requires broadcasters to categorize their stream. That being said, I'm still very much a beginner to all of this and I'm sure I'm doing a number of things wrong - feel free to let me know in the issues if you'd like.

NOTE: The public API is currently just for demonstration purposes. It's recommended to utilize the below Docker image if you're interested in higher performance on your own machine/s.

### Running with Docker
To start using gamedetect via Docker, install Docker and run `docker run`:
```
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Expand Up @@ -9,6 +9,6 @@ require (
github.com/mattn/go-colorable v0.1.1 // indirect
github.com/mattn/go-isatty v0.0.7 // indirect
github.com/tensorflow/tensorflow v1.13.1
github.com/valyala/fasttemplate v1.0.0 // indirect
github.com/valyala/fasttemplate v1.0.1 // indirect
golang.org/x/crypto v0.0.0-20190313024323-a1f597ede03a // indirect
)
4 changes: 2 additions & 2 deletions go.sum
Expand Up @@ -9,8 +9,8 @@ github.com/mattn/go-isatty v0.0.7/go.mod h1:Iq45c/XA43vh69/j3iqttzPXn0bhXyGjM0Hd
github.com/tensorflow/tensorflow v1.13.1 h1:ygn0+ztXusm6RGVP4Od5IF+8h5sAgD5qbeTvqYyMnjo=
github.com/tensorflow/tensorflow v1.13.1/go.mod h1:itOSERT4trABok4UOoG+X4BoKds9F3rIsySdn+Lvu90=
github.com/valyala/bytebufferpool v1.0.0/go.mod h1:6bBcMArwyJ5K/AmCkWv1jt77kVWyCJ6HpOuEn7z0Csc=
github.com/valyala/fasttemplate v1.0.0 h1:MCROMI9ZxNYyLvdmeQErZcgsUjsxARzi1SnHWYo3TnM=
github.com/valyala/fasttemplate v1.0.0/go.mod h1:KHLXt3tVN2HBp8eijSv/kGJopbvo7S+qRAEEKiv+SiQ=
github.com/valyala/fasttemplate v1.0.1 h1:tY9CJiPnMXf1ERmG2EyK7gNUd+c6RKGD0IfU8WdUSz8=
github.com/valyala/fasttemplate v1.0.1/go.mod h1:UQGH1tvbgY+Nz5t2n7tXsz52dQxojPUpymEIMZ47gx8=
golang.org/x/crypto v0.0.0-20190313024323-a1f597ede03a h1:YX8ljsm6wXlHZO+aRz9Exqr0evNhKRNe5K/gi+zKh4U=
golang.org/x/crypto v0.0.0-20190313024323-a1f597ede03a/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
Expand Down
Binary file modified graph/output_graph.pb
Binary file not shown.
26 changes: 25 additions & 1 deletion graph/output_labels.txt
@@ -1,12 +1,17 @@
13 sentinels aegis rim prologue
7 scarlet
a dance of fire and ice
ark
atlas
alien isolation
anthem
apex legends
arma 3
astroneer
baba is you
black desert online
bloodborne
brawl stars
call of duty black ops 4
call of duty modern warfare remastered
chess
Expand All @@ -19,15 +24,19 @@ dead or alive 6
demon s souls
destiny 2
devil may cry 5
diablo
diablo ii lord of destruction
divinity original sin ii
don t escape 4 days in a wasteland
dota 2
epic seven
escape from tarkov
euro truck simulator 2
fifa 19
final fantasy xiv online
factory town
final fantasy xv
fitness boxing
fortnite
gears of war 4
grand theft auto v
Expand All @@ -37,18 +46,25 @@ heroes of might and magic iii the shadow of death
heroes of the storm
hollow knight
human fall flat
just dance 2019
kageroh shadow corridor
kartrider
kerbal space program
knight online
league of legends
life is strange
lineage ii
lost ark online
madden nfl 19
magic the gathering
marbles on stream
mario tennis aces
metro exodus
minecraft
minion masters
modern warfare 2
monopoly plus
mortal kombat x
nba 2k19
old school runescape
outlaws of the old west
Expand All @@ -68,7 +84,9 @@ runescape
rust
satisfactory
sea of thieves
shenmue ii
sid meier s civilization vi
simulacra
skylanders ring of heroes
slay the spire
slime rancher
Expand All @@ -77,32 +95,38 @@ smite
spellbreak
starcraft ii
stardew valley
steam
subnautica
super mario maker
super mario odyssey
super smash bros melee
super smash bros ultimate
tekken 7
tetris 99
the binding of isaac afterbirth
the elder scrolls online
the elder scrolls v skyrim
the jackbox party pack 5
the legend of zelda breath of the wild
the legend of zelda ocarina of time
the legend of zelda the wind waker hd
the sims 4
the witcher
the witcher 3 wild hunt
the wolf among us
tibia
tom clancy s rainbow six siege
tom clancy s the division 2
trials rising
tropico 5
vrchat
viscera cleanup detail
warcraft iii the frozen throne
warframe
welcome to the game ii
white day a labyrinth named school
world of tanks
world of warcraft
world of warships
osu
osu
skribbl io
133 changes: 0 additions & 133 deletions graph/scrape.py

This file was deleted.

0 comments on commit 333ff52

Please sign in to comment.