yolact-训练自己的数据集
yolact-训练自己的数据集
yolact简介
安装labelme
pip3 install labelmelabelme
打开后放入图片并进行标注,如:
[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-KIuYm0eW-1616588123325)(C:\Users\zhong\AppData\Roaming\Typora\typora-user-images\image-20210324195647022.png)]
寻找合适的图片并进行一一标注,保存后会生成对应的json文件。
下载代码并安装必要的程序包
git clone https://github.com/x0rzkov/yolact-mini-docker.git
模型训练
更改…/data/config.py文件
1.更改custom相关信息
CUSTOM_CLASSES = ('smoke',) #如果只有一样物件需要加上,CUSTOM_LABEL_MAP = {1: 1}custom_dataset = Config({'name': 'Custom dataset','train_images': '/home/jiang/yolact-mini-docker/results/images/output/', # No need to add 'JPEGImages/'.'train_info': '/home/jiang/yolact-mini-docker/results/images/output/annotations.json','valid_images': '/home/jiang/yolact-mini-docker/results/images/output/','valid_info': '/home/jiang/yolact-mini-docker/results/images/output/annotations.json','class_names': CUSTOM_CLASSES})
#修改路径 res101_custom_config = res101_coco_config.copy({'name': 'res101_custom','dataset': custom_dataset,'num_classes': len(custom_dataset.class_names) + 1,'batch_size': 8,'img_size': 550, # image size'max_iter': 800000,'backbone': resnet101_backbone,# During training, first compute the maximum gt IoU for each prior.# Then, for priors whose maximum IoU is over the positive threshold, marked as positive.# For priors whose maximum IoU is less than the negative threshold, marked as negative.# The rest are neutral ones and are not used to calculate the loss.'pos_iou_thre': 0.5,'neg_iou_thre': 0.4,# If less than 1, anchors treated as a negative that have a crowd iou over this threshold with# the crowd boxes will be treated as a neutral.'crowd_iou_threshold': 0.7,'conf_alpha': 1,'bbox_alpha': 1.5,'mask_alpha': 6.125,# Learning rate'lr_steps': (280000, 600000, 700000, 750000),#'lr_steps': (280000,360000,400000),'lr': 1e-3,'momentum': 0.9,'decay': 5e-4,# warm up setting'warmup_init': 1e-4,'warmup_until': 500,# The max number of masks to train for one image.'masks_to_train': 100,# anchor settings'scales': [24, 48, 96, 192, 384],'aspect_ratios': [1, 1 / 2, 2],'use_square_anchors': True, # This is for backward compatability with a bug.# Whether to train the semantic segmentations branch, this branch is only implemented during training.'train_semantic': True,'semantic_alpha': 1,# postprocess hyperparameters'conf_thre': 0.05,'nms_thre': 0.5,'top_k': 200,'max_detections': 100,# Freeze the backbone bn layer during training, other additional bn layers after the backbone will not be frozen.'freeze_bn': False,'label_map': CUSTOM_LABEL_MAP})
#将res101_custom_config替换成可改动的参数
在该目录下定义一个labels.txt文件
__ignore__
_background_
smoke
在utils目录下执行
python3 labelme2coco.py your-image-and-labelme-json-path your-expected-output-folder --labels the-path-of-labels.txt#样例
python3 labelme2coco.py /home/jiang/yolact-mini-docker/image /home/jiang/yolact-mini-docker/results/images/output --labels /home/jiang/yolact-mini-docker/labels.txt
#注意每次执行这句语句需要清空上次生成的文件夹
执行之后会生成一个文件夹并将之前标注过的图片放入,并会生成一个对应的annotations.json文件
训练
python3 train.py --config=res101_custom_config
评估
python3 eval.py --trained_model=latest_res101_custom_801.pth --max_num=1000#注意命名的pth是刚刚自己生成的.pth文件
测试
python3 detect.py --trained_model=latest_res101_custom_601.pth --image /home/jiang/1#路径为想要检测的图片所在文件夹
结果展示
参考链接
https://blog.csdn.net/weixin_44878465/article/details/108149285
https://github.com/dbolya/yolact
https://github.com/x0rzkov/yolact-mini-docker
https://github.com/feiyuhuahuo/Yolact_minimal
yolact-训练自己的数据集相关推荐
- Yolact训练自己的数据集
Yolact训练自己的数据集 1:提前准备好自己的数据集 2:下载github存储库 3:修改config.py 4:训练 5:测试 可能是由于yolact官方更新过其项目代码,所以网上其他人的yol ...
- 【Yolact训练自己的数据集(踩坑总结)】
yolact训练自己的数据集 前言 一.问题1 二.问题2 1.RuntimeError: Expected a 'cuda' device type for generator but found ...
- 用Yolact模型训练自己的数据集
1.首先用labelme标注数据(分割法) 2.yolact训练的数据集为coco数据集,所以要转化数据集,使用从Git下载的labelme项目中的labelme2coco转换就可以 这里因为我的标注 ...
- yolov5训练自己的数据集
How to Train YOLOv5 On a Custom Dataset 根据这篇文章下的数据集 YOLOv5训练自己的数据集 根据这篇文章,输入训练命令行 Hyperparameter ...
- 实践教程|如何用YOLOX训练自己的数据集?
作者 | JuLec@知乎(已授权) 来源 | https://zhuanlan.zhihu.com/p/402210371 编辑 | 极市平台 导读 Yolo系列因为其灵活性,一直是目标检测热门算法 ...
- 手把手教你使用YOLOV5训练自己的数据集并用TensorRT加速
点击上方"3D视觉工坊",选择"星标" 干货第一时间送达 前言 本文主要介绍目标检测YOLOV5算法来训练自己的数据集,并且使用TensorRT来对训练好的模型 ...
- mask rcnn训练自己的数据集
原文首发于微信公众号「3D视觉工坊」--mask rcnn训练自己的数据集 前言 最近迷上了mask rcnn,也是由于自己工作需要吧,特意研究了其源代码,并基于自己的数据进行训练~ 本博客参考:ht ...
- YOLOv3 Darknet安装编译与训练自己的数据集
YOLOv3 Darknet安装编译与训练自己的数据集 文章目录: 1安装编译darknet与测试darknet 1.1 安装编译darknet 1.1.1 下载darknet安装包 1.1.2 编译 ...
- yolov5训练自己的数据集(缺陷检测分类——看了就懂系列)
这里记录一下将yolov5用于训练自己的数据集,这里v5的github地址 Environment 本文是直接 pip install -r requirement.txt直接安装成功,如果不容易成功 ...
- Fast RCNN 训练自己的数据集(3训练和检测)
Fast RCNN 训练自己的数据集(3训练和检测) 转载请注明出处,楼燚(yì)航的blog,http://www.cnblogs.com/louyihang-loves-baiyan/ https ...
最新文章
- 一个传入自定义 user.properties 文件生成 jMeter 执行报表出错的错误消息
- WIN10 开启右键 命令提示符
- opencv qt5安装linux,Ubuntu OpenCV安装和设置(Qt5吗?)
- 除了随机还要进化——对Infinity进一步的想法
- 活动目录系列之一……活动目录简介及部署
- TensorFlow精进之路(三):两层卷积神经网络模型将MNIST未识别对的图片筛选出来
- C#两路list数组归并去重
- Java中通过js简单的调用高拍仪和扫描仪
- 拉普拉斯平滑处理介绍
- linux修改u盘mbr,远景论坛U盘版 完美 4G/8G/16G WINPE+LINUXPE+MACPE+10.9正式版MBR安装版 制作超简单...
- 超大箱船面临改变 投入福州到泉州专线
- 如果让markdown的图片变清晰/改变大小
- 基于阿里云盘的文件分享系统
- 登录企业邮箱imap服务器,企业邮箱IMAP客户端的同步设置
- NUL 与 NULL
- PeopleSoft如何配置SMTP邮件服务
- MySql计算两个日期的时间差函数
- win10 任务栏图标变为空白、图标丢失的解决方法
- 防止电脑辐射的有效方法
- 人气爆棚 航嘉亮相华中科技大学现场