tensorflow / models

Models and examples built with TensorFlow
Other
77.15k stars 45.77k forks source link

YAMNet tflite export picking wrong output #10246

Closed dpwe closed 3 years ago

dpwe commented 3 years ago

Prerequisites

1. The entire URL of the file you are using

https://github.com/tensorflow/models/tree/master/research/audioset/yamnet/export.py

2. Describe the bug

Running the export.py example code on MacOS 11.5.2, it fails when attempting to verify the tflite export. Seemingly, instead of pulling the scores output from from the model, it is instead retrieving the embeddings output (1024 dimensions instead of 521).

3. Steps to reproduce

$ python3 export.py yamnet.h5 export
=====
Tue Sep  7 08:34:12 2021 | Building and checking TF2 Module ...
=====
[...]
=====
Tue Sep  7 08:35:00 2021 | Checking TF-Lite model ...
=====

Traceback (most recent call last):
  File "/Users/dpwe/google/models/research/audioset/yamnet/export.py", line 213, in <module>
    main(sys.argv[1:])
  File "/Users/dpwe/google/models/research/audioset/yamnet/export.py", line 207, in main
    tflite_saved_model_dir = make_tflite_export(weights_path, tflite_export_dir)
  File "/Users/dpwe/google/models/research/audioset/yamnet/export.py", line 179, in make_tflite_export
    check_model(run_model, 'yamnet_class_map.csv', params)
  File "/Users/dpwe/google/models/research/audioset/yamnet/export.py", line 78, in check_model
    clip_test(
  File "/Users/dpwe/google/models/research/audioset/yamnet/export.py", line 72, in clip_test
    top_n_class_names = yamnet_classes[top_n_indices]
IndexError: index 719 is out of bounds for axis 0 with size 521

4. Expected behavior

check_model should succeed and execution should continue through completion.

5. Additional context

none

6. System information

google-ml-butler[bot] commented 3 years ago

Are you satisfied with the resolution of your issue? Yes No

dpwe commented 3 years ago

Closed by #10248