跳转到主要内容

DroneBase ML工程师常用函数集合

项目描述

AI/ML Python包: ml_dronebase_data_utils

此包包含Zeitview(前身为DroneBase)AI/ML团队常用的数据函数。

此存储库提供:

  • 自定义Python包: ml_dronebase_data_utils

贡献指南

有关如何通过Pull-Requests向此存储库贡献的详细信息,请参阅CONTRIBUTING.md文档。

使用方法

import ml_dronebase_data_utils as data_utils
...

目标检测注释格式化

此包提供Pascal VOC编写器,用于渲染目标检测任务的*.xml注释文件。它支持常规对象检测和定向对象检测注释,并具有额外的<angle>some angle</angle>参数。

from ml_dronebase_data_utils import PascalVOCWriter
writer = PascalVOCWriter()

for box in boxes:
    xmin, ymin, xmax, ymax, angle = box
    writer.addObject(
        name="some class name",
        xmin=xmin,
        ymin=ymin,
        xmax=xmax,
        ymax=ymax,
        angle=angle # Optional parameter
    )
writer.save(annotation_path)

此包还提供相同的CLI接口,

convert_geojson可用于将geojson转换为voc格式。它还具有批量处理的能力。

usage: convert_geojson [-h] --ortho-path ORTHO_PATH --geojson GEOJSON 
                       --save-path SAVE_PATH 
                      [--class-attribute CLASS_ATTRIBUTE[CLASS_ATTRIBUTE ...]]
                      [--class-mapping CLASS_MAPPING]
                      [--skip-classes SKIP_CLASSES [SKIP_CLASSES ...]] 
                      [--rotated] [--batch] [--prefix PREFIX]

Convert geojson to voc format data

optional arguments:
  -h, --help            show this help message and exit
  --ortho-path ORTHO_PATH
                        The ortho path, can be local/s3
  --geojson GEOJSON     The geojson path
  --save-path SAVE_PATH
                        The save path
  --class-attribute CLASS_ATTRIBUTE [CLASS_ATTRIBUTE ...]
                        The class attribute to use from the geojson for class labels
  --class-mapping CLASS_MAPPING
                        A plain txt file containing class mappings
  --skip-classes SKIP_CLASSES [SKIP_CLASSES ...]
                        Classes to skip, specify multiple
  --rotated             Use rotated bounding box, defaults to false
  --batch               Process a batch of orthos
  --prefix PREFIX       The prefix to use when saving the annotation

示例,

convert_geojson --ortho-path s3://ml-solar-ortho-fault-detection/orthos/tiff/PA140004_Thermal.tif --geojson s3://ml-solar-ortho-fault-detection/orthos/geojson/PA140004_Thermal.geojson --save-path s3://ml-solar-ortho-fault-detection/orthos/annotations/PA140004_Thermal.xml --class-attribute id --skip-classes 0 4 5 6 7 8 9 10 --class-mapping mapping.txt

mapping.txt必须包含以下格式的映射:0 = Normal

visualize_converted_geojson可用于可视化生成的注释。它还具有批量处理的能力。

usage: visualize_converted_geojson [-h] --ortho-path ORTHO_PATH --anno-path
                                   ANNO_PATH --save-path SAVE_PATH
                                   [--draw-labels] [--batch]

Visualize converted geojson for quick visual inspection

optional arguments:
  -h, --help            show this help message and exit
  --ortho-path ORTHO_PATH, -o ORTHO_PATH
                        The ortho path, can be local/s3
  --anno-path ANNO_PATH, -a ANNO_PATH
                        The ortho path, can be local/s3
  --save-path SAVE_PATH, -s SAVE_PATH
                        The ortho path, can be local/s3
  --draw-labels, -d     Draw the class labels
  --batch, -b           Run in batched mode

示例,

visualize_converted_geojson -o s3://ml-solar-ortho-fault-detection/orthos/tiff/PA140004_Thermal.tif -a s3://ml-solar-ortho-fault-detection/orthos/annotations/PA140004_Thermal.xml -s s3://ml-solar-ortho-fault-detection/orthos/visual_validation/PA140004_Thermal_drawn.png -d

S3数据工具

此包还提供常见的AWS S3数据函数,如下载数据、上传数据(数据或训练模型)、训练/测试拆分等。

从源安装

克隆此存储库并进入根目录,然后运行以下命令

pip install -e .

使用pip安装

pip install ml-dronebase-data-utils

参考文献

项目详情


下载文件

下载适用于您平台的文件。如果您不确定该选择哪一个,请了解有关安装包的更多信息。

源代码分发

ml-dronebase-data-utils-0.4.0.tar.gz (22.9 kB 查看哈希值)

上传时间 源代码

构建分发

ml_dronebase_data_utils-0.4.0-py2.py3-none-any.whl (25.2 kB 查看哈希值)

上传时间 Python 2 Python 3

支持