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.3.tar.gz (6.3 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.3-py3-none-any.whl (6.6 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: xml2arr-0.1.3.tar.gz
  • Upload date:
  • Size: 6.3 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.3.tar.gz
Algorithm Hash digest
SHA256 4da0d2d893b164b3deb0be1f0ad86555b13690998ae7921c690651f39b01e91c
MD5 677d647cd6a59158f826b74472002f4d
BLAKE2b-256 c312811789461d693f3d3ec4ebd178eedb825293a135d9ba506cfd7d46abdc64

See more details on using hashes here.

File details

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

File metadata

  • Download URL: xml2arr-0.1.3-py3-none-any.whl
  • Upload date:
  • Size: 6.6 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.3-py3-none-any.whl
Algorithm Hash digest
SHA256 0ae9918982b6f409058738595d4901c9d493ee170a35f0e5070783f0b1f60637
MD5 f13932a5c0b44d0e0925a8608081df76
BLAKE2b-256 c5b982c6ffe0336606a99598dcb0877a3b09f72a18008708f8bfbedc45c47dee

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