Beispiel #1
0
print "===       Evaluation on VALIDATION DATA         ===\n"

# Load model
model = load_model('model/lower_end2end.hdf5')

print ">>> RAW:"
pred = model.predict(np.expand_dims(X_valid, axis=2), batch_size=32)
print accuracy_score(y_valid, np.argmax(pred, axis=1))
print confusion_matrix(y_valid, np.argmax(pred, axis=1)), '\n'

alpha = np.arange(0.5, 3.5, 0.5)
sigma = np.arange(3, 8, 1)

for s in sigma:
    for a in alpha:
        x_valid_sharpen = sd.sharpen(X_valid, s, a)
        pred_sharpened = model.predict(np.expand_dims(x_valid_sharpen, axis=2), batch_size=32)
        print ">>> SHARPENED: sigma={}, alpha={:.2f}".format(s, a)
        print accuracy_score(y_valid, np.argmax(pred_sharpened, axis=1))
        print confusion_matrix(y_valid, np.argmax(pred_sharpened, axis=1))


'''
/usr/bin/python2.7 /home/hcilab/Documents/OSS/sensors2018cnnhar/opp/sharpen_end2end_lower_valid.py
/home/hcilab/.local/lib/python2.7/site-packages/h5py/__init__.py:36: FutureWarning: Conversion of the second argument of issubdtype from `float` to `np.floating` is deprecated. In future, it will be treated as `np.float64 == np.dtype(float).type`.
  from ._conv import register_converters as _register_converters
Using TensorFlow backend.

=== COMPARE ACCURACY: NO SHARPEN vs. SHARPENED  ===
===   [LOWER body sensors data] End2End Class   ===
===                1D CNN  MODEL                ===
Beispiel #2
0
print "===          Evaluation on TEST DATA            ===\n"

# Load model
model = load_model('model/lower_up.hdf5')

print ">>> RAW:"
pred = model.predict(np.expand_dims(X_test, axis=2), batch_size=32)
print accuracy_score(y_test, np.argmax(pred, axis=1))
print confusion_matrix(y_test, np.argmax(pred, axis=1)), '\n'

alpha = np.arange(0.5, 15.5, 0.5)
sigma = np.arange(3, 8, 1)

for s in sigma:
    for a in alpha:
        x_test_sharpen = sd.sharpen(X_test, s, a)
        pred_sharpened = model.predict(np.expand_dims(x_test_sharpen, axis=2),
                                       batch_size=32)
        print ">>> SHARPENED: sigma={}, alpha={:.2f}".format(s, a)
        print accuracy_score(y_test, np.argmax(pred_sharpened, axis=1))
        print confusion_matrix(y_test, np.argmax(pred_sharpened, axis=1))
'''
/usr/bin/python2.7 /home/hcilab/Documents/OSS/sensors2018cnnhar/opp/sharpen_up_lower_test.py
/home/hcilab/.local/lib/python2.7/site-packages/h5py/__init__.py:36: FutureWarning: Conversion of the second argument of issubdtype from `float` to `np.floating` is deprecated. In future, it will be treated as `np.float64 == np.dtype(float).type`.
  from ._conv import register_converters as _register_converters
Using TensorFlow backend.

=== COMPARE ACCURACY: NO SHARPEN vs. SHARPENED  ===
===     [LOWER body sensors data] UP Class      ===
===                1D CNN  MODEL                ===
===          Evaluation on TEST DATA            ===