飞机目标检测
- 参考
- 源码notebook,https://github.com/databooks/databook/tree/master/gis/iobjectspy10
- iObjects 10使用,使用SuperMap iObjects for python 10.0
#!/usr/bin/env python3
# coding=utf-8
import os
import time
from iobjectspy.ml.vision import Inference
Using TensorFlow backend.
设置输入数据路径
curr_dir = ''
data_dir = os.path.join(curr_dir, '..','..','example_data')
input_data = os.path.join(data_dir, 'inference/plane_infer.tif')
设置输出数据路径
out_dir = os.path.join(curr_dir, '..','..','out')
out_data = os.path.join(curr_dir, '..','..','out','plane.udbx')
if not os.path.exists(out_dir):
os.makedirs(out_dir)
设置模型路径
model_path = os.path.join(curr_dir, '..','..','model','obj_det_plane','obj_det_plane.sdm')
目标检测类型
category_name = "plane"
基于影像文件进行飞机目标检测
影像文件格式支持 ‘tif’、‘img’(Erdas Image)、'jpg'、'png' 等,目标检测结果为GeoJSON文件,包含目标位置、类型等信息 目标检测类别支持 'plane', 'ship', 'tennis-court', 'vehicle'
"""
影像文件格式支持 ‘tif’、‘img’(Erdas Image)、'jpg'、'png' 等
目标检测结果为GeoJSON文件,包含目标位置、类型等信息
"""
start_time = time.time()
result = Inference(input_data, model_path, out_data=out_data, out_dataset_name='out_plane').object_detect_infer(
category_name, nms_thresh=0.3, score_thresh=0.3)
end_time = time.time()
print('耗时{}s'.format(end_time - start_time))
print('结果为{}'.format(result))
java -cp /home/data/hou/workspaces/iobjectspy/venv/lib/python3.6/site-packages/iobjectspy-10.0.0-py3.6.egg/iobjectspy/_jsuperpy/jars/iobjects-py4j.jar com.supermap.jsuperpy.ApplicationExample 127.0.0.1 51759
[iObjectsPy]: Connection gateway-service successful, Python callback port bind 40351
耗时8.400574445724487s
结果为out_plane_R
注意:本文归作者所有,未经作者允许,不得转载