当前位置:网站首页>deeplab implements its own remote sensing geological segmentation dataset
deeplab implements its own remote sensing geological segmentation dataset
2022-07-31 11:16:00 【I am a little rice】
1. 数据集下载
下载链接
提取码:2022
Samples are stored in the datasets folderimage和label,You can view their channel and other information,Convenient to work with your own datasets.
2. 数据集预处理
参考另一篇文章:图像预处理
- 数据集image
- 是24位深度
- 3通道RGB图像
- 数据集label
- 是8位深度
- The value of the label is0,1,2,…(有nclass valuen-1)
If your dataset labels take the value 255,需要转化为0,1,2,等(视自己情况而定)
例如:
Background [0,0,0]--------------0
Person [192,128,128]--------------1
Bike [0,128,0]----------------------2
Car [128,128,128]----------------- 3
Drone [128,0,0]--------------------4
Boat [0,0,128]--------------------- 5
Animal [192,0,128]---------------- 6
Obstacle [192,0,0]------------------7
Construction [192,128,0]-----------8
Vegetation [0,64,0]-----------------9
Road [128,128,0]-------------------10
Sky [0,128,128]---------------------11
如果显存不够,Images can be cropped as 256大小,对应代码如下:
The cropped image is saved in image和label中
import os
import numpy as np
import cv2
images_path = './JPEGImages/'
labels_path = './SegmentationClass/'
image_files = os.listdir(images_path)
for s in image_files:
image_path = images_path + s
label_path = labels_path + s[:-4]+'.png'
image = cv2.imread(image_path)
label = cv2.imread(label_path)
#print(image.shape)
index = 0
for i in range(4):
for j in range(4):
#print(i*256, ((i+1)*256-1), j*256, ((j+1)*256-1))
new_image = image[i*256 : ((i+1)*256), j*256 : ((j+1)*256), :]
new_label = label[i*256 : ((i+1)*256), j*256 : ((j+1)*256), :]
cv2.imwrite('./image/'+ 'b_' + s[:-4] +'_'+ str(index) + '.png', new_image)
new_label = cv2.cvtColor(new_label, cv2.COLOR_BGR2GRAY)
cv2.imwrite('./label/'+ 'b_' + s[:-4] +'_'+ str(index) + '.png', new_label)
index+=1
print(s)
3. 模型下载
4. 检查数据
- 数据准备完成之后,首先运行
voc_annotation.py
文件,生成数据列表,运行命令:python voc_annotation.py
,Usually no error is reported here,If an error is reported, you can check as follows:Check if the label is
8位深度
,如果不是,运行下面的代码:import os import cv2 file_names = os.listdir('./SegmentationClass/') for s in file_names: image_path = os.path.join('./SegmentationClass/', s) image = cv2.imread(image_path) image = cv2.cvtColor(image, cv2.COLOR_BGR2GRAY) cv2.imwrite('./SegmentationClass/' + s , image)
Check if there are other values in the label,比如说
类别为3
,Then the value in the tag can only be0,1,2
,如果出现其他值,就可能会报错;Even if there is no error here,There may also be problems during training,So if there is this problem,一定要记得修改.If this value is not particularly large,可以直接设为0;如果特别多,Then you need to check which step is causing the problem,If you can't find it, suggest changing the dataset.
5. 训练模型
- 修改train.py代码
图像的尺寸(重要)
图像类别(重要)
batch_sizeand other parameters as the case may be - 运行
python train.py
来训练
6. 模型评估
- 修改deeplab.py内容,are the trained models.类别数(Including background).图像尺寸
- 修改get_miou.py内容
- 运行
python get_miou.py
命令
7. 模型预测
- 修改deeplab.py内容,are the trained models.类别数(Including background).图像尺寸
- 修改predict.py内容.name_classesIndicates the corresponding name for each category
- 运行
python predict.py
命令
边栏推荐
- Unix知识:shell详细解读
- Sql optimization summary!detailed!(Required for the latest interview in 2021)
- AWS亚马逊云账号注册,免费申请12个月亚马逊云服务器详细教程
- Windows安装mysql详细步骤(通俗易懂,简单上手)
- Experience innovation and iteration through the development of a lucky draw applet
- 内网渗透学习(四)域横向移动——SMB和WMI服务利用
- Life is endless, there are more questions, simple questions to learn knowledge points
- Redis缓存面临的缓存击穿问题
- 解决报错TypeError:unsupported operand type(s) for +: ‘NoneType‘ and ‘str‘
- Cloudera Manager —— 端到端的企业数据中心管理工具
猜你喜欢
最全phpmyadmin漏洞汇总
面试、工作中常用sql大全(建议收藏备用)
MySQL 的几种碎片整理方案总结(解决delete大量数据后空间不释放的问题)
拥抱趋势!阿里这套微服务开源框架权威手册,实战到底层细致清晰
PyQt5快速开发与实战 9.5 PyQtGraph在PyQt中的应用 && 9.6 Plotly在PyQt中的应用
web安全入门-黑苹果MAC系统安装
IDEA 配置方法注释自动参数
3.网页信息解析方法:Xpath与BeautifulSoup
Sql optimization summary!detailed!(Required for the latest interview in 2021)
最新MySql安装教学,非常详细
随机推荐
实现弹框组件
AtCoder—E - Σ[k=0..10^100]floor(X/10^k
瑞吉外卖项目:新增菜品与菜品分页查询
【虚拟化生态平台】树莓派安装虚拟化平台操作流程
IBM SPSS Statistics 28软件安装包下载及安装教程
Insertion and deletion of doubly linked list
才22岁!这位'00后'博士拟任职985高校!
MySQL 的几种碎片整理方案总结(解决delete大量数据后空间不释放的问题)
生命不息,刷题不止,简单题学习知识点
《MySQL高级篇》五、InnoDB数据存储结构
In PLC communication error or timeout or download the prompt solution of the model
Three ways of single sign-on
突破传统可靠性测试:混沌工程优秀实践
MySQL 的 limit 分页查询及性能问题
Distributed Transactions - Introduction to Distributed Transactions, Distributed Transaction Framework Seata (AT Mode, Tcc Mode, Tcc Vs AT), Distributed Transactions - MQ
SQLServer2019 installation (Windows)
Summary of several defragmentation schemes for MySQL (to solve the problem of not releasing space after deleting a large amount of data)
文件包含漏洞
“带薪划水”偷刷阿里老哥的面经宝典,三次挑战字节,终成正果
apisix-Getting Started