filter: benchmark: upadte headers, add consts, print to log

This commit is contained in:
Ella Pietraroia 2020-02-07 10:40:14 +10:30
parent b0dbc25fd2
commit daa45014b6
2 changed files with 60 additions and 0 deletions

View File

@ -33,6 +33,7 @@ LICENSE
package filter
import (
<<<<<<< HEAD
"testing"
)
@ -62,6 +63,43 @@ func BenchmarkBasic(b *testing.B) {
=======
fmt.Print("\nFrames: ", len(testPackets), "\t")
>>>>>>> 749cfa17... filter: benchmarks: tidying up code
=======
"io"
"os"
"testing"
)
const (
outBasic = "testout/test_outBasic.mjpeg"
outDiff = "testout/test_outDiff.mjpeg"
outKNN = "testout/test_outKNN.mjpeg"
outMOG = "testout/test_outMOG.mjpeg"
)
const (
debug = false
motionDownscaling = 1
motionInterval = 1
BasicThreshold = 45000
BasicPixels = 1000
DiffThreshold = 3
KNNMinArea = 25.0
KNNThreshold = 300
KNNHistory = 300
KNNKernel = 9
MOGMinArea = 25.0
MOGThreshold = 20.0
MOGHistory = 500
)
func BenchmarkBasic(b *testing.B) {
file, _ := os.Create(outBasic)
f := NewBasic(io.WriteCloser(file), debug, BasicThreshold, BasicPixels)
b.Log("\nFrames: ", len(testPackets))
>>>>>>> 60437c8c... filter: benchmark: upadte headers, add consts, print to log
for n := 0; n < b.N; n++ {
for _, x := range testPackets {
_, err := f.Write(x)
@ -73,6 +111,7 @@ func BenchmarkBasic(b *testing.B) {
}
func BenchmarkDifference(b *testing.B) {
<<<<<<< HEAD
<<<<<<< HEAD
const DiffThreshold = 3.0
buffer := &d{}
@ -89,6 +128,11 @@ func BenchmarkDifference(b *testing.B) {
w := io.WriteCloser(file)
f := NewDifference(w, false, 3)
fmt.Print("\nFrames: ", len(testPackets), "\t")
=======
file, _ := os.Create(outDiff)
f := NewDifference(io.WriteCloser(file), debug, DiffThreshold)
b.Log("\nFrames: ", len(testPackets))
>>>>>>> 60437c8c... filter: benchmark: upadte headers, add consts, print to log
for n := 0; n < b.N; n++ {
for _, x := range testPackets {
f.Write(x)
@ -98,6 +142,7 @@ func BenchmarkDifference(b *testing.B) {
}
func BenchmarkKNN(b *testing.B) {
<<<<<<< HEAD
<<<<<<< HEAD
const motionDownscaling = 1
const motionInterval = 1
@ -118,6 +163,11 @@ func BenchmarkKNN(b *testing.B) {
=======
fmt.Print("\nFrames: ", len(testPackets), "\t")
>>>>>>> 749cfa17... filter: benchmarks: tidying up code
=======
file, _ := os.Create(outKNN)
f := NewKNN(io.WriteCloser(file), KNNMinArea, KNNThreshold, KNNHistory, KNNKernel, debug, motionInterval, motionDownscaling)
b.Log("\nFrames: ", len(testPackets))
>>>>>>> 60437c8c... filter: benchmark: upadte headers, add consts, print to log
for n := 0; n < b.N; n++ {
for _, x := range testPackets {
_, err := f.Write(x)
@ -129,6 +179,7 @@ func BenchmarkKNN(b *testing.B) {
}
func BenchmarkMOG(b *testing.B) {
<<<<<<< HEAD
<<<<<<< HEAD
const motionDownscaling = 1
const motionInterval = 1
@ -148,6 +199,11 @@ func BenchmarkMOG(b *testing.B) {
=======
fmt.Print("\nFrames: ", len(testPackets), "\t")
>>>>>>> 749cfa17... filter: benchmarks: tidying up code
=======
file, _ := os.Create(outMOG)
f := NewMOG(io.WriteCloser(file), MOGMinArea, MOGThreshold, MOGHistory, debug, motionInterval, motionDownscaling)
b.Log("\nFrames: ", len(testPackets))
>>>>>>> 60437c8c... filter: benchmark: upadte headers, add consts, print to log
for n := 0; n < b.N; n++ {
for _, x := range testPackets {
_, err := f.Write(x)

View File

@ -14,11 +14,15 @@ AUTHOR
Ella Pietraroia <ella@ausocean.org>
LICENSE
<<<<<<< HEAD
<<<<<<< HEAD
Copyright (C) 2020 the Australian Ocean Lab (AusOcean)
=======
Copyright (C) 2019 the Australian Ocean Lab (AusOcean)
>>>>>>> 03d46b19... filter: benchmark: chaning descriptions
=======
Copyright (C) 2020 the Australian Ocean Lab (AusOcean)
>>>>>>> 60437c8c... filter: benchmark: upadte headers, add consts, print to log
It is free software: you can redistribute it and/or modify them
under the terms of the GNU General Public License as published by the