溫馨提示×

溫馨提示×

您好,登錄后才能下訂單哦!

密碼登錄×
登錄注冊×
其他方式登錄
點擊 登錄注冊 即表示同意《億速云用戶服務條款》

EER有什么用

發布時間:2021-12-08 14:11:20 來源:億速云 閱讀:240 作者:iii 欄目:大數據

這篇文章主要介紹“EER有什么用”,在日常操作中,相信很多人在EER有什么用問題上存在疑惑,小編查閱了各式資料,整理出簡單好用的操作方法,希望對大家解答”EER有什么用”的疑惑有所幫助!接下來,請跟著小編一起來學習吧!

   FRR(False Rejection Rate)和FAR(False Acceptance Rate)是用來評估指紋識別算法性能的兩個主要參數。

   FRR通俗叫法是拒真率的意思,標準稱謂是 FNMR(False Non-Match Rate 不匹配率)??梢酝ㄋ椎睦斫鉃椤鞍褢撓嗷テヅ涑晒Φ闹讣y當成不能匹配的指紋”的概率。

     Equal Error Rate , 這個在說話人識別,說話人確認中最常用的評價標準,是一種使錯誤接受率(nontarget_is_target / (target_is_target + nontarget_is_target)) 和 錯誤拒絕

率(target_is_nontarget / (target_is_nontarget + nontarget_is_nontarget))的一個相對平衡點閾值點,然后這個閾值點可以作為實際使用階段的固定的閾值。

   如 得分非 -170----A-------threshold ------B------- +100    按理來說 A 中都是nontarget, B中都是target。 如果在A 中出現了target 就是錯誤拒絕了,如果在B 中出現了

nontarget  就是錯誤接收了

   FAR一般稱為認假率,其標準稱謂是FMR(False Match Rate 錯誤匹配率)。FMR是用來評估指紋識別算法性能的最重要參數??梢酝ㄋ椎睦斫鉃椤鞍巡粦撈ヅ涞闹讣y當成匹配

的指紋”的概率。

   FAR是隨閾值增大而減小的,FRR是隨閾值增大而增大的。因此它們一定有交點。這個點是在某個閾值下的FAR與FRR等值的點。習慣上用這一點的值來衡量算法的綜合性能。

對于一個更優的指紋算法,希望在相同閾值情況下,FAR和FRR都越小越好。

   把FAR和FRR曲線都向下平移。同時相交點ERR也向下平移。所以EER值越小的時候,表示算法的整體性能越高。   

Equal Error Rate , 這個在說話人識別,說話人確認中最常用的評價標準,是一種使錯誤接受率(nontarget_is_target / (target_is_target + nontarget_is_target)) 和 錯誤拒絕率(target_is_nontarget / (target_is_nontarget + nontarget_is_nontarget))的一個相對平衡點閾值點,然后這個閾值點可以作為實際使用階段的固定的閾值。 
還記得trials文件嘛,還記得沒有cvs文件自己偽造trials文件嘛, 還記得不明白為什么要制造50%或者80%的nontarget嘛,就是為了要計算EER。所以在偽造trials文件的時候,最好是分布均勻,也就是要涉及到每一個人,每一個人都要有一定數量的nontarget,其實也可以每個人對其他所有人都做一個nontarget,到底是取一部分還是所有的這個我也不確定,等驗證過后再更新(記得驗證)。

-->先說一些EER的計算: 
false reject and false accept. Clearly, the false reject rate and the false accept rate depend on the threshold. When the two rates are equal, the common value is called equal error rate (EER).

什么是false reject(用fr表示), 就是本來應該accept 的結果 reject了: 
FR = target_is_nontarget / (target_is_nontarget + nontarget_is_nontarget) 
而false accept(用fa表示),就是本來應該reject的結果accept了: 
FA = nontarget_is_target / (target_is_target + nontarget_is_target) 
當E(fr) = E(fa) = E 時, E即 EER的值。 
-->維基百科ROC曲線 https://zh.wikipedia.org/wiki/ROC曲線 
--> 然后看一下kaldi源碼: 
eer=compute-eer <(python local/prepare_for_eer.py $trials local/scores_gmm_${num_components}_${x}_${y}/plda_scores) 2> /dev/null
單獨運行: 
python local/prepare_for_eer.py data/test/trials exp/scores_gmm_2048_ind_female/plda_scores 
結果:

-30.99115 target
-28.06169 target
-17.78868 target
-87.6428 nontarget
-74.32495 nontarget
-74.18333 nontarget
-5.662024 target
-7.832421 target
-26.46083 target
-74.93365 nontarget
-86.17784 nontarget
-50.90917 nontarget
-26.51904 target
-14.09044 target
...
#Ki就是上面的lines流, 把沒用的代碼全都刪掉,可以去看kaldi的源碼
 while (std::getline(ki.Stream(), line)) {
      std::vector<std::string> split_line;
      SplitStringToVector(line, " \t", true, &split_line);
      BaseFloat score;
      if (split_line[1] == "target")
        target_scores.push_back(score);
      else if (split_line[1] == "nontarget")
        nontarget_scores.push_back(score);
      else 
        KALDI_ERR << "blablabla"
    }
    BaseFloat threshold;
    #定義一個threshold,兩個list: target_scores, nontarget_scores
    BaseFloat eer = ComputeEer(&target_scores, &nontarget_scores, &threshold);
    KALDI_LOG << "Equal error rate is " << (100.0 * eer)
              << "%, at threshold " << threshold;
    std::cout.precision(4);
    std::cout << (100.0 * eer);
    return 0;

下面看ComputeEer(&target_scores, &nontarget_scores, &threshold)的實現

 {
  #將兩個都從大到小排列
  std::sort(target_scores->begin(), target_scores->end());
  std::sort(nontarget_scores->begin(), nontarget_scores->end());

  size_t target_position = 0,
      target_size = target_scores->size();
  for (; target_position + 1 < target_size; target_position++) {
        size_t nontarget_size = nontarget_scores->size(), #計算nontarget的個數
        #比如nontarget_size=100 ,target_size=100 這個 nontarget_n 屬于[0,100], 
        #所以nontarget_positon 從99到-1
        nontarget_n = nontarget_size * target_position * 1.0 / target_size; 
        nontarget_position = nontarget_size - 1 - nontarget_n;
    if (nontarget_position  < 0)
      nontarget_position = 0;
    #所以當nontarget_position 小于 target_position 的值的時候
    if ((*nontarget_scores)[nontarget_position] <
        (*target_scores)[target_position])
      break;
  }
  *threshold = (*target_scores)[target_position];
  BaseFloat eer = target_position * 1.0 / target_size;
  return eer;
}
要理解這個函數的實現,其實在compute-eer里邊還是一行注釋:
ComputeEer computes the Equal Error Rate (EER) for the given scores
   and returns it as a proportion beween 0 and 1.
   If we set the threshold at x, then the target error-rate is the
   proportion of target_scores below x; and the non-target error-rate
   is the proportion of non-target scores above x.  We seek a
   threshold x for which these error rates are the same; this
   error rate is the EER.

   We compute this by iterating over the positions in target_scores: 0, 1, 2,
   and so on, and for each position consider whether the cutoff could be here.
   For each of these position we compute the corresponding position in
   nontarget_scores where the cutoff would be if the EER were the same.
   For instance, if the vectors had the same length, this would be position
   length() - 1, length() - 2, and so on.  As soon as the value at that
   position in nontarget_scores at that position is less than the value from
   target_scores, we have our EER.
下面拿一個例子用python簡單模擬一下:
#coding: utf-8
'''
首先計算這一步,將target的得分和nontarget的得分文件
python local/prepare_for_eer.py data/test/trials exp/scores_gmm_2048_ind_female/plda_scores > scores
'''
target_scores = []
nontarget_scores = []
f = open('scores').readlines()
#將兩個數組讀出來
for line in f:
    splits = line.strip().split(' ')
    if splits[1] == 'target':
        target_scores.append(eval(splits[0]))
    else:
        nontarget_scores.append(eval(splits[0]))

#排序,從小到大排序
target_scores = sorted(target_scores)
nontarget_scores = sorted(nontarget_scores)

print target_scores

target_size = len(target_scores)
target_position = 0
for target_position in range(target_size):
    nontarget_size = len(nontarget_scores)
    nontarget_n = nontarget_size * target_position * 1.0 / target_size
    nontarget_position = int(nontarget_size - 1 - nontarget_n)
    if nontarget_position < 0:
        nontarget_position = 0
    if nontarget_scores[nontarget_position] < target_scores[target_position]:
        print "nontarget_scores[nontarget_position] is",  nontarget_position, nontarget_scores[nontarget_position]
        print "target_scores[target_position] is",  target_position, target_scores[target_position]
        break

threshold = target_scores[target_position]
print "threshold is --> ",  threshold
eer = target_position * 1.0 / target_size
print "eer is --> ",  eer

到此,關于“EER有什么用”的學習就結束了,希望能夠解決大家的疑惑。理論與實踐的搭配能更好的幫助大家學習,快去試試吧!若想繼續學習更多相關知識,請繼續關注億速云網站,小編會繼續努力為大家帶來更多實用的文章!

向AI問一下細節

免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。

AI

亚洲午夜精品一区二区_中文无码日韩欧免_久久香蕉精品视频_欧美主播一区二区三区美女