資源簡介
用Python計算圖像對不同地物分類精確度,
計算分類結果圖與標準參考圖的混淆矩陣,
對分類結果進行評價
代碼片段和文件信息
from?PIL?import?Image
from?sklearn?import?metrics
from?sklearn.metrics?import?confusion_matrix
from?sklearn.metrics?import?classification_report
import?numpy?as?np
im_re?=?Image.open(‘picture1.tif‘)
im_pre?=?Image.open(‘picture2.png‘)
#?pix_re?=?im_re.load()
#?pix_pre?=?im_pre.load()
im_re_array?=?np.array(im_re)
im_pre_array?=?np.array(im_pre)
rows_recols_redims_re=im_re_array.shape
rows_precols_predims_pre=im_re_array.shape
#?width?=?im_re.size[0]
#?height?=?im_re.size[1]
#?widthheight=im_re.size
im_re_ture?=?[([0]?*?cols_re)?for?i?in?range(rows_re)]
im_pre_pred?=?[([0]?*?cols_pre)?for?j?in?range(rows_pre)]
for?x?in?range(rows_re):
????for?y?in?range(cols_re):
????????rgb?=?im_re_array[xy:]
????????if?r?==?255?&?g?==?255?&?b?==?255:
????????????im_re_tu
?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----
?????文件???????2193??2018-05-31?16:36??混淆矩陣\confusion_matrix.py
?????文件????????302??2018-05-31?16:43??混淆矩陣\Readme.txt
?????目錄??????????0??2018-05-31?16:44??混淆矩陣
-----------?---------??----------?-----??----
?????????????????2495????????????????????3
- 上一篇:ArcPY幫助文檔
- 下一篇:BP算法實現26個字母識別
評論
共有 條評論