DTaoo / VGGish

An implementation of vggish in keras with tf backend
117 stars 38 forks source link

evaluation.py VGGish is not being fitted #8

Open rola93 opened 5 years ago

rola93 commented 5 years ago

Hello

I've been reading your evaluation.py example, and I can't understand why weights aren't loaded when the VGGish model is made, nor it's fit after the model is made.

As I see it, those lines:

sound_model = VGGish(include_top=False, load_weights=False)

should be:

sound_model = VGGish(include_top=False, load_weights=True)

or after that, it should be fitted before used (which currently isn't).

With the current implementation (i.e. load_weights=False), I run it on a subset of Speech Commands dataset, and I get the following results:

Report for testing
              precision    recall  f1-score   support

          no       0.90      0.90      0.90       386
         yes       0.90      0.90      0.90       397

    accuracy                           0.90       783
   macro avg       0.90      0.90      0.90       783
weighted avg       0.90      0.90      0.90       783

however, only switching load_weights=True, I get those:

Report for testing
              precision    recall  f1-score   support

          no       0.92      0.98      0.95       386
         yes       0.98      0.92      0.95       397

    accuracy                           0.95       783
   macro avg       0.95      0.95      0.95       783
weighted avg       0.95      0.95      0.95       783

As I see it, if the networks are not initialized with given weights, nor fitted, then its weights are just random initializations and therefore, the features computed by the model are just random computations on the input and therefore they don add too much value to the model itself.

I would love to hear your thoughts on this