资源简介

用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


评论

共有 条评论