当前位置:网站首页>使用BiSeNet实现自己的数据集
使用BiSeNet实现自己的数据集
2022-07-07 05:19:00 【我是一个小稻米】
数据集准备
数据集:遥感房屋影像分割,分先后两个时间,主要是实现建筑物面积随时间的面积变化情况。
百度云:https://pan.baidu.com/s/1HlnKWToc00986jiTxhq_CA
提取码:RSAI
数据处理
1. 数据集
数据集存放在根目录下的datasets
文件夹下,与coco
和city
数据集并列,如果你的数据集的标签已经是0,1
,那么可以不用管label_255
,如果标签没有经过255-->1
的转化,可以先将标签文件放在label_255
下。
—BiSeNet
---------datasets
-----------------coco
-----------------cityscapes
-----------------time
-----------------------train
------------------------------image
------------------------------label_255
------------------------------label
-----------------------val
------------------------------image
------------------------------label_255
------------------------------label
2. 在datasets/times/
文件夹下创建one.py
目的是将0,255
的标签转化为0,1
,如果是多类的,那么标签就是0,1,2,3,...n
代码中只转化了train
中的文件,要转化val中的文件,修改train
为val
即可
import os
import cv2 as cv
labels_path = './train/label_255'
labels_save_path = './train/label'
lab_names = os.listdir(labels_path)
for s in lab_names:
label_path = os.path.join(labels_path, s)
label_save_path = os.path.join(labels_save_path, s)
label = cv.imread(label_path, 0)
label[label!=0]=1
cv.imwrite(label_save_path, label)
2. 在datasets/times/
文件夹下创建util.py
文件
目的是生成train.txt
文件和val.txt
文件,要转化val.txt
文件,只需要将下面代码中的所有train
换成val
即可(有三处)
import os
image_path = './train/image'
label_path = './train/label'
image_names = os.listdir(image_path)
for s in image_names:
image = os.path.join(image_path, s)
label = os.path.join(label_path, s)
with open('train.txt', 'a') as fin:
fin.write(image[2:] +","+ label[2:] +"\n")
fin.close()
网络模型地址
模型修改
1. 修改configs/bisenet_customer.py
文件
n_cats
:包括背景在内的类别数,这里类别是2
max_iter
:训练次数im_root
:数据路径train_im_anns
:刚才生成的train.txt路径val_im_anns
:刚才生成的val.txt路径cropsize
:改成图像尺寸eval_crop
:改成图像尺寸(不知道作用)ims_per_gpu:gpu
数量
2. 修改类别
这个数据集类别是2
如果configs/bisenet_customer.py
中的model_type='bisenetv2'
修改lib/models/bisenetv2.py
文件中的n_classes=2
如果configs/bisenet_customer.py
中的model_type='bisenetv1'
修改lib/models/bisenetv1.py
文件中的BiSeNetV1(2)
运行命令
--nproc_per_node
不知道什么意思,这里的2
是gpu
的数量
CUDA_VISIBLE_DEVICES=0,1 torchrun --nproc_per_node=2 tools/train_amp.py --config configs/bisenet_customer.py
就可以正常运行啦!!
边栏推荐
- 提高企业产品交付效率系列(1)—— 企业应用一键安装和升级
- The use of generics and vararg variable parameters in kotlin
- Register of assembly language by Wang Shuang
- Rainbond结合NeuVector实践容器安全管理
- Rainbond 5.7.1 支持对接多家公有云和集群异常报警
- Empire CMS collection Empire template program general
- Recursive method to verify whether a tree is a binary search tree (BST)
- 在Rainbond中实现数据库结构自动化升级
- Use of any superclass and generic extension function in kotlin
- 漏洞复现-easy_tornado
猜你喜欢
game攻防世界逆向
JS复制图片到剪切板 读取剪切板
复杂网络建模(一)
[step on the pit series] H5 cross domain problem of uniapp
Don't stop chasing the wind and the moon. Spring mountain is at the end of Pingwu
柯基数据通过Rainbond完成云原生改造,实现离线持续交付客户
央视太暖心了,手把手教你写HR最喜欢的简历
The simple problem of leetcode is to judge whether the number count of a number is equal to the value of the number
LeetCode中等题之我的日程安排表 I
BiSeNet的特点
随机推荐
Find the mode in the binary search tree (use medium order traversal as an ordered array)
Empire CMS collection Empire template program general
Uniapp mobile terminal forced update function
LeetCode简单题之判断一个数的数字计数是否等于数位的值
The simple problem of leetcode is to judge whether the number count of a number is equal to the value of the number
Topic not received? Try this
Qinglong panel -- Huahua reading
Use of out covariance and in inversion in kotlin
在Rainbond中实现数据库结构自动化升级
在 Rainbond 中一键安装高可用 Nacos 集群
Complete linear regression manually based on pytoch framework
柯基数据通过Rainbond完成云原生改造,实现离线持续交付客户
【雅思口语】安娜口语学习记录 Part3
Interactive book delivery - signed version of Oracle DBA work notes
Don't stop chasing the wind and the moon. Spring mountain is at the end of Pingwu
Summary of redis functions
ROS Bridge 笔记(05)— carla_ackermann_control 功能包(将Ackermann messages 转化为 CarlaEgoVehicleControl 消息)
CCTV is so warm-hearted that it teaches you to write HR's favorite resume hand in hand
青龙面板--整理能用脚本
CDC (change data capture technology), a powerful tool for real-time database synchronization