当前位置:网站首页>Tensorflow learning 6 -- run through UNET image segmentation
Tensorflow learning 6 -- run through UNET image segmentation
2022-05-14 14:02:14【Luo Xiaohei's War record is beautiful】
Thank the great God of selfless dedication and my senior brother
The great god git library
Great God's video tutorial
The great god CSDN
The following content of this article is based on the great God's tutorial, which is suitable for my own process record
Make your own dataset
Mark the original picture
use labelme Open the picture and mark it , Save as json Format file and put it together with the original drawing
install labelme
installed pip Can use pip install labelme Install and use . But the code used later should import labelme file , If it had been Windows Of cmd If installed in , When the code runs, it will report an error ModuleNotFoundError: No module named ‘labelme’ . At this time, just in the present pycharm Inside the terminal pip install Just the corresponding library .Place the original image in dataset\image Folder 【dataset and make_dataset.py In the same directory 】, from labelme Open the folder
Turn on autosave... Before marking Save trouble . The shortcut key to switch to the next picture is D
Click on Create PolyGons marked
preservation josn File to dataset\image Folder
take json Convert file to label picture
Use elder martial brother's make_dataset.py file , Generate JPEGlmages and SegmentationClass The contents of the two folders , One is the original picture .jpg, One is the label diagram .png.
- modify make_dataset.py The category in the file is the category of its own data set . My own is seam, The background is the default .
- Make sure the folder path is correct , Just run it . It will automatically generate folder and label diagram
Reference tutorials not used in label making
Divide the data set
Divide the available data sets into training sets in proportion 、 Test set, etc.
Put pictures in a folder (dataset\JPEGImages) And label folder (dataset\SegmentationClass) Put it in unet\VOCdevkit\VOC2007.
open unet In the catalog voc_annotation.py The split scale can be modified .
7:3 Just put 0.9 Change to 0.7function voc_annotation.py There will be a pile of txt The file in ImageSets/Segmentation Create... In the folder , Inside is a list of pictures
Running training
- open train.py Change the classification quantity
num_classes = 2 - Download the weight file from the network disk , In the model_data Folder
then train.py Write the corresponding path in
model_path = “model_data/unet_vgg_voc.h5”
If you don't use the weight of the boss , Just change this to an empty string , But the training effect is probably not good - You can change the number of cycles
from 0-20 It's training when it's frozen , from 20-40 It's thawing training . I put the thawed epoch It's also written as 20 You can run , Equivalent to I don't change the parameters , Just fine tune . Junk computers can't run training , It used to be 0-50-100 Two stage batch All are 2 Run to 51 Give me an error
Error occurred when finalizing GeneratorDataset iterator: Failed precondition: Python interpreter state is not initialized. The process may be terminated. [[{ {node PyFunc}}]]
The reason is that there is not enough memory Fried .
forecast
To open the first unet.py Change some parameters .
“model_path” : ‘logs/ep020-loss0.001-val_loss0.001.h5’,
This path is from logs Found in the folder , Choose any one and put it on
Remember to change the number of categories below
preservation , Don't runopen predict.py
Classify and write
name_classes = [“background”,“seam”]function predict.py, Then you can predict a single picture by inputting the file path at the bottom
design sketch
I really can't see the picture of the weld I really can't recognize
The recognized image can be segmented normally
Took a new picture to predict , Although the scope is a little small , But the position is right , It seems that more training is neededThere are other modes to try
Calculation mIOU
function unet Under folder get_miou.py Documents obtained mIOU result
confirm unet.py The parameters in have been modified
open get_miou.py Modify the classification inside and run
边栏推荐
- 逻辑回归(Logistic Regression)
- 【源码解析】StyleNeRF 之Train_encoder.py
- moderlarts第一次学习
- 为什么调用了BrandMapper里面的addBrand方法,这个方法已经给我一个返回值了,也在方法里面提交事务了,但是数据库还是没有增加数据
- 2022年5月7日刷题
- 2022.5.7-----leetcode.433
- 2022年5月7号博客内容SSM框架项目管理-------------超市管理系统(第十一课针对订单管理修改表中的数据表的数据)
- C#,扫雷游戏(Minesweeper)之壹——作弊手段大曝光
- 【开源库学习】OpenThreads
- 【OSG】Examples
猜你喜欢
随机推荐
- postman循环调用同一个接口
- (Transfer Learning and fine tuning)迁移学习与微调
- ICDAR 2021竞赛 科学文献分析——表格识别综述部分(剩余部分是文档布局分析)
- Webpach打包器的如何使用
- 2021-IEEE论文-深度神经网络在文档图像表格识别中的应用现状及性能分析
- vscode搭建go开发环境
- chrome 安装axure 插件
- P4 learning - Basic forwarding
- The contents of the input box are displayed on the right
- Clickhouse 22.3 lts release
- Programmer flirting special ~ ~ ~ nice H5 cube creative photo album, resources free!!! A gift from a programmer to a girl is very suitable for a young lady!
- [missing scan tool] awvs, appscan download and installation (with network disk link)
- paramiko下载大文件出错问题 sftp
- 5.3 binary tree_ Code implementation of optimized heap and Top-k problem
- 5.4 binary tree_ Code implementation of various traversal and calculation
- Record: com mysql. cj. jdbc. exceptions. CommunicationsException: Communications link failure... [effective through personal test]
- Record: 1221 - incorrect usage of Union and order by [effective through personal test]
- CLIP学习笔记
- [force deduction] backtracking 1 - Foundation + combination
- What role does cloud computing play in building intelligence?
- Abstract - the shortest novel of 2016
- Fiddler packet capture guide 05: breaking points
- SAP:SWITCH用法
- AD7606/AD7616使ZYNQ在能源电力领域如虎添翼,可实现16/32/64通道AD同步采样
- AM57x 多核SoC开发板——GPMC的多通道AD采集综合案例手册(上)
- 【日常训练】面试题 01.05. 一次编辑
- 【日常训练】384. 打乱数组
- AM57x 多核SoC开发板——GPMC的多通道AD采集综合案例手册(下)
- EDA technology and market analysis
- libmodus源码解读
- 一招win7 c盘瘦身
- Day 1:轮转数组
- 美团四大名著为什么不是三或五
- 是能力更是文化,談談IT系統的安全發布
- C'est la capacité, c'est la culture.
- Am57x multi-core SoC development board -- GPMC's comprehensive case manual for multi-channel AD acquisition (Part 2)
- [daily training] 384 Scramble array
- [daily training] interview question 01.05 One edit
- Am57x multi-core SoC development board -- GPMC's comprehensive case manual for multi-channel AD acquisition (Part I)
- Ad7606 / ad7616 make zynq more powerful in the field of energy and power, and can realize 16 / 32 / 64 channel ad synchronous sampling