Skip to main content

Extract bounding boxes from XML format to list

Project description

xml2arr

Extract bounding boxes from XML format.

Instalation

pip install xml2arr

Usage

from xml2arr import extract, extract_to_file

XML_PATH = "/path/to/xml/exmaple.xml"

# Result as a python list
result = extract(XML_PATH)

# Saved to output file
OUT_PATH = "/path/to/output"
extract_to_file(XML_PATH, OUT_PATH)

Input

XML structure:

<annotation>
	<folder>painted_nails</folder>
	<filename>n3.png</filename>
	<path>C:/Users/username/img/n3.png</path>
	<source>
		<database>Unknown</database>
	</source>
	<size>
		<width>0</width>
		<height>0</height>
		<depth>3</depth>
	</size>
	<segmented>0</segmented>
	<object>
		<name>no</name>
		<pose>Unspecified</pose>
		<truncated>0</truncated>
		<difficult>0</difficult>
		<bndbox>
			<xmin>46</xmin>
			<ymin>294</ymin>
			<xmax>354</xmax>
			<ymax>718</ymax>
		</bndbox>
	</object>
<annotation>

Output

Expected output, can be saved to file or returned as a list:

[[46, 294, 354, 718]]

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

xml2arr-0.1.4.tar.gz (6.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

xml2arr-0.1.4-py3-none-any.whl (6.5 kB view details)

Uploaded Python 3

File details

Details for the file xml2arr-0.1.4.tar.gz.

File metadata

  • Download URL: xml2arr-0.1.4.tar.gz
  • Upload date:
  • Size: 6.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.3

File hashes

Hashes for xml2arr-0.1.4.tar.gz
Algorithm Hash digest
SHA256 035c6d8326630e175bb4ed23d9c5a951716b08e53a9f3b99d956e4a117cecbc3
MD5 765a2e1a887558337d99057862e7d34e
BLAKE2b-256 cb2160327dbd6bbeb2654948c7b06ccf6bcdc8bbebbede8dff40e7e8ba7a7cd9

See more details on using hashes here.

File details

Details for the file xml2arr-0.1.4-py3-none-any.whl.

File metadata

  • Download URL: xml2arr-0.1.4-py3-none-any.whl
  • Upload date:
  • Size: 6.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.3

File hashes

Hashes for xml2arr-0.1.4-py3-none-any.whl
Algorithm Hash digest
SHA256 9d59b23378c8da617442d6826c7c4011771470b3c3094dc5cc6c77ec999e1c11
MD5 b572faf47bdb11f6a6a3a928e01160e5
BLAKE2b-256 217d736fc391b5474632153137f9da1e49075569c1f3967470ad4a366ede267d

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page