Jenthe commited on
Commit
f59e715
1 Parent(s): e9ec09f

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +12 -4
README.md CHANGED
@@ -38,18 +38,26 @@ from huggingface_hub import hf_hub_download
38
 
39
  # automatically checks for cached file
40
  model_file = hf_hub_download(repo_id='Jenthe/ECAPA2', filename='model.pt')
41
- model = torch.jit.load(model_file, map_location='cpu')
42
 
43
  # input audio should have a sample rate of 16 kHz
44
  audio, sr = torchaudio.load('sample.wav')
45
- embedding = model(audio)
46
  ```
47
 
48
  ### Hierarchical Feature Extraction
49
 
50
- For the extraction of other hierachical features, a separate model function is provided:
 
51
  ```
52
- feature = ecapa2_model.extract_feature(label='gfe1', type='mean')
 
 
 
 
 
 
 
53
  ```
54
 
55
  The following table describes the available features:
 
38
 
39
  # automatically checks for cached file
40
  model_file = hf_hub_download(repo_id='Jenthe/ECAPA2', filename='model.pt')
41
+ ecapa2_model = torch.jit.load(model_file, map_location='cpu')
42
 
43
  # input audio should have a sample rate of 16 kHz
44
  audio, sr = torchaudio.load('sample.wav')
45
+ embedding = ecapa2_model(audio)
46
  ```
47
 
48
  ### Hierarchical Feature Extraction
49
 
50
+ For the extraction of other hierachical features, the 'label' argument can be used, which accepts a string containing the feature ids separated with '|':
51
+
52
  ```
53
+ # only extracts embedding, same as previous example
54
+ feature = ecapa2_model(audio, label='embedding')
55
+
56
+ # concatenates the gfe_1, pool and embedding features
57
+ feature = ecapa2_model(audio, label='gfe_1|pool|embedding')
58
+
59
+ # returns the same output as previous example, concatenation always follows the order of the network
60
+ feature = ecapa2_model(audio, label='embedding|gfe_1|pool')
61
  ```
62
 
63
  The following table describes the available features: