Changeset af445db for python/bench-onset
- Timestamp:
- Dec 22, 2005, 5:39:02 PM (19 years ago)
- Branches:
- feature/autosink, feature/cnn, feature/cnn_org, feature/constantq, feature/crepe, feature/crepe_org, feature/pitchshift, feature/pydocstrings, feature/timestretch, fix/ffmpeg5, master, pitchshift, sampler, timestretch, yinfft+
- Children:
- 1dae4eb
- Parents:
- 27f2c08
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
python/bench-onset
r27f2c08 raf445db 98 98 lesst /= 2. 99 99 100 def auto_learn2(self,modes=['dual'],thresholds=[0.1,1.0]): 101 """ simple dichotomia like algorithm to optimise threshold """ 102 self.modes = modes 103 self.pretty_print(self.titles) 104 for mode in self.modes: 105 steps = 10 106 step = thresholds[1] 107 curt = thresholds[0] 108 self.params.onsetmode = mode 109 110 self.params.threshold = curt 111 self.dir_exec() 112 self.dir_eval() 113 self.pretty_print(self.values) 114 curexp = self.expc 115 116 for i in range(steps): 117 if curexp < self.orig: 118 #print "we found at most less onsets than annotated" 119 self.params.threshold -= step 120 step /= 2 121 elif curexp > self.orig: 122 #print "we found more onsets than annotated" 123 self.params.threshold += step 124 step /= 2 125 self.dir_exec() 126 self.dir_eval() 127 curexp = self.expc 128 self.pretty_print(self.values) 129 if self.orig == 100.0 or self.orig == self.expc: 130 print "assuming we converged, stopping" 131 break 100 132 101 133 if __name__ == "__main__": … … 123 155 124 156 try: 125 benchonset.auto_learn (modes=modes)157 benchonset.auto_learn2(modes=modes) 126 158 #benchonset.run_bench(modes=modes) 127 159 except KeyboardInterrupt:
Note: See TracChangeset
for help on using the changeset viewer.