diff --git a/cvat/apps/documentation/user_guide.md b/cvat/apps/documentation/user_guide.md index 05c74b191d55..3fe1defd005d 100644 --- a/cvat/apps/documentation/user_guide.md +++ b/cvat/apps/documentation/user_guide.md @@ -217,7 +217,7 @@ Usage examples: ![](static/documentation/images/image028.jpg) -3. The annotation will be written into **.xml** file. To find the annotation file go to the directory where your browser saves downloaded files by default. For more information visit [.xml format page](./documentation/xml_format.html). +3. The annotation will be written into **.xml** file. To find the annotation file go to the directory where your browser saves downloaded files by default. For more information visit [.xml format page](/documentation/xml_format.html). ![](static/documentation/images/image029.jpg) diff --git a/cvat/apps/documentation/xml_format.md b/cvat/apps/documentation/xml_format.md index a3506f07a9e9..6257ea66c0b6 100644 --- a/cvat/apps/documentation/xml_format.md +++ b/cvat/apps/documentation/xml_format.md @@ -2,6 +2,255 @@ When you want to download annotations from Computer Vision Annotation Tool (CVAT) you can choose one of several data formats. The document describes XML annotation format. Each format has X.Y version (e.g. 1.0). In general the major version (X) is incremented then the data format has incompatible changes and the minor version (Y) is incremented then the data format is slightly modified (e.g. it has one or several extra fields inside meta information). The document will describe all changes for all versions of XML annotation format. +## Version 1.1 + +There are two different formats for annotation and interpolation modes at the moment. Both formats has a common part which is described below. From previous version `flipped` tag was added. Also `original_size` tag was added for interpolation mode to specify frame size. In annotation mode each image tag has `width` and `height` attributes for the same purpose. + +```xml + + + 1.1 + + + Number: id of the task + String: some task name + Number: count of frames/images in the task + String: interpolation or annotation + Number: number of overlaped frames between segments + String: URL on an page which describe the task + Boolean: were images of the task flipped? (True/False) + String: date when the task was created + String: date when the task was updated + + + + + + Number: id of the segment + Number: first frame + Number: last frame + String: URL (e.g. http://cvat.example.com/?id=213) + + + + String: the author of the task + String: email of the author + + + Number: frame width + Number: frame height + + + String: date when the annotation was dumped + + ... + +``` + +### Annotation +Below you can find description of the data format for annotation mode. In the mode images are annotated. On each image it is possible to have many different objects. Each object can have multiple attributes. If an annotation task has been +created with `z_order` flag then each object will have `z_order` attribute which is used to draw objects properly when they are intersected (if `z_order` is bigger the object is closer to camera). In previous version of the format only `box` shape was available. In the release `polygon`, `polyline`, and `points` were added. Please see below for more details: + +```xml + + + ... + + + String: the attribute value + ... + + + String: the attribute value + ... + + + String: the attribute value + ... + + + String: the attribute value + ... + + + String: the attribute value + ... + + ... + + ... + +``` + +Example: +```xml + + + 1.1 + + + 4 + segmentation + 27 + annotation + 0 + + False + 2018-09-25 11:34:24.617558+03:00 + 2018-09-25 11:38:27.301183+03:00 + + + + + + + + + 4 + 0 + 26 + http://localhost:8080/?id=4 + + + + admin + + + + 2018-09-25 11:38:28.799808+03:00 + + + + + + + + + + + + + + +``` + +### Interpolation +Below you can find description of the data format for interpolation mode. In the mode frames are annotated. The annotation contains tracks. Each track corresponds to an object which can be presented on multiple frames. The same object cannot be presented on the same frame in multiple locations. Each location of the object can have multiple attributes even if an attribute is immutable for the object it will be cloned for each location (a known redundancy). + +```xml + + + ... + + + String: the attribute value + ... + + + String: the attribute value + + + String: the attribute value + + + String: the attribute value + + ... + + ... + +``` + +Example: +```xml + + + 1.1 + + + 5 + interpolation + 4620 + interpolation + 5 + + False + 2018-09-25 12:32:09.868194+03:00 + 2018-09-25 16:05:05.619841+03:00 + + + + + + + 5 + 0 + 4619 + http://localhost:8080/?id=5 + + + + admin + + + + 640 + 480 + + + 2018-09-25 16:05:07.134046+03:00 + + + + + + + + + + + + + + + + +``` + ## Version 1 There are two different formats for annotation and interpolation modes at the moment. Both formats has a common part which is described below: @@ -9,7 +258,7 @@ There are two different formats for annotation and interpolation modes at the mo ```xml - String: version of the format (e.g 1.0) + 1.0 Number: id of the task @@ -131,6 +380,7 @@ Example: ### Interpolation Below you can find description of the data format for interpolation mode. In the mode frames are annotated. The annotation contains tracks. Each track corresponds to an object which can be presented on multiple frames. The same object cannot be presented on the same frame in multiple locations. Each location of the object can have multiple attributes even if an attribute is immutable for the object it will be cloned for each location (a known redundancy). + ```xml diff --git a/cvat/apps/engine/annotation.py b/cvat/apps/engine/annotation.py index f6c283767a6a..35265cb01936 100644 --- a/cvat/apps/engine/annotation.py +++ b/cvat/apps/engine/annotation.py @@ -1282,7 +1282,7 @@ def close_root(self): class _XmlAnnotationWriter(_AnnotationWriter): def __init__(self, file): - super().__init__(file, "1.0") + super().__init__(file, "1.1") self.xmlgen = XMLGenerator(self.file, 'utf-8') self._level = 0