pyapi

script

Script

inout

ScriptOutput

Output

Input

pipeline

PipeInfo

pipe_elements

Datasource

AnnoTask

MIATask

SIATask

DataExport

VisualOutput

Loop

model

ImageAnno

TwoDAnno

LabelLeaf

Label

logic.label

LabelTree

dtype

TwoDAnno

class lost.db.dtype.TwoDAnno[source]

Type of a TwoDAnno

BBOX

A BBox.

Type:1
POLYGON

A Polygon.

Type:2
POINT

A Point.

Type:3
LINE

A Line.

Type:4
CIRCLE

A Circle.

Type:5

util methods

anno_helper

blacklist

A helper module to deal with blacklists.

class lost.pyapi.utils.blacklist.ImgBlacklist(my_script, name='img-blacklist.json', context='pipe')[source]

A class to deal with image blacklists.

Such blacklists are often used for annotation loops, in order to prevent annotating the same image multiple times.

my_script

The script instance that creates this blacklist.

Type:lost.pyapi.script.Script
name

The name of the blacklist file.

Type:str
context

Options: instance, pipe, static

Type:str

Example

Add images to blacklist.

>>> blacklist = ImgBlacklist(self, name='blacklist.json')
>>> blacklist.add(['path/to/img0.jpg'])
>>> balcklist.save()

Load a blacklist and check if a certain image is already in list.

>>> blacklist = ImgBlacklist(self, name='blacklist.json')
>>> blacklist.contains('path/to/img0.jpg')
True
>>> blacklist.contains('path/to/img1.jpg')
False

Get list of images that are not part of the blacklist

>>> blacklist.get_whitelist(['path/to/img0.jpg', 'path/to/img1.jpg', 'path/to/img2.jpg'])
['path/to/img1.jpg', 'path/to/img2.jpg']

Add images to the blacklist

>>> blacklist.add(['path/to/img1.jpg', 'path/to/img2.jpg'])
add(imgs)[source]

Add a list of images to blacklist.

Parameters:imgs (list) – A list of image identifiers that should be added to the blacklist.
contains(img)[source]

Check if blacklist contains a spcific image

Parameters:img (str) – The image identifier
Returns:True if img in blacklist, False if not.
Return type:bool
delete_blacklist()[source]

Remove blacklist from filesystem

get_whitelist(img_list, n='all')[source]

Get a list of images that are not part of the blacklist.

Parameters:
  • img_list (list of str) – A list of images where should be checked if they are in the blacklist
  • n ('all' or 'int') – The maximum number of images that should be returned.
Returns:

A list of images that are not in the blacklist.

Return type:

list of str

remove_item(item)[source]

Remove item from blacklist

Parameters:item (str) – The item/ image to remove from blacklist.
save()[source]

Write blacklist to filesystem

vis