Skip to content
Permalink
Browse files

Docker and more games

  • Loading branch information...
s32x committed Mar 16, 2019
1 parent 044554f commit 333ff5207036ac76c5b0fbf137ff56ff8f259bcb
Showing with 218 additions and 295 deletions.
  1. +24 −34 Dockerfile
  2. +3 −0 Makefile
  3. +2 −0 README.md
  4. +1 −1 go.mod
  5. +2 −2 go.sum
  6. BIN graph/output_graph.pb
  7. +25 −1 graph/output_labels.txt
  8. +0 −133 graph/scrape.py
  9. +6 −8 main.go
  10. +1 −1 scripts/scrape.py
  11. +3 −3 service/classify.go
  12. +111 −0 service/demo.go
  13. +0 −63 service/index.go
  14. +0 −15 service/renderer.go
  15. +24 −22 service/service.go
  16. +2 −2 service/static/assets/css/site.css
  17. BIN service/static/test/apex legends/apex_test.png
  18. BIN service/static/test/counter strike global offensive/csgo_test.png
  19. BIN service/static/test/destiny 2/d22_test.png
  20. BIN service/static/test/{ → destiny 2}/d2_test.png
  21. BIN service/static/test/{ → fortnite}/fortnite_test.png
  22. BIN service/static/test/gears of war 4/gow_test.png
  23. BIN service/static/test/grand theft auto v/gta_test.png
  24. BIN service/static/test/{ → h1z1}/h1z1_test.png
  25. BIN service/static/test/{ → heroes of the storm}/hots_test.png
  26. BIN service/static/test/{ → league of legends}/lol_test.png
  27. BIN service/static/test/nba 2k19/nba_test.png
  28. BIN service/static/test/{ → old school runescape}/osr_test.png
  29. BIN service/static/test/osu/osu_test.png
  30. BIN service/static/test/{ → overwatch}/ow_test.png
  31. BIN service/static/test/{ → rocket league}/rl_test.png
  32. BIN service/static/test/sea of thieves/sot_test.png
  33. BIN service/static/test/{ → starcraft ii}/sc2_test.png
  34. BIN service/static/test/super smash bros ultimate/smash_test.png
  35. BIN service/static/test/the jackbox party pack 5/jackbox_test.png
  36. BIN service/static/test/tom clancy s the division 2/div2_test.png
  37. BIN service/static/test/vrchat/vrchat_test.png
  38. BIN service/static/test/warframe/warframe_test.png
  39. BIN service/static/test/{ → world of tanks}/wot_test.png
  40. +14 −10 service/templates/index.html
@@ -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"]
@@ -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
@@ -10,6 +11,8 @@ test:
install:
make deps
go install
run:
DEMO=true go run main.go
deploy:
make deps
heroku container:login
@@ -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`:
```
2 go.mod
@@ -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 go.sum
@@ -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=
BIN +192 KB (100%) graph/output_graph.pb
Binary file not shown.
@@ -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
@@ -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
@@ -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
@@ -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
@@ -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

This file was deleted.

0 comments on commit 333ff52

Please sign in to comment.
You can’t perform that action at this time.