Base Converter
Bases: ABC
Base converter class. Based on the source and destination formats, defines reader and writer classes for processing data, defines default source and destination annotation file suffixes
Source code in tools/annotation_converter/converter/base.py
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 | |
reader
property
writable
BaseReader: returns a reader for the annotation file.
writer
property
writable
BaseWriter: returns a writer for the annotation filetype.
__init__(source_format, dest_format, log_level=LevelMapping.debug, log_path=None, **kwargs)
Initialize the converter class.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
source_format
|
str
|
The format of source annotation (e.g., 'yolo'). |
required |
dest_format
|
str
|
The format of output annotations (e.g., 'voc'). |
required |
log_level
|
str
|
(str): The lowest logging level print to (e.g., 'debug'). |
debug
|
**kwargs
|
dict
|
Additional parameters like 'img_path' or 'labels_path'. |
{}
|
Source code in tools/annotation_converter/converter/base.py
21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 | |
convert(file_paths, target_path, n_jobs=1)
abstractmethod
Abstract method to convert source annotation file to destination annotation file by running custom workers in subclasses
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
file_paths
|
Tuple[Path]
|
List of paths to the annotation files. |
required |
target_path
|
Path
|
Directory where converted files will be stored. |
required |
n_jobs
|
int
|
Number of parallel workers to use. Defaults to 1. |
1
|
Source code in tools/annotation_converter/converter/base.py
65 66 67 68 69 70 71 72 73 74 75 76 | |