Skip to content

Repository files navigation

Golang lib for pose detection using tensorflow openpose

Go ReferenceGogoreleaserGitHub go.mod Go version of a Go moduleGoReportCardGitHub licenseGitHub release

Prerequest

  1. libtensorfow 1.x Follow the instruction Install TensorFlow for C
  2. download tenorflow model graph

Demo

demo screen capture

Install

go get -u github.com/bububa/openpose

Camera & Server

Requirements

  • libjpeg-turbo (use -tags jpeg to build without CGo)
  • On Linux/RPi native Go V4L implementation is used to capture images.

Use Opencv4

make cvcamera

On linux/Pi

# use native Go V4L implementation is used to capture images
make linux_camera

Use image/jpeg instead of libjpeg-turbo

use jpeg build tag to build with native Go image/jpeg instead of libjpeg-turbo

go build -o=./bin/cvcamera -tags=cv4,jpeg ./cmd/camera

Usage as Server

Usage of camera:
-bind string
Bind address (default ":56000")
-delay int
Delay between frames, in milliseconds (default 10)
-width float
Frame width (default 640)
-height float
Frame height (default 480)
-index int
Camera index
-model string
mode path

User as lib

import (
"github.com/bububa/openpose"
)
funcmain() {
t:=openpose.NewPoseEstimator(modelPath, openpose.MobileNet)
wd, _:=os.Getwd()
img, err:=loadImage("./golf.jpg")
iferr!=nil {
log.Fatalln(err)
}
modelSize:=openpose.ModelSizeFastersharpenSigma:=0.0t.SetSharpenSigma(sharpenSigma)
humans, err:=t.Estimate(img, modelSize)
iferr!=nil {
log.Fatalln(err)
}
outImg:=openpose.DrawHumans(img, humans, 2)
saveImage(outImg, "./out/jpg")
}

About

human pose detection/estimation golang implementation using tensoflow openpose model

Topics

Resources

Stars

4 stars

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages