11.11大促主会场
新人页面
精选商品
首月0月租体验,领12个月京东PLUS
自营热卖

108_scene_classification_infer_lcz

错过世界遇见你 1年前   阅读数 90 0

3 月,跳不动了?>>>

场景分类预测

# !/usr/bin/env python3
# coding=utf-8
# !/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')
inference_dir = os.path.join(data_dir, 'inference')

设置输出数据路径

out_dir = os.path.join(curr_dir, '..','..','out')
if not os.path.exists(out_dir):
    os.makedirs(out_dir)

设置模型路径

model_path = os.path.join(curr_dir, '..','..','model')
lcz_cls_model = os.path.join(model_path, 'sce_cls_lcz', 'sce_cls_lcz.sdm')

数据模型预测

dom_path = os.path.join(data_dir, 'inference', 'lcz_infer.tif')
out_data = os.path.join(out_dir, 'out_lcz_cls.udb')
out_dataset_name = 'predict_lcz'

start_time = time.time()
result = Inference(input_data=dom_path,
                   model_path=lcz_cls_model,
                   out_data=out_data,
                   out_dataset_name=out_dataset_name).scene_classify_infer(result_type='region')
end_time = time.time()
print('提取完成,共耗时{}s,结果数据保存在 {} 数据源下 {} 数据集中'.format(
    end_time - start_time, out_data, result))
/home/data/hou/workspaces/iobjectspy/venv/lib/python3.6/site-packages/rasterio/__init__.py:216: NotGeoreferencedWarning: Dataset has no geotransform set. The identity matrix may be returned.
  s = DatasetReader(path, driver=driver, sharing=sharing, **kwargs)


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 59829
[iObjectsPy]: Connection gateway-service successful, Python callback port bind 42957

[>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>]100%,2223The scene classification have done!
提取完成,共耗时136.48770475387573s,结果数据保存在 ../../data/out/out_lcz_cls.udb 数据源下 predict_lcz 数据集中


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

全部评论: 0

    我有话说: