kwcoco.kw18 module

A helper for converting COCO to / from KW18 format.

class kwcoco.kw18.KW18(data)[source]

Bases: kwarray.dataframe_light.DataFrameArray

A DataFrame like object that stores KW18 column data

Example

>>> import kwcoco
>>> from kwcoco.kw18 import KW18
>>> coco_dset = kwcoco.CocoDataset.demo('shapes')
>>> kw18_dset = KW18.from_coco(coco_dset)
>>> print(kw18_dset.pandas())
DEFAULT_COLUMNS = ['track_id', 'track_length', 'frame_number', 'tracking_plane_loc_x', 'tracking_plane_loc_y', 'velocity_x', 'velocity_y', 'image_loc_x', 'image_loc_y', 'img_bbox_tl_x', 'img_bbox_tl_y', 'img_bbox_br_x', 'img_bbox_br_y', 'area', 'world_loc_x', 'world_loc_y', 'world_loc_z', 'timestamp', 'confidence', 'object_type_id', 'activity_type_id']
classmethod demo()[source]
classmethod from_coco(coco_dset)[source]
to_coco()[source]

Translates a kw18 files to a CocoDataset.

Note

kw18 does not contain complete information, and as such the returned coco dataset may need to be augmented.

Todo

  • [ ] allow kwargs to specify path to frames / videos

Example

>>> from kwcoco.kw18 import KW18
>>> self = KW18.demo()
>>> self.to_coco()
classmethod load(file)[source]
classmethod loads(text)[source]

Example

>>> self = KW18.demo()
>>> text = self.dumps()
>>> self2 = KW18.loads(text)
>>> empty = KW18.loads('')
dump(file)[source]
dumps()[source]

Example

>>> self = KW18.demo()
>>> text = self.dumps()
>>> print(text)