Various tools have been developed so far for object detection tasks. However, there are no standard in annotation tools and formats and developers still write their own json or xml parser of annotation files. annt is an annotation tool that operates in the form of cloud services such as dropbox. annt provides not only simple and comfortable annotation exprience, but also powerful library for loading annotated images.

This is a documentation for python library which read images annotated with annt. you can load annotated images in a simple way and focus on the essential AI development. Also, this library has a basic build-in preprocessing functions. So you can save time to write extra code.


Example 1. Load annotated images

import annt

# annotations is list of annotation data
annotations = annt.load('./Dropbox/app/project_name')

# Display ths information of each annotation file.
for a in annotations:
image = a.image  # opencv2 image array
boxes = a.boxes  # list of bounding boxes

height, width, colors = image.shape  # you can

for box in boxes:
   # Tag information (str)
   print(f'~ tag name : box.tag ~')

   # You can get coordination information of the box by two methods,
   # Left Top Style and Edge Style.
   # Coordination information based on left top of the box. (Left-Top Style)
   print(f'x : {box.x}')
   print(f'y : {box.y}')
   print(f'w : {box.w}')
   print(f'h : {box.h}')

   # Coordination information based on the distance from each edge of the image. (Edge Style)
   print(f'left : {box.left}')
   print(f'right : {box.right}')
   print(f'top : {}')
   print(f'bottom : {box.bottom}')

   # If you change these coordination properties, all of them will recomputed.
   box.w = 300  # This operation will also change box.right property.

Example 2. Data augumentation

import annt
import random

# annotations is list of annotation data
annotations = annt.load('./Dropbox/App/annt/test')
sample_n = 10  # Number of samples from one image

# Display ths information of each annotation file.
augumented = []
for raw_a in annotations:
   for i in range(sample_n):

      # Rotate image
      rot_deg = random.choice([0, 90, 180, 270, 360])
      a = raw_a.rotate(rot_deg)

      # Tilt image
      tilt_deg = random.randint(-8, 8)
      a = a.rotate(tilt_deg)

      # Flip image
      flip_x = random.randint(0, 1)
      flip_y = random.randint(0, 1)
      a = a.flip(flip_x, flip_y)

# Show first augumented image.


Core module of annt-python

This module provides functions related Boudning Box and Annotation information, which are important for handling annotation information.

class Annotation(filename, image, boxes=[])

Image and annotation information holder.

filename: str


image: np.ndarray

Image array in opencv2 format.

boxes: list

List of box.

flip(flip_x=True, flip_y=False)

Flip image. Thie method flip image by the axis given by argument. This method is non-destructive.

  • flip_x (bool, optional) – Whether flip with x axis. Default True.

  • flip_y (bool, optional) – Whether flip with y axis. Default True.


Rotated annotate object.

Return type


resize(width, height)

Resize image to the spcified size. This method is non-destructive.

  • width (int) – width

  • height (int) – height


Resized annotate object.

Return type



Rotate image at the specified angle. Create copy of itself and rotate. This method is non-destructive.


angle (int) – Rotate angle (degree).


Rotated annotate object.

Return type


show(max_width=500, max_height=500)

Display image with annotation information.


Press any key to close image window.

class Box(tag, iwidth, iheight, x, y, w, h)

Bounding box representation.

tag: str

tag of the box.

x: float

Upper-Left x coordination of the bounding box.

y: float

Upper-Left y coordination of the bounding box.

w: float

Width of the bounding box.

h: float

Height of the bounding box.

top: float

Distance from top.

bottom: float

Distance from bottom.

left: float

Distance from left.

right: float

Distance from right.


load annotation files.


dir_path (str) – Annotation directory path.


Annotation – Loaded Annotation object.

Indices and tables