Snow Chain-Integrated Tire for a Safe Drive on Winter Roads
TensorFlow, Docker & GoLang - All for Image Rekognition Sangam Biradar(EngineITops)
1. TensorFlow + Golang + Docker = all for
image recognition
21 Sept 2019
Docker Bangalore
Meetup at Amazon
Bangalore
2. $Whoami
Sangam Biradar
Github-sangam14
Twitter-BiradarSangam
$curl engineitops.com
- My Personal Blog Website
- Over 100+ blog post on docker | Golang and kubernetes and
cloud
- Unique 50000+ hits
- Research Papers Presented/Published in the Conference
Proceedings(IEEE)
1.“Build Minimal Docker Container Using Golang’’- presented
and published in the proceedings of the International
Conference ICICCS2018 at Vaigai College Of Engineering,
Madurai 14 June 18
4. Introduction to tensor flow
Tensors, in general, are simply arrays of numbers, or
functions, that transform according to certain rules under a
change of coordinates.
TensorFlow is an open source software library for doing graph-
based computations quickly. It does this by utilizing the
GPU(Graphics Processing Unit), and also making it easy to
distribute the work across multiple GPUs and computers.
6. Common-use-cases
you can find some in the TensorFlow Models
repo https://github.com/tensorflow/models.
we'll use one of them, called Inception to
recognize an
image. https://github.com/tensorflow/models/tre
e/master/research/inception/inception
7. Tensor flow trained model
image with TensorFlow plus Go to reduce Dockerfile.
https://github.com/ctava/tensorflow-go
Download Inception
data: http://download.tensorflow.org/models/inception5h
.zip
Let's start with simple main.go file to test if our
Dockerfile works.
8. Test
reduce my Dockerfile.
https://github.com/ctava/tensorflow-go
Download Inception data: http://download.tensorflow.org/models/inception5h.zip
Let's start with simple main.go file to test if our Dockerfile works.
package main
func main()
{
if len(os.Args) < 2
{
log.Fatalf("usage: imgrecognition <image_url>")
}
fmt.Printf("url: %sn", os.Args[1])
}
9. Build Dockerfile
docker build -t imgrecognition .
docker run imgrecognition https://www.iaspaper.net/wp-
content/uploads/2017/10/Rabbit-Essay.jpg Let's get
our image from the provided URL:
// Get image from URL response, e := http.Get(os.Args[1])
if e != nil {
log.Fatalf("unable to get image from url: %v", e)
}
defer response.Body.Close()
11. Also let's skip those warnings:
os.Setenv("TF_CPP_MIN_LOG_LEVEL", "2")
Here we worked with pre-trained model, let's try this program with
something unusual, like ... Gopher.
docker run imgrecognition
https://i.pinimg.com/736x/12/5c/e0/125ce0baff3271761ca61843eccf7985.jp
g
Mouse?? no! But it's possible to train our models from Go in TensorFlow.