gofaces: github.com/owulveryck/gofaces Index | Files | Directories

package gofaces

import "github.com/owulveryck/gofaces"

Package gofaces is a set of functions to handle the input and output of a Tint YOLO v2 model.


Package Files

app.go config.go doc.go geometry.go image.go io.go math.go sort.go structure.go


const (
    // HSize is the height of the input picture
    HSize = 416
    // WSize is the width of the input picture
    WSize = 416

func GetTensorFromImage Uses

func GetTensorFromImage(r io.Reader) (tensor.Tensor, error)

GetTensorFromImage reads an image from r and returns a tensor suitable to run in tiny yolo. The tensor is BWHC and is normalized; its shape is (1,wSize,hSize,3)

type Box Uses

type Box struct {
    R   image.Rectangle

    Confidence float64 // The confidence the model has that there is at least one element in this box
    Elements   []Element
    // contains filtered or unexported fields

Box is holding a bounding box A bunding box is a rectangle R containing an object with Confidence. The object is one of the Elements (most likely the one with the highest probability)

func ProcessOutput Uses

func ProcessOutput(dense *tensor.Dense) ([]Box, error)

ProcessOutput analyze the tensor dense and output the bouding boxes filled with the predictions

func Sanitize Uses

func Sanitize(boxes []Box) []Box

Sanitize the output from https://medium.com/@jonathan_hui/real-time-object-detection-with-yolo-yolov2-28b1b93e2088

- Sort the predictions by the confidence scores.

- Start from the top scores, ignore any current prediction if we find any previous predictions that have the same class and IoU > 0.5 with the current prediction.

- Repeat step 2 until all predictions are checked.

func (Box) String Uses

func (b Box) String() string

type Element Uses

type Element struct {
    Prob  float64
    Class string

Element in a box



Package gofaces imports 13 packages (graph) and is imported by 2 packages. Updated 2019-08-26. Refresh now. Tools for package owners.