一、tensorflow提供的evaluation
Inference and evaluation on the Open Images dataset:https://github.com/tensorflow/models/blob/master/research/object_detection/g3doc/oid_inference_and_evaluation.md
該鏈接中詳細介紹了如何針對Open Images dataset數據集進行inference和evaluation,按照此教程,在models/research目錄下新建oid文件夾,並將數據集以及驗證集下載並放在此文件夾下。后續可能不會用到,待刪除。
tensorflow提供的官方detection demo可參考:https://github.com/tensorflow/models/blob/master/research/object_detection/object_detection_tutorial.ipynb
但是后來發現在~/rdshare/detection/detection/py的腳本中,檢測結果中有類別,目標框的位置等,可據此計算map,recall等,所以沒有繼續根據上邊的鏈接繼續做。
二、自主計算
在~/rdshare/detection/detection/py腳本中,通過 boxes = detection_graph.get_tensor_by_name('detection_boxes:0') 可獲得目標框的坐標。print之后結果如下
結果中應該是兩個物體的坐標。
然后參考https://blog.csdn.net/qq_17550379/article/details/79875784 中的代碼,可以計算map

def voc_ap(rec, prec, use_07_metric=False): if use_07_metric: # 11 point metric ap = 0. for t in np.arange(0., 1.1, 0.1): if np.sum(rec >= t) == 0: p = 0 else: p = np.max(prec[rec >= t]) ap = ap + p / 11. else: mrec = np.concatenate(([0.], rec, [1.])) mpre = np.concatenate(([0.], prec, [0.])) for i in range(mpre.size - 1, 0, -1): mpre[i - 1] = np.maximum(mpre[i - 1], mpre[i]) i = np.where(mrec[1:] != mrec[:-1])[0] ap = np.sum((mrec[i + 1] - mrec[i]) * mpre[i + 1]) return ap
另外可參考的鏈接
https://blog.csdn.net/ziliwangmoe/article/details/81415943
https://zhuanlan.zhihu.com/p/37910324
本論文中可考慮不用maP,只計算目標是否出現等方式,或者用yolo做ground truth。