XML_Augment
Overview
XML_Augment is a Python library for augmenting images and their corresponding XML annotations, typically used in object detection and image segmentation tasks. It includes functionalities for visualizing annotations, brightening images, translating images, and rotating images while updating the XML annotations accordingly.
Features
- Visualize Annotations: Display the annotated polygons and bounding boxes on the image.
- Brighten Images: Randomly adjust the brightness of the image.
- Translate Images: Randomly translate (shift) the image and update the annotations.
- Rotate Images: Randomly rotate the image and update the annotations.[ROTATION NOT SUPPORTED YET VERSION<=0.0.2]
Installation
To use this project, ensure you have the following libraries installed:
pip install xml_augmenter
Usage
Requirements
- Python 3.x
- OpenCV
- NumPy
Example
Import necessary libraries
import cv2 as cv
import xml.etree.ElementTree as ET
import numpy as np
Define the path to your image and XML annotation file
impath = "path/to/your/image.jpg"
anpath = "path/to/your/annotations.xml"
Create an instance of XML_Augment
xa = XML_Augment(anpath, impath)
Visualize annotations with custom text size
xa.visualize_annotaitons(text_size=0.3)
Apply translation augmentation with a maximum translation percent
xa.translate(0.2)
Apply brightness augmentation with a maximum brightness value
xa.brighten(100)
Apply rotation augmentation with a maximum rotation offset [ROTATION NOT SUPPORTED AS OF VERSION 0.0.2]
xa.rotate(45)
Visualize annotations again after augmentations
xa.visualize_annotaitons(text_size=0.3)
Show the final image with augmentations
cv.imshow('image', xa.image)
cv.waitKey()
cv.destroyAllWindows()
Metadata
Release files for xml-augmenter 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| xml_augmenter-0.1.0.tar.gz | 5.4 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| xml_augmenter-0.1.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 11.2 kB
Release files / xml_augmenter-0.1.0.tar.gz
| Download URL | xml_augmenter-0.1.0.tar.gz |
|---|---|
| Size | 5.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
dff89a3c05cb1c1d922ff453b56e2e6530ff88601de75de0ee5388899ebcd8db
|
|
BLAKE2b-256 checksum How to use checksums |
1867a1dac240040d035b244d6f402cc3ec5a3c6313db89f70a06126700555f7e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.1.1 CPython/3.9.19
|
Release files / xml_augmenter-0.1.0-py3-none-any.whl
| Download URL | xml_augmenter-0.1.0-py3-none-any.whl |
|---|---|
| Size | 5.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
c60d0ba675d11ed20da89116eef6a775b97bbaf3ea5928e15fbbd32b10a164de
|
|
BLAKE2b-256 checksum How to use checksums |
001ec008f0a9c66aee01ddbaa1694ca6c7d9976223623b0a5090909232da63af
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.1.1 CPython/3.9.19
|