本文主要是介绍【语义分割】——FCN测试,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
项目: 采用mmsegmentation
下载预训练的模型: from fcn
硬件条件
- 1070单卡(8GB)
- cuda10.1,cudnn7.6.3
1. 测试
配置好相关的环境后,采用官方的测试demo脚本。get_start
from mmseg.apis import inference_segmentor, init_segmentor
import mmcvconfig_file = 'configs/pspnet/pspnet_r50-d8_512x1024_40k_cityscapes.py'
checkpoint_file = 'checkpoints/pspnet_r50-d8_512x1024_40k_cityscapes_20200605_003338-2966598c.pth'# build the model from a config file and a checkpoint file
model = init_segmentor(config_file, checkpoint_file, device='cuda:0')# test a single image and show the results
img = 'test.jpg' # or img = mmcv.imread(img), which will only load it once
result = inference_segmentor(model, img)
# visualize the results in a new window
model.show_result(img, result, show=True)
# or save the visualization results to image files
model.show_result(img, result, out_file='result.jpg')# test a video and show the results
video = mmcv.VideoReader('video.mp4')
for frame in video:result = inference_segmentor(model, frame)model.show_result(frame, result, wait_time=1)
- 视频测试源:MOT-16
2. 速度/可视化结果
Cityscapes
Method | Backbone | total_iters | Crop Size | Inf time (fps) |
---|---|---|---|---|
FCN | R-50-D8 | 40k | 512×1024 | 1.431 |
ADE20K
Method | Backbone | total_iters | Crop Size | Inf time (fps) |
---|---|---|---|---|
FCN | R-50-D8 | 80k | 512×512 | 4.371 |
Pascal VOC 2012 + Aug
Method | Backbone | total_iters | Crop Size | Inf time (fps) |
---|---|---|---|---|
FCN | R-50-D8 | 20k | 512×512 | 5.214 |
总结
- 同样的模型,对比来说,使用最后一个数据集训练的效果是最好的。分割效果+干扰。
other
- 原理+训练
这篇关于【语义分割】——FCN测试的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!