Are you sure you want to delete this task? Once this task is deleted, it cannot be recovered.
LoveBai b87761684b | 2 years ago | |
---|---|---|
.idea | 2 years ago | |
__pycache__ | 2 years ago | |
assets | 2 years ago | |
checkpoint | 2 years ago | |
dataset | 2 years ago | |
model | 2 years ago | |
test_images | 2 years ago | |
analyze_fail_0.dat | 2 years ago | |
analyze_fail_1.dat | 2 years ago | |
coco_eval.py | 2 years ago | |
readme.md | 2 years ago | |
train_coco.py | 2 years ago |
FCOS模型发表于ICCV2019,论文全名为FCOS: Fully Convolutional One-Stage Object Detection。其模型没有anchor box,通过在卷积阶段加入FPN、在计算损失阶段加入centerness这一分支,实现了更高的检测精度;通过调整模型的backbone,可以达到44.7%的AP。
如下为MindSpore使用COCO2017数据集对FCOS进行训练的示例。
Zhi Tian, Chunhua Shen, Hao Chen, Tong He.FCOS: Fully Convolutional One-Stage Object Detection.论文地址参见
FCOS的网络架构参见原论文图2。
backbone在本实现中采用了ResNet50+FPN,可以使用更为精密的ResNeXt-64x4d-101-FPN来达到论文中提到的44.7AP。
使用的数据集:COCO2017
└── COCO2017
├── test2017 # COCO2017的测试集,共有40,670张图片
├── train2017 # COCO2017的训练集,共有118,287张图片
├── val2017 # COCO2017的验证集,共有5,000张图片
├── captions_train2017.json
├── captions_val2017.json
├── image_info_test2017.json
├── image_indo_test-dev2017.json
├── instances_train2017.json
├── instances_val2017.json
├── person_keypoints_train2017.json
├── person_keypoints_val2017.json
通过官方网站安装MindSpore后,您可以按照如下步骤进行训练和评估:
待完善...
待完善...
待完善...
脚本编写中...
└──FCOS
├── README.md
├── checkpoint # 训练时的checkpoint存储
├── dataset # 数据集处理
├── augment.py # 对数据集进行随机扩充、平移等操作
├── COCO_dataset.py # 对COCO数据集进行处理
├── model
├── backbone # 骨干网络
├── resnet.py # 骨干网络ResNet
├── config.py # 参数配置
├── eval_utils.py # 评估时需要用到的工具
├── fcos.py # FCOS模型网络
├── fpn_neck.py # FPN处理
├── head.py # 生成模型的head
└── loss.py # 生成目标框和loss损失
├── test_images # 测试图像
├── analyze_fail_0.dat # 运行报错时提及的dat文件
├── coco_eval.py # 在coco数据集上评估网络
└── train_coco.py # 训练网络
在config.py中可以同时配置训练参数和评估参数。
#backbone
pretrained=True
freeze_stage_1=True
freeze_bn=True
#fpn
fpn_out_channels=256
use_p5=True
#head
class_num=80
use_GN_head=True
prior=0.01
add_centerness=True
cnt_on_reg=True
#training
strides=[8,16,32,64,128]
limit_range=[[-1,64],[64,128],[128,256],[256,512],[512,999999]]
#inference
score_threshold=0.05
nms_iou_threshold=0.6
max_detection_boxes_num=1000
数据集:coco2017(仅支持解压后的coco2017)
预训练模型:resnet50
启动文件:train_coco.py
数据集路径参数设置:
1.在train_coco.py的56-57行:可以更改数据集及标签路径
2.在resnet文件的784行:可以更改预训练模型路径
3.在config文件中:可以更改ckpt保存路径
运行操作过程:
1.下载coco2017并解压后,将train_coco中的数据集及标签路径修改
2.下载resnet50的ckpt后,将resnet文件中的预训练模型路径修改
3.在train_coco中可以修改运行平台及运行模式
4.运行train_coco.py文件
(运行命令:python train_coco.py)
eval运行说明:
1.在coco_eval的224行:可以修改运行平台及运行模式
2.在coco_eval的228行:可以修改数据集及标签路径
3.在coco_eval的231行:可以修改训练好的ckpt的路径
运行操作过程:
1.得到训练好的ckpt
2.修改运行说明中的参数
3.运行coco_eval.py文件
(运行命令:python coco_eval.py)
目前运行会报错如下:(正在修改)
待完成...
待完成...
待完成...
待完成...
待完善
待完善
待完善
待完善
待完善
待完善
参数 | Ascend 910 |
---|---|
模型版本 | |
资源 | Ascend 910;CPU 2.60GHz,192核;内存 755G;系统 Euler2.8 |
上传日期 | |
MindSpore版本 | 1.2.0 |
数据集 | COCO2017 |
训练参数 | |
优化器 | SGD |
损失函数 | Softmax交叉熵 |
输出 | 概率 |
损失 | |
速度 | |
总时长 | |
参数(M) | |
微调检查点 | |
脚本 |
代码中对数据集进行了随机augmentation操作,其中含有对图片进行旋转、裁剪操作。
待完善
Dear OpenI User
Thank you for your continuous support to the Openl Qizhi Community AI Collaboration Platform. In order to protect your usage rights and ensure network security, we updated the Openl Qizhi Community AI Collaboration Platform Usage Agreement in January 2024. The updated agreement specifies that users are prohibited from using intranet penetration tools. After you click "Agree and continue", you can continue to use our services. Thank you for your cooperation and understanding.
For more agreement content, please refer to the《Openl Qizhi Community AI Collaboration Platform Usage Agreement》