util

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Feb 9, 2021 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const (
	H, W    = 299, 299
	SH, SW  = 112, 112
	MAX_LNE = 1 << 7
)
View Source
const (
	HANDLER_NAME_DOWNLOAD = "handlerdownload"
	HANDLER_NAME_MODEL    = "handlermodel"
)
View Source
const (
	MODEL_NAME_IMAGE     = "image"
	MODEL_NAME_CLASSIFY  = "classify"
	MODEL_NAME_EMBEDDING = "embedding"
	MODEL_NAME_ESMM      = "esmm"
	MODEL_NAME_MTCNN     = "mtcnn"
)
View Source
const (
	SECTION_REDIS = "redis"
)

Variables

View Source
var (
	// 输入参数错误定义
	ErrReqBody = &errno.Errno{10001, "recive body error"}
	ErrReqUUID = &errno.Errno{10002, "request body miss required parameter"}

	ErrServiceV1 = &errno.Errno{10003, "service_type or service_key error"}
	ErrServiceV2 = &errno.Errno{10004, "request body has no service_type or service_key"}

	ErrImageNoExist = &errno.Errno{10005, "image not in params"}
	ErrImageFormat  = &errno.Errno{10006, "request body has no service_type or service_key"}

	ErrService = &errno.Errno{10007, "service error"}
)

Functions

func GetImageFromFile

func GetImageFromFile(filename string) (gocv.Mat, error)

func GetImageFromStream

func GetImageFromStream(data []byte) (gocv.Mat, error)

func GetUrlID

func GetUrlID(url string) (uid string)

func GetUrlParams

func GetUrlParams(c *gin.Context, key string) string

func LoadLabel

func LoadLabel(file string) (map[string]int64, error)

func MakeImageTensorByCenter

func MakeImageTensorByCenter(src gocv.Mat) (*tf.Tensor, error)

func MakeImageTensorByGocv

func MakeImageTensorByGocv(img gocv.Mat) (*tf.Tensor, error)

func MakeImageTensorByPoint

func MakeImageTensorByPoint(src gocv.Mat, points [][]float32) (*tf.Tensor, error)

func NewSavedModel

func NewSavedModel(modelFile string) (*tf.SavedModel, error)

func PicShow

func PicShow(src gocv.Mat, points, boxs [][]float32)

func ToTensor

func ToTensor(values []float32) *tf.Tensor

Types

type ImageItem

type ImageItem struct {
	Url     string
	Female  bool
	Done    bool
	Content []byte
}

type RedisInfo

type RedisInfo struct {
	Name   string
	Conf   string
	Prefix []string
	Expire int
	Pool   *redis.Pool
}

func GetRedisInfo

func GetRedisInfo(cfg *goconfig.ConfigFile, section string) (*RedisInfo, error)

type ReqImage

type ReqImage struct {
	Uuid      string   `json:"uuid"`
	Image     []string `json:"image"`
	ImageInfo map[string]*ImageItem
	Cache     cache.ICache
}

type SRT_Item

type SRT_Item struct {
	Uuid    string `json:"uuid"`
	Biztype string `json:"biztype"`
	Title   string `json:"title"`
	Content string `json:"content"`
}

type SRT_Request

type SRT_Request struct {
	Input map[string][]float32  `json:"input"`
	Items []*SRT_Item           `json:"items"`
	Image map[string]*ImageItem `json:"image"`
}

func LoadMock

func LoadMock(filename string) (*SRT_Request, error)

type SRT_Response

type SRT_Response struct {
	ReturnCode int         `json:"returncode"`
	Message    string      `json:"message"`
	Result     interface{} `json:"result"`
}

Jump to

Keyboard shortcuts

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