8da4857396fcedb1abd19a08cd4de40d16c7bc50,research/audioset/yamnet/yamnet_test.py,YAMNetTest,clip_test,#YAMNetTest#,39
Before Change
def clip_test(self, waveform, expected_class_name, top_n=10):
Run the model on the waveform, check that expected class is in top-n.
with YAMNetTest._yamnet_graph.as_default():
prediction = np.mean(YAMNetTest._yamnet.predict(
np.reshape(waveform, [1, -1]), steps=1)[0], axis=0)
top_n_class_names = YAMNetTest._yamnet_classes[
np.argsort(prediction)[-top_n:]]
self.assertIn(expected_class_name, top_n_class_names)
After Change
top_n_scores = clip_predictions[top_n_indices]
top_n_class_names = YAMNetTest._yamnet_classes[top_n_indices]
top_n_predictions = list(zip(top_n_class_names, top_n_scores))
self.assertIn(expected_class_name, top_n_class_names,
"Did not find expected class {} in top {} predictions: {}".format(
expected_class_name, top_n, top_n_predictions))
def testZeros(self):
self.clip_test(
waveform=np.zeros((int(3 * YAMNetTest._params.sample_rate),)),
In pattern: SUPERPATTERN
Frequency: 3
Non-data size: 3
Instances Project Name: tensorflow/models
Commit Name: 8da4857396fcedb1abd19a08cd4de40d16c7bc50
Time: 2020-08-17
Author: 30733558+plakal@users.noreply.github.com
File Name: research/audioset/yamnet/yamnet_test.py
Class Name: YAMNetTest
Method Name: clip_test
Project Name: GPflow/GPflow
Commit Name: deb4508578f7223fa1ad5e3b6458626c4b41ef09
Time: 2019-10-17
Author: 6815729+condnsdmatters@users.noreply.github.com
File Name: tests/test_methods.py
Class Name:
Method Name: test_sgpr_qu
Project Name: oddt/oddt
Commit Name: d2e27ac0d17c3550ab03162daa01fb6cfdf54294
Time: 2017-10-10
Author: maciek@wojcikowski.pl
File Name: tests/test_fingerprints.py
Class Name:
Method Name: test_sparse_densify