Documentation
¶
Index ¶
- Constants
- Variables
- func BodyPartID(humanID int, part CocoPart) string
- func ColorFromHex(hexColor string) color.RGBA
- func DrawHumans(img image.Image, humans []Human, strokeWidth float64) image.Image
- func RoundInt(v float64) int
- type BodyPart
- type BodyPartPair
- type CocoPart
- type Connection
- type Human
- type MPIIPart
- type ModelSize
- type ModelType
- type PartPair
- type Point
- type PoseEstimator
- type Rectangle
- type Size
Constants ¶
const ( ThresholdPartConfidence float32 = 0.3 InterThreashold float32 = 0.1 InterMinAboveThreshold int = 6 NMS_Threshold float64 = 0.1 MinSubsetCnt int = 4 MinSubsetScore float32 = 0.8 ThresholdHumanScore float32 = 0.4 )
const (
DefaultSharpenSigma float64 = 0.0
)
const TotalBodyParts = 18
Variables ¶
var CocoColors = [][3]uint8{
{255, 0, 0}, {255, 85, 0}, {255, 170, 0}, {255, 255, 0}, {170, 255, 0}, {85, 255, 0}, {0, 255, 0}, {0, 255, 85}, {0, 255, 170}, {0, 255, 255}, {0, 170, 255}, {0, 85, 255}, {0, 0, 255}, {85, 0, 255}, {170, 0, 255}, {255, 0, 255}, {255, 0, 170}, {255, 0, 85},
}
CocoColors represents color for coco parts
var CocoPairs = [][2]CocoPart{ {CocoPartNeck, CocoPartRShoulder}, {CocoPartNeck, CocoPartLShoulder}, {CocoPartRShoulder, CocoPartRElbow}, {CocoPartRElbow, CocoPartRWrist}, {CocoPartLShoulder, CocoPartLElbow}, {CocoPartLElbow, CocoPartLWrist}, {CocoPartNeck, CocoPartRHip}, {CocoPartRHip, CocoPartRKnee}, {CocoPartRKnee, CocoPartRAnkle}, {CocoPartNeck, CocoPartLHip}, {CocoPartLHip, CocoPartLKnee}, {CocoPartLKnee, CocoPartLAnkle}, {CocoPartNeck, CocoPartNose}, {CocoPartNose, CocoPartREye}, {CocoPartREye, CocoPartREar}, {CocoPartNose, CocoPartLEye}, {CocoPartLEye, CocoPartLEar}, {CocoPartRShoulder, CocoPartREar}, {CocoPartLShoulder, CocoPartLEar}, }
CocoPairs coco part pairs
var CocoPairsNetwork = [][2]CocoPart{
{12, 13}, {20, 21}, {14, 15}, {16, 17}, {22, 23}, {24, 25}, {0, 1}, {2, 3}, {4, 5}, {6, 7}, {8, 9}, {10, 11}, {28, 29}, {30, 31}, {34, 35}, {32, 33}, {36, 37}, {18, 19}, {26, 27},
}
CocoPairNetwork .
var CocoPairsRender = CocoPairs[0 : len(CocoPairs)-2]
CocoPairsRender represents coco pairs for render
var CoordParts = []CocoPart{ CocoPartNose, CocoPartNeck, CocoPartRShoulder, CocoPartLShoulder, CocoPartRHip, CocoPartLHip, CocoPartREye, CocoPartLEye, CocoPartREar, CocoPartLEar, }
CoordParts represents CocoParts for coordinate
var CoordPartsMap = map[CocoPart]struct{}{ CocoPartNose: {}, CocoPartNeck: {}, CocoPartRShoulder: {}, CocoPartLShoulder: {}, CocoPartRHip: {}, CocoPartLHip: {}, CocoPartREye: {}, CocoPartLEye: {}, CocoPartREar: {}, CocoPartLEar: {}, }
CoordPartsMap represents CocoParts for coordinate in map
var PartPairs = []PartPair{ {MPIIPartHead, CocoPartNose}, {MPIIPartNeck, CocoPartNeck}, {MPIIPartRShoulder, CocoPartRShoulder}, {MPIIPartRElbow, CocoPartRElbow}, {MPIIPartRWrist, CocoPartRWrist}, {MPIIPartLShoulder, CocoPartLShoulder}, {MPIIPartLElbow, CocoPartLElbow}, {MPIIPartLWrist, CocoPartLWrist}, {MPIIPartRHip, CocoPartRHip}, {MPIIPartRKnee, CocoPartRKnee}, {MPIIPartRAnkle, CocoPartRAnkle}, {MPIIPartLHip, CocoPartLHip}, {MPIIPartLKnee, CocoPartLKnee}, {MPIIPartLAnkle, CocoPartLAnkle}, }
PartPairs represents MPIIPart, CocoPart pair list
var ZP = Point{0, 0}
ZP represents zero position point
var ZR = Rect(0, 0, 0, 0)
ZR represents zero size rectangle
var ZS = ASize(0, 0)
ZS returns a new Size with zero
Functions ¶
func BodyPartID ¶
BodyPartID returns a BodyPart.ID with given CocoPart and index
Types ¶
type BodyPart ¶
type BodyPart struct { // Part CocoPart Part CocoPart // Point coordinate of body part Point Point // Score confidence score Score float32 }
BodyPart represents body part
func NewBodyPart ¶
NewBodyPart returns a new BodyPart
type BodyPartPair ¶
BodyPartPair ...
type CocoPart ¶
type CocoPart int
CocoPart represents body parts
const ( // CocoPartNose nose CocoPartNose CocoPart = iota // CocoPartNeck neck CocoPartNeck // CocoPartRShoulder right sholder CocoPartRShoulder // CocoPartRElbow right elbow CocoPartRElbow // CocoPartRWrist right wrist CocoPartRWrist // CocoPartLShoulder left sholder CocoPartLShoulder // CocoPartLElbow left elbow CocoPartLElbow // CocoPartLWrist left wrist CocoPartLWrist // CocoPartRHip right hip CocoPartRHip // CocoPartRKnee right knee CocoPartRKnee // CocoPartRAnkle right ankle CocoPartRAnkle // CocoPartLHip left hip CocoPartLHip // CocoPartLKnee left knee CocoPartLKnee // CocoPartLAnkle left ankle CocoPartLAnkle // CocoPartREye right eye CocoPartREye // CocoPartLEye left eye CocoPartLEye // CocoPartREar right ear CocoPartREar // CocoPartLEar left ear CocoPartLEar // CocoPartBackground background CocoPartBackground )
type Connection ¶
type Connection struct { Score float32 Coords [2]image.Point Idx [2]int Parts [2]CocoPart Scores [2]float32 NormPadding Size UPartIdx map[string]struct{} }
Connection represents coco part connection
func (Connection) GetUPartIdx ¶
func (c Connection) GetUPartIdx() map[string]struct{}
GetUPartIdx generate uniq partidx string for merge connections
func (Connection) ToBodyParts ¶
func (c Connection) ToBodyParts(parts *[2]BodyPart, rows float64, cols float64)
ToBodyPart returns BodyParts based on Connection
type Human ¶
Human represents human structure
func (Human) GetFaceBox ¶
GetFaceBox returns upper body box compared to img size (w, h)
func (Human) GetMaxScore ¶
GetMaxScore returns the max score of body parts
func (Human) GetUpperBodyBox ¶
GetUpperBodyBox returns upper body box compared to img size (w, h)
type MPIIPart ¶
type MPIIPart int
MPIIPart MPII human parts
const ( // MPIIPartRAnkle right ankle MPIIPartRAnkle MPIIPart = iota // MPIIPartRKnee right knee MPIIPartRKnee MPIIPartRHip // MPIIPartLHip left hip MPIIPartLHip // MPIIPartLKnee left knee MPIIPartLKnee // MPIIPartLAnkle left ankle MPIIPartLAnkle // MPIIPartRWrist right wrist MPIIPartRWrist // MPIIPartRElbow right elbow MPIIPartRElbow // MPIIPartRShoulder right sholder MPIIPartRShoulder // MPIIPartLShoulder left sholder MPIIPartLShoulder // MPIIPartLElbow left elbow MPIIPartLElbow // MPIIPartLWrist left wrist MPIIPartLWrist // MPIIPartNeck neck MPIIPartNeck // MPIIPartHead head MPIIPartHead )
type Point ¶
Point represents coordinate
func BodyPartsPoints ¶
BodyPartsPoints return body part points
type PoseEstimator ¶
type PoseEstimator struct {
// contains filtered or unexported fields
}
PoseEstimator represents pose estimator instance
func NewPoseEstimator ¶
func NewPoseEstimator(modelPath string, modelType ModelType) *PoseEstimator
NewPoseEstimator returns a new TensorFlow PoseEstimator instance.
func (*PoseEstimator) LoadModel ¶
func (t *PoseEstimator) LoadModel() error
LoadModel load tensorfow model
func (*PoseEstimator) ModelLoaded ¶
func (t *PoseEstimator) ModelLoaded() bool
ModelLoaded tests if the TensorFlow model is loaded.
func (*PoseEstimator) SetSharpenSigma ¶
func (t *PoseEstimator) SetSharpenSigma(sigma float64)
SetSharpenSigma set sharpen sigma for image preprocessing
Source Files
¶
Directories
¶
Path | Synopsis |
---|---|
cmd
|
|
camera/server
Package server implement server
|
Package server implement server |
camera/server/handlers
Package handlers include server handlers
|
Package handlers include server handlers |
Package combinations a package with combinations functions from python itertools
|
Package combinations a package with combinations functions from python itertools |
Package gaussian gaussian filter for mat
|
Package gaussian gaussian filter for mat |