Base writer
Bases: ABC
Abstract base class for all data writers in DataForge.
This class defines the standard interface for saving processed annotation data into various file formats (such as YOLO .txt or Pascal VOC .xml). Specific writer implementations must provide their own 'write' logic.
Source code in tools/annotation_converter/writer/base.py
6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 | |
__init__()
Initializes the base writer instance.
Source code in tools/annotation_converter/writer/base.py
14 15 16 | |
write(data, file_path)
abstractmethod
Writes data to the specified file path.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
data
|
Union[tuple, list, dict, str]
|
The content to be written (can be a list, dictionary, or string depending on the specific writer). |
required |
file_path
|
Path
|
The target path where the file will be saved. |
required |
Raises:
| Type | Description |
|---|---|
IOError
|
If the file cannot be written to the disk. |
NotImplementedError
|
If the method is not implemented by a subclass. |
Source code in tools/annotation_converter/writer/base.py
19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 | |