We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
''' 进行指标评估需要注意以下几点: 1、该文件生成的图为灰度图,因为值比较小,按照JPG形式的图看是没有显示效果的,所以看到近似全黑的图是正常的。 2、该文件计算的是验证集的miou,当前该库将测试集当作验证集使用,不单独划分测试集 3、仅有按照VOC格式数据训练的模型可以利用这个文件进行miou的计算。 ''' 出现的问题,混淆矩阵只有背景有结果
不过多说明细节了,被这个问题折磨了太久,也找了不少地方的问题,接下来直接说解决办法。
首先是2分类任务,背景+目标 输出了图像结果排查,发现
标签(VOCdevkit\VOC2007\SegmentationClass\xx.png)的图是这样的,目标部分标签255(白色),
但代码流程中预测出的图(路径miou_out\detection-results\xx.png)目标部分是1(灰度图,看上去是黑色的)(相当于没有mix可视化
观察混淆矩阵,发现背景确实是识别到了,但是另一个类别没有结果,感觉是这部分的问题(utils/utils_metrics.py/fask_hist函数),在这里用np.bincount计算的混淆矩阵
遂在utils/utils_metrics.py/compute_mIoU函数中,增加了一行代码转换了标签图的数值 (最差的办法
#------------------------------------------------# # 读取一张对应的标签,转化成numpy数组 #------------------------------------------------# label = np.array(Image.open(gt_imgs[ind])) label = np.minimum(1, label) # 添加了此行代码将255转换到了1
最终得到了混淆矩阵,结果也能计算了,不过这个问题不应该在这里解决,只能就事论事来救急了
The text was updated successfully, but these errors were encountered:
No branches or pull requests
'''
![image](https://private-user-images.githubusercontent.com/51912512/283798233-9b54334c-9808-4718-a899-002f58bb3d21.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjQ0MDYyMTQsIm5iZiI6MTcyNDQwNTkxNCwicGF0aCI6Ii81MTkxMjUxMi8yODM3OTgyMzMtOWI1NDMzNGMtOTgwOC00NzE4LWE4OTktMDAyZjU4YmIzZDIxLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA4MjMlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwODIzVDA5MzgzNFomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTZiNzcyODc0NjUwMWUyYmQwMjFlMDc3MmY2NDBiNTIxM2IwYzBlMWVjYzMzZTY2OGIzZDI1YTZjODhhYTA5NWYmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.Nclt4VwPkYgj-EpRYFN8FQuB-72QfFdnswMn28fMecg)
![image](https://private-user-images.githubusercontent.com/51912512/283798166-4b68d90c-bf36-4a39-85a7-8852711fce15.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjQ0MDYyMTQsIm5iZiI6MTcyNDQwNTkxNCwicGF0aCI6Ii81MTkxMjUxMi8yODM3OTgxNjYtNGI2OGQ5MGMtYmYzNi00YTM5LTg1YTctODg1MjcxMWZjZTE1LnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA4MjMlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwODIzVDA5MzgzNFomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTlhNzhiZDBiYzBlN2QzZDAxMWRiM2YxNGRjMjg0ZjcwM2E3YWZmNTEyZjE2ZjljMjQ1MDY3OWUxNTU5ZTMyM2MmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.nOkiXuU_wCaIdyYdIJJBrCn1qJH6VKeTNy9N1ckPVbY)
进行指标评估需要注意以下几点:
1、该文件生成的图为灰度图,因为值比较小,按照JPG形式的图看是没有显示效果的,所以看到近似全黑的图是正常的。
2、该文件计算的是验证集的miou,当前该库将测试集当作验证集使用,不单独划分测试集
3、仅有按照VOC格式数据训练的模型可以利用这个文件进行miou的计算。
'''
出现的问题,混淆矩阵只有背景有结果
不过多说明细节了,被这个问题折磨了太久,也找了不少地方的问题,接下来直接说解决办法。
首先是2分类任务,背景+目标
输出了图像结果排查,发现
标签(VOCdevkit\VOC2007\SegmentationClass\xx.png)的图是这样的,目标部分标签255(白色),
![image](https://private-user-images.githubusercontent.com/51912512/283795963-b74fd6cb-fe7b-4576-87f8-0e10e90995ab.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjQ0MDYyMTQsIm5iZiI6MTcyNDQwNTkxNCwicGF0aCI6Ii81MTkxMjUxMi8yODM3OTU5NjMtYjc0ZmQ2Y2ItZmU3Yi00NTc2LTg3ZjgtMGUxMGU5MDk5NWFiLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA4MjMlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwODIzVDA5MzgzNFomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPWYyZjg0YjY1OWRhOThhYTdlMjkyMTExMmYwOTlkODYzMjNmMjk3ZDkyM2Q1MTZhODMxMTY4ZjE3YTczZDUzZmUmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.DyOPJOU50mMw-It9Fh-e1m2IK618g4PIMIekK2yokMk)
![image](https://private-user-images.githubusercontent.com/51912512/283796030-510b87ff-c3c5-475c-9a8d-44c483ab5aee.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjQ0MDYyMTQsIm5iZiI6MTcyNDQwNTkxNCwicGF0aCI6Ii81MTkxMjUxMi8yODM3OTYwMzAtNTEwYjg3ZmYtYzNjNS00NzVjLTlhOGQtNDRjNDgzYWI1YWVlLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA4MjMlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwODIzVDA5MzgzNFomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTJiNmY5ODk1OTBjNmUyNzM5NTM1NGYzMWYzYmMxZDczMmE1ZGNlNzcwOTRiZjA2OWNjNDg4YzUyMmViZTk5NTEmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.0HDF1b3P3LO03ts5D5nCpLM4t4zXkcSomksQA1lYDNk)
但代码流程中预测出的图(路径miou_out\detection-results\xx.png)目标部分是1(灰度图,看上去是黑色的)(相当于没有mix可视化
![image](https://private-user-images.githubusercontent.com/51912512/283796246-b6961c0f-9935-428b-9655-efbebcdd4a52.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjQ0MDYyMTQsIm5iZiI6MTcyNDQwNTkxNCwicGF0aCI6Ii81MTkxMjUxMi8yODM3OTYyNDYtYjY5NjFjMGYtOTkzNS00MjhiLTk2NTUtZWZiZWJjZGQ0YTUyLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA4MjMlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwODIzVDA5MzgzNFomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPWRlNmMzZTM0YzEzYWY2NWVhMTg3MWY2YmRhMGVjMzlkZTFiOWIzY2Q3YzZkMWU5MzI2MWJkMTQ4NDdjYmY4MjgmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.U2ncFtyugHrblpTK0dSmI0Ndj1UYd8xukKd9oSdsggg)
![image](https://private-user-images.githubusercontent.com/51912512/283796303-95b25a63-570b-464c-9c74-a0f258de4a8a.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjQ0MDYyMTQsIm5iZiI6MTcyNDQwNTkxNCwicGF0aCI6Ii81MTkxMjUxMi8yODM3OTYzMDMtOTViMjVhNjMtNTcwYi00NjRjLTljNzQtYTBmMjU4ZGU0YThhLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA4MjMlMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwODIzVDA5MzgzNFomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPWVlZGYxNWZjNTM2ZWNiMDMyZWNhNWFlZDcxMTZmNTNhZTU1NTM0YTEyNDUyMzI5ODY3NTM1ZTI4OTA4M2U2OWUmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.RJKffUL3IjrQdSoC77lZJ9_1A3N9_rHgBONdvcXjF8I)
观察混淆矩阵,发现背景确实是识别到了,但是另一个类别没有结果,感觉是这部分的问题(utils/utils_metrics.py/fask_hist函数),在这里用np.bincount计算的混淆矩阵
遂在utils/utils_metrics.py/compute_mIoU函数中,增加了一行代码转换了标签图的数值
(最差的办法
最终得到了混淆矩阵,结果也能计算了,不过这个问题不应该在这里解决,只能就事论事来救急了
![image](https://private-user-images.githubusercontent.com/51912512/283797896-59ddcedc-54f5-4218-9fd0-47225503fdb0.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjQ0MDYyMTQsIm5iZiI6MTcyNDQwNTkxNCwicGF0aCI6Ii81MTkxMjUxMi8yODM3OTc4OTYtNTlkZGNlZGMtNTRmNS00MjE4LTlmZDAtNDcyMjU1MDNmZGIwLnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFs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dG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.Krxy3rsYTVDIhmaj_UbhvBE71twk8kpmcybw-jLsTMc)
The text was updated successfully, but these errors were encountered: