face

package
v0.0.0-...-2fb99e4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 4, 2023 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BaseResponse

type BaseResponse struct{ pkg.BaseResponse }

func (*BaseResponse) MissToken

func (br *BaseResponse) MissToken() bool

MissToken FaceToken不存在

func (*BaseResponse) NoFace

func (br *BaseResponse) NoFace() bool

NoFace 图片没有人脸

func (*BaseResponse) NoMatch

func (br *BaseResponse) NoMatch() bool

NoMatch 未找到匹配的用户

func (*BaseResponse) NoUser

func (br *BaseResponse) NoUser() bool

NoUser 用户不存在

func (*BaseResponse) UrlError

func (br *BaseResponse) UrlError() bool

UrlError 图片下载失败

type DetectFace

type DetectFace struct {
	FaceToken string `json:"face_token"`
	Location  struct {
		Left     float64 `json:"left"`
		Top      float64 `json:"top"`
		Width    float64 `json:"width"`
		Height   float64 `json:"height"`
		Rotation float64 `json:"rotation"`
	} `json:"location"`
	FaceProbability float64 `json:"face_probability"`
	Angle           struct {
		Yaw   float64 `json:"yaw"`
		Pitch float64 `json:"pitch"`
		Roll  float64 `json:"roll"`
	} `json:"angle"`
	Age        float64 `json:"age"`
	Beauty     float64 `json:"beauty"`
	Expression struct {
		Type        string  `json:"type"`
		Probability float64 `json:"probability"`
	} `json:"expression"`
	Gender struct {
		Type        string  `json:"type"`
		Probability float64 `json:"probability"`
	} `json:"gender"`
	Glasses struct {
		Type        string  `json:"type"`
		Probability float64 `json:"probability"`
	} `json:"glasses"`
	Emotion struct {
		Type        string  `json:"type"`
		Probability float64 `json:"probability"`
	} `json:"emotion"`
	Mask struct {
		Type        int     `json:"type"`
		Probability float64 `json:"probability"`
	} `json:"mask"`
	Quality struct {
		Occlusion struct {
			LeftEye     float64 `json:"left_eye"`
			RightEye    float64 `json:"right_eye"`
			Nose        float64 `json:"nose"`
			Mouth       float64 `json:"mouth"`
			LeftCheek   float64 `json:"left_cheek"`
			RightCheek  float64 `json:"right_cheek"`
			ChinContour float64 `json:"chin_contour"`
		} `json:"occlusion"`
		Blur         float64 `json:"blur"`
		Illumination float64 `json:"illumination"`
		Completeness int8    `json:"completeness"`
	} `json:"quality"`
}

func (*DetectFace) HasGlasses

func (df *DetectFace) HasGlasses() bool

func (*DetectFace) HasMask

func (df *DetectFace) HasMask() bool

type DetectRequest

type DetectRequest struct {
	Image           string `json:"image"`
	ImageType       string `json:"image_type"`
	FaceField       string `json:"face_field,omitempty"`
	MaxFaceNum      uint32 `json:"max_face_num,omitempty"`
	FaceType        string `json:"face_type,omitempty"`
	LivenessControl string `json:"liveness_control,omitempty"`
}

type DetectResponse

type DetectResponse struct {
	BaseResponse
	Result struct {
		FaceNum  int           `json:"face_num"`
		FaceList []*DetectFace `json:"face_list"`
	} `json:"result"`
}

type GroupDelRequest

type GroupDelRequest struct {
	GroupId string `json:"group_id"`
}

type GroupDelResponse

type GroupDelResponse struct{ BaseResponse }

type MatchUser

type MatchUser struct {
	GroupId  string  `json:"group_id"`
	UserId   string  `json:"user_id"`
	UserInfo string  `json:"user_info"`
	Score    float64 `json:"score"`
}

type MultiSearchRequest

type MultiSearchRequest struct {
	Image           string  `json:"image"`
	ImageType       string  `json:"image_type"`
	GroupIdList     string  `json:"group_id_list"`
	QualityControl  string  `json:"quality_control,omitempty"`
	LivenessControl string  `json:"liveness_control,omitempty"`
	MatchThreshold  float64 `json:"match_threshold,omitempty"`
	MaxFaceNum      int     `json:"max_face_num,omitempty"`
	MaxUserNum      int     `json:"max_user_num,omitempty"`
}

type MultiSearchResponse

type MultiSearchResponse struct {
	BaseResponse
	Result struct {
		FaceNum  int `json:"face_num"`
		FaceList []struct {
			FaceToken string `json:"face_token"`
			Location  struct {
				Left     float64 `json:"left"`
				Top      float64 `json:"top"`
				Width    float64 `json:"width"`
				Height   float64 `json:"height"`
				Rotation float64 `json:"rotation"`
			} `json:"location"`
			UserList []MatchUser `json:"user_list"`
		} `json:"face_list"`
	} `json:"result"`
}

type SDK

type SDK struct {
	// contains filtered or unexported fields
}

func NewSDK

func NewSDK(token string, err error) SDK

func (SDK) Detect

func (sdk SDK) Detect(req *DetectRequest) (*DetectResponse, error)

Detect 人脸检测 https://ai.baidu.com/ai-doc/FACE/yk37c1u4t

func (SDK) Search

func (sdk SDK) Search(req *SearchRequest) (*SearchResponse, error)

Search 人脸搜索 https://ai.baidu.com/ai-doc/FACE/Gk37c1uzc

func (SDK) UserDel

func (sdk SDK) UserDel(req *UserDelRequest) (*UserDelResponse, error)

UserDel 删除人脸 https://ai.baidu.com/ai-doc/FACE/7k37c1twu

type SearchRequest

type SearchRequest struct {
	Image           string `json:"image"`
	ImageType       string `json:"image_type"`
	GroupIdList     string `json:"group_id_list"`
	QualityControl  string `json:"quality_control,omitempty"`
	LivenessControl string `json:"liveness_control,omitempty"`
	UserId          string `json:"user_id,omitempty"`
	MaxUserNum      int    `json:"max_user_num,omitempty"`
	MatchThreshold  int    `json:"match_threshold,omitempty"`
}

type SearchResponse

type SearchResponse struct {
	BaseResponse
	Result struct {
		FaceToken string      `json:"face_token"`
		UserList  []MatchUser `json:"user_list"`
	} `json:"result"`
}

type UserAddRequest

type UserAddRequest struct {
	Image           string `json:"image"`
	ImageType       string `json:"image_type"`
	GroupId         string `json:"group_id"`
	UserId          string `json:"user_id"`
	UserInfo        string `json:"user_info,omitempty"`
	QualityControl  string `json:"quality_control,omitempty"`
	LivenessControl string `json:"liveness_control,omitempty"`
	ActionType      string `json:"action_type,omitempty"`
}

type UserAddResponse

type UserAddResponse struct {
	BaseResponse
	Result struct {
		FaceToken string `json:"face_token"`
		Location  struct {
			Left     float64 `json:"left"`
			Top      float64 `json:"top"`
			Width    float64 `json:"width"`
			Height   float64 `json:"height"`
			Rotation float64 `json:"rotation"`
		} `json:"location"`
	} `json:"result"`
}

type UserDelRequest

type UserDelRequest struct {
	UserId  string `json:"user_id"`
	GroupId string `json:"group_id"`
}

type UserDelResponse

type UserDelResponse struct{ BaseResponse }

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL