linux下将结果保存为图片,因为服务器是命令行界面,无法弹出窗口

解决方法来自GitHub:https://github.com/open-mmlab/mmdetection/issues/1405

在这里插入图片描述

The code below can show and save image with result.
import mmcv
import cv2
from mmcv.runner import load_checkpoint
from mmdet.models import build_detector
from mmdet.apis import init_detector, inference_detector, show_result_pyplot
import matplotlib.pyplot as plt

config_file = '/home/en_ro/mmdata/mmdetection/configs/balloon/faster_rcnn_r50_fpn_1x_voc_cat0602.py'
checkpoint_file = '/home/en_ro/mmdetection/work_dirs/faster_rcnn_r50_fpn_1x_voc_cat0602/epoch_100.pth'

model = init_detector(config_file,checkpoint_file)

img = '017-01_0034_o_S017-1_0035.JPG'
result = inference_detector(model,img)

# 这句用来显示的,但是Linux弹出不来的情况下, 就看不到结果,只能保存了看
show_result_pyplot(model, img, result, score_thr=0.6)# show the image with result

# 最主要就是下面这句
model.show_result(img, result, out_file='0617.jpg')# save image with result  
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值