Exemplo n.º 1
0
Arquivo: main.go Projeto: jvlmdr/go-cv
func testPos(tmpl *detect.FeatTmpl, dir string, pyrStep float64, hogBin int, opts featpyr.DetectOpts, valMinInter float64) (*detect.ResultSet, error) {
	// Load list of annotations.
	anns, err := loadLines(path.Join(dir, "Test", "annotations.lst"))
	if err != nil {
		return nil, err
	}

	// Test each image and combine.
	var results *detect.ResultSet
	for i := range anns {
		imfile, refs, err := loadAnnotation(path.Join(dir, anns[i]))
		if err != nil {
			return nil, err
		}
		im, err := loadImage(path.Join(dir, imfile))
		if err != nil {
			return nil, err
		}
		// Get detections.
		dets := evalImage(tmpl, im, pyrStep, hogBin, opts)
		x := detect.ValidateMatch(dets, refs, valMinInter)
		results = results.Merge(x)
	}
	return results, nil
}
Exemplo n.º 2
0
Arquivo: test.go Projeto: jvlmdr/go-cv
// Runs detector across a single image and validates results.
func testImage(tmpl *detect.FeatTmpl, annot inria.Annot, dir string, opts DetectOpts, mininter float64) (*detect.ResultSet, error) {
	im, err := loadImage(path.Join(dir, annot.Image))
	if err != nil {
		return nil, err
	}
	// Get detections.
	dets := detectImage(tmpl, im, opts.Margin, opts.PyrStep, opts.HOGBin, opts.LocalMax, opts.MaxIOU)
	val := detect.ValidateMatch(dets, annot.Rects, mininter)
	return val, nil
}