toni-heittola / dcase2019_task1_baseline

DCASE2019 Challenge Task 1 baseline system
MIT License
20 stars 11 forks source link

Task fails during Testing phase #2

Closed dangpzanco closed 5 years ago

dangpzanco commented 5 years ago

Description

Error when running python task1*.py. I tested Tasks A and C. This is probably a problem with some API change on newer versions of Keras.

Forcing

if len(keras_model.input_shape) == 4:
    input_data = numpy.expand_dims(input_data, 3)

fixed the problem, but hurts the code generalization.

Expected Results

Expected Task test the trained system. Feature extraction, normalization and learning run just fine.

Actual Results

root@1e8de6cd35a5:~/dcase2019_task1_baseline# python task1a.py 
[I] DCASE2019 / Task1A -- Acoustic scene classification
[I] 
[I] General information
[I] ========================================
[I]   Parameter set
[I]     Set ID                          : dcase2019_baseline 
[I]     Set description                 : DCASE2019 baseline / Development setup 
[I]   Application
[I]     Overwrite                       : False 
[I]     Dataset                         : TAU-urban-acoustic-scenes-2019-development 
[I]     Active folds                    : [1] 
[I] 
[I]   DONE       
[I] 
[I] Feature Extraction
[I] ========================================
[I]   DONE       [0:00:02.002628] 
[I] 
[I] Feature Normalization
[I] ========================================
[I]   Fold [1]
[I]   DONE       [0:00:00.000101] 
[I] 
[I] Learning
[I] ========================================
[I]   Fold [1]
[I]   DONE       [0:00:00.000096] 
[I] 
[I] Testing
[I] ========================================
[I]   Fold [1]
[I]   === Keras setup ===
[I]     BLAS library                    : MKL (Threads[8], MKL_CBWR[COMPATIBLE]) 
[I]     Backend                         : tensorflow 
[I]     Tensorflow
2019-03-12 16:19:17.177174: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1511] Adding visible gpu devices: 0
2019-03-12 16:19:17.177210: I tensorflow/core/common_runtime/gpu/gpu_device.cc:982] Device interconnect StreamExecutor with strength 1 edge matrix:
2019-03-12 16:19:17.177223: I tensorflow/core/common_runtime/gpu/gpu_device.cc:988]      0 
2019-03-12 16:19:17.177233: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1001] 0:   N 
2019-03-12 16:19:17.177423: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1115] Created TensorFlow device (/device:GPU:0 with 11376 MB memory) -> physical GPU (device: 0, name: TITAN X (Pascal), pci bus id: 0000:09:00.0, compute capability: 6.1)
[I]       Device                        : cuda0 
[I]   DONE       
[I] 
[E] Uncaught exception  (logging.py:221)
Traceback (most recent call last):
  File "task1a.py", line 1226, in <module>
    sys.exit(main(sys.argv))
  File "task1a.py", line 234, in main
    overwrite=overwrite
  File "task1a.py", line 974, in do_testing
    if keras_model.get_config()[0]['config']['data_format'] == 'channels_first':
KeyError: 0

Versions

Linux-4.15.0-39-generic-x86_64-with-debian-buster-sid
Python 3.6.8 |Anaconda, Inc.| (default, Dec 30 2018, 01:22:34) 
[GCC 7.3.0]
NumPy 1.16.2
SciPy 1.2.1
Matplotlib 3.0.2
librosa 0.6.2
keras 2.2.4
tensorflow 1.12.0
dcase_util 0.2.7
sed_eval 0.2.1
toni-heittola commented 5 years ago

Originally the system was develop with keras 2.2.2, and keras 2.2.3 had breaking change Sequential.get_config() method (output format was changed from list to dict). Commit 4ba03c7eb9e5959a4b7ddf1719a19eeda701c8a6 should fix this generic way, and make the system work across a few latest versions of keras (2.2.2-2.2.4).