fork download
  1. from audio import read_mfcc
  2. from batcher import sample_from_mfcc
  3. from constants import SAMPLE_RATE, NUM_FRAMES
  4. from conv_models import DeepSpeakerModel
  5. from test import batch_cosine_similarity
  6. from config import get_config
  7. np.random.seed(7381)
  8. random.seed(7381)
  9. model = DeepSpeakerModel()
  10. model.m.load_weights('models/ResCNN_triplet_training_checkpoint_265.h5', by_name=True)
  11. logger = logging.getLogger(__name__)
  12.  
  13. def user_authentic(path,user_id):
  14.  
  15. mfcc_001 = sample_from_mfcc(read_mfcc(path, SAMPLE_RATE), NUM_FRAMES)
  16. embedding=model.m.predict(np.expand_dims(mfcc_001, axis=0))
  17. true_embed = np.load('models/'+user_id+'.npy')
  18.  
  19. dist=batch_cosine_similarity(true_embed,embedding)
  20.  
  21. if(dist[0]>0.50):
  22. print("same user")
  23. else:
  24. print("different user")
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
Traceback (most recent call last):
  File "/usr/lib/python3.7/py_compile.py", line 143, in compile
    _optimize=optimize)
  File "<frozen importlib._bootstrap_external>", line 791, in source_to_code
  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
  File "./prog.py", line 16
    embedding=model.m.predict(np.expand_dims(mfcc_001, axis=0))
                                                              ^
IndentationError: unindent does not match any outer indentation level

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/usr/lib/python3.7/py_compile.py", line 147, in compile
    raise py_exc
py_compile.PyCompileError: Sorry: IndentationError: unindent does not match any outer indentation level (prog.py, line 16)
stdout
Standard output is empty