1、训练
python tools/train.py configs/fcos/fcosrdweed3.py
2、测试
这一步要加–out=result.pkl,才能计算准确率和召回率
python tools/test.py configs/fcos/fcosrddweed3.py work_dirs/fcosrddweed3/epoch_300.pth --out=resultfcos.pkl
3、计算准确率和召回率
在tools/analysis_tools/confusion_matrix.py代码下面加上:
TP = np.diag(confusion_matrix)FP = np.sum(confusion_matrix, axis=0) - TPFN = np.sum(confusion_matrix, axis=1) - TPprecision = TP / (TP + FP)recall = TP / (TP + FN)average_precision = np.mean(precision)average_recall = np.mean(recall)f1 = 2 * (average_precision * average_recall) / (average_precision + average_recall)#print("AP ", average_precision)#print("AR", average_recall)#print("F1", f1)print("P",precision)print("R",recall)
运行:
python tools/analysis_tools/confusion_matrix.py configs/fcos/fcosrddweed3.py resultfcos.pkl ./
拿下: