18 from typing
import Final
20 from .base_converter
import ConverterProcessorType, BaseConverter
21 from .converters
import *
26 Factory class used to create different types
27 of BaseConverter objects based on the convertProcessorType
32 convertProcessorType : ConverterProcessorType
33 type of converter for convertin dataset
36 def __init__(self, convertProcessorType: ConverterProcessorType):
37 self.
typetype: Final = convertProcessorType
39 def create(self, datasetName: str, projectId: int, datasetPath: str) -> BaseConverter:
41 Creates BaseConverter based on the convertProcessorType
55 Appropriate BaseConverter object based on
59 if self.
typetype == ConverterProcessorType.coco:
60 return COCOConverter(datasetName, projectId, datasetPath)
62 if self.
typetype == ConverterProcessorType.yolo:
63 return YoloConverter(datasetName, projectId, datasetPath)
65 if self.
typetype == ConverterProcessorType.createML:
66 return CreateMLConverter(datasetName, projectId, datasetPath)
68 if self.
typetype == ConverterProcessorType.voc:
69 return VOCConverter(datasetName, projectId, datasetPath)
71 if self.
typetype == ConverterProcessorType.labelMe:
72 return LabelMeConverter(datasetName, projectId, datasetPath)
74 if self.
typetype == ConverterProcessorType.pascalSeg:
75 return PascalSegConverter(datasetName, projectId, datasetPath)
77 if self.
typetype == ConverterProcessorType.humanSegmentation:
78 return HumanSegmentationConverter(datasetName, projectId, datasetPath)
80 if self.
typetype == ConverterProcessorType.cityScape:
81 return CityScapeConverter(datasetName, projectId, datasetPath)
BaseConverter create(self, str datasetName, int projectId, str datasetPath)