支付宝红包
京东盲盒抽奖
幸运转盘
秒杀
自营热卖
支付宝红包

106_object_detection_infer_plane

花落微凉梦清幽 1年前   阅读数 170 0

3 月,跳不动了?>>>

飞机目标检测

#!/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


注意:本文归作者所有,未经作者允许,不得转载

全部评论: 0

    我有话说: