From daa45014b6b09425cb98d5ab2ea1d57ab0fa5f0e Mon Sep 17 00:00:00 2001 From: Ella Pietraroia Date: Fri, 7 Feb 2020 10:40:14 +1030 Subject: [PATCH] filter: benchmark: upadte headers, add consts, print to log --- filter/filter_test.go | 56 +++++++++++++++++++++++++++++++++++++++++++ filter/tests.go | 4 ++++ 2 files changed, 60 insertions(+) diff --git a/filter/filter_test.go b/filter/filter_test.go index ff7bde4b..39502a51 100644 --- a/filter/filter_test.go +++ b/filter/filter_test.go @@ -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) diff --git a/filter/tests.go b/filter/tests.go index 51697e9c..0cc3bc39 100644 --- a/filter/tests.go +++ b/filter/tests.go @@ -14,11 +14,15 @@ AUTHOR Ella Pietraroia 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