当前位置:网站首页>Train your dataset with swinunet
Train your dataset with swinunet
2022-07-07 08:23:00 【I am a little rice】
Refer to the post : https://blog.csdn.net/qq_37652891/article/details/123932772
Data set preparation
Multi category semantic segmentation of remote sensing images , The total is divided into 7 class ( Including background )
image:
label_rgb
label( It's not all black here , The value of the category is 0,1,2,3,4,5,6
), Later training uses such data
Data address
Baidu cloud :https://pan.baidu.com/s/1zZHnZfBgVWxs6TJW4yjeeQ
Extraction code :2022
SwinUNet Code address
Dataset processing
Data sets image
and label
, This data set should provide rgb
Format labels and include 0,1,2,3,4,5,6
Label of the value ,SwinUNet
The use is to include 0,1,2,3,4,5,6
Label image for ;
1. Data sets
Data sets are stored in SwinUNet
The root directory ,image
Middle is the original image ,label
Middle is the label image ( common 7 class , Its tag value is 0,1,2,3,4,5,6,7
);
If you use other data sets , Pay attention to the value of the label . For example, if it is a second category . The label 0
or 255
, It needs to be replaced with 0
or 1
—SwinUNet
---------configs
---------img_datas
---------------train
--------------------image
--------------------label
---------------test
--------------------image
--------------------label
2. stay SwinUnet
Created in the root directory npz.py
file , function npz.py
file
import glob
import cv2
import numpy as np
import os
def npz(im, la, s):
images_path = im
labels_path = la
path2 = s
images = os.listdir(images_path)
for s in images:
image_path = os.path.join(images_path, s)
label_path = os.path.join(labels_path, s)
image = cv2.imread(image_path)
image = cv2.cvtColor(image,cv2.COLOR_BGR2RGB)
# Labels are converted from three channels to single channels
label = cv2.imread(label_path, flags=0)
# preservation npz file
np.savez(path2+s[:-4]+".npz",image=image,label=label)
npz('./img_datas/train/image/', './img_datas/train/label/', './data/Synapse/train_npz')
npz('./img_datas/test/image/', './img_datas/test/label/', './data/Synapse/test_vol_h5')
3. stay SwinUnet
Created in the root directory txt.py
file , function txt.py
file
The goal is to generate ./list/list_Synapse/train.txt
and ./list/list_Synapse/test_vol.txt
file
import os
def write_name(np, tx):
#npz File path
files = os.listdir(np)
#txt File path
f = open(tx, 'w')
for i in files:
#name = i.split('\\')[-1]
name = i[:-4]+'\n'
f.write(name)
write_name('./data/Synapse/train_npz', './lists/lists_Synapse/train.txt')
write_name('./data/Synapse/test_vol_h5', './lists/lists_Synapse/test_vol.txt')
4. Download Pre Workout weights , Put it in SwinUnet
In the catalog pretrained_ckpt
Under the folder
link :https://pan.baidu.com/s/1-hYwJRlr95Fv08e9AEARww
Extraction code :2022
Modify the network
1. modify train.py
file
Here's the important thing Number of categories , Others depend on the situation
2. modify ./datasets/dataset_synapse.py
file
3. modify trainer.py
file
I don't know why
4. Run code
This information can be passed in as a super parameter , If not , Then you can use default=
To write the default value
If you set the default value , So run python train.py
That's all right.
边栏推荐
- Improve the delivery efficiency of enterprise products (1) -- one click installation and upgrade of enterprise applications
- Battery and motor technology have received great attention, but electric control technology is rarely mentioned?
- 漏洞复现-Fastjson 反序列化
- Réplication de vulnérabilité - désrialisation fastjson
- JS复制图片到剪切板 读取剪切板
- 解析机器人科技发展观对社会研究论
- MES system is a necessary choice for enterprise production
- Interview questions (CAS)
- Complex network modeling (III)
- 拓维信息使用 Rainbond 的云原生落地实践
猜你喜欢
Pvtv2--pyramid vision transformer V2 learning notes
Hisense TV starts the developer mode
Open3d ISS key points
漏洞复现-easy_tornado
Open3D ISS关键点
Qinglong panel - today's headlines
[untitled]
opencv学习笔记三——图像平滑/去噪处理
Rainbow 5.7.1 supports docking with multiple public clouds and clusters for abnormal alarms
Openvscode cloud ide joins rainbow integrated development system
随机推荐
单元测试报告成功率低
Four items that should be included in the management system of integral mall
Battery and motor technology have received great attention, but electric control technology is rarely mentioned?
Unityhub cracking & unity cracking
Using nocalhost to develop microservice application on rainbow
Rsync remote synchronization
Function extension, attribute extension and non empty type extension in kotlin
Quick analysis of Intranet penetration helps the foreign trade management industry cope with a variety of challenges
opencv学习笔记一——读取图像的几种方法
Understanding of out covariance, in inversion and invariance in kotlin
[quick start of Digital IC Verification] 12. Introduction to SystemVerilog testbench (svtb)
漏洞複現-Fastjson 反序列化
MES系统,是企业生产的必要选择
Leetcode simple question: find the K beauty value of a number
云原生存储解决方案Rook-Ceph与Rainbond结合的实践
The simple problem of leetcode is to judge whether the number count of a number is equal to the value of the number
饥荒云服管理脚本
Le système mes est un choix nécessaire pour la production de l'entreprise
机器人教育在动手实践中的真理
雅思考试自己的复习进度以及方法使用【日更版】