Ejemplo n.º 1
0
    def __init__(self, project, config, dbConnector, fileServer, options):
        super(TridentNet, self).__init__(project, config, dbConnector,
                                         fileServer, options)

        try:
            # check options
            if self.detectron2cfg.MODEL.META_ARCHITECTURE != 'GeneralizedRCNN':
                raise Exception(
                    f'Invalid meta architecture ("{self.detectron2cfg.MODEL.META_ARCHITECTURE}" != "GeneralizedRCNN")'
                )
            if self.detectron2cfg.MODEL.ROI_HEADS.NAME != 'TridentRes5ROIHeads':
                raise Exception(
                    f'Invalid ROI head architecture ("{self.detectron2cfg.MODEL.ROI_HEADS.NAME}" != "TridentRes5ROIHeads")'
                )
            if self.detectron2cfg.MODEL.PROPOSAL_GENERATOR.NAME != 'TridentRPN':
                raise Exception(
                    f'Invalid proposal generator ("{self.detectron2cfg.MODEL.PROPOSAL_GENERATOR.NAME}" != "TridentRPN")'
                )
            assert hasattr(self.detectron2cfg.MODEL,
                           'TRIDENT'), 'Missing "TRIDENT" option'
        except Exception as e:
            print(
                f'[{self.project}] WARNING: provided options are not valid for TridentNet (message: "{str(e)}"); falling back to defaults.'
            )
            self.options = self.getDefaultOptions()
            self.detectron2cfg = self._get_config()
            self.detectron2cfg = GenericDetectron2Model.parse_aide_config(
                self.options, self.detectron2cfg)
Ejemplo n.º 2
0
 def getDefaultOptions(cls):
     opts = GenericDetectron2Model._load_default_options(
         'config/ai/model/detectron2/labels/mobilenetv2.json',
         DEFAULT_OPTIONS
     )
     opts['defs']['model'] = 'labels/mobilenet_v2_ImageNet.yaml'
     return opts
    def __init__(self, project, config, dbConnector, fileServer, options):
        super(RetinaNet, self).__init__(project, config, dbConnector, fileServer, options)

        try:
            if self.detectron2cfg.MODEL.META_ARCHITECTURE != 'RetinaNet':
                # invalid options provided
                raise Exception('Invalid model architecture')
        except:
            print('WARNING: provided options are not valid for RetinaNet; falling back to defaults.')
            self.options = self.getDefaultOptions()
            self.detectron2cfg = self._get_config()
            self.detectron2cfg = GenericDetectron2Model.parse_aide_config(self.options, self.detectron2cfg)
    def __init__(self, project, config, dbConnector, fileServer, options):
        super(GeneralizedTorchvisionClassifier,
              self).__init__(project, config, dbConnector, fileServer, options)

        try:
            if self.detectron2cfg.MODEL.META_ARCHITECTURE != 'TorchvisionClassifier':
                # invalid options provided
                raise Exception('Invalid model meta architecture')
        except:
            print(
                f'[{self.project}] WARNING: provided options are not valid for the Torchvision classifier model; falling back to defaults.'
            )
            self.options = self.getDefaultOptions()
            self.detectron2cfg = self._get_config()
            self.detectron2cfg = GenericDetectron2Model.parse_aide_config(
                self.options, self.detectron2cfg)
    def __init__(self, project, config, dbConnector, fileServer, options):
        super(FasterRCNN, self).__init__(project, config, dbConnector,
                                         fileServer, options)

        try:
            if self.detectron2cfg.MODEL.META_ARCHITECTURE != 'GeneralizedRCNN':
                # invalid options provided
                raise Exception(
                    f'Invalid meta architecture ("{self.detectron2cfg.MODEL.META_ARCHITECTURE}" != "GeneralizedRCNN")'
                )
        except Exception as e:
            print(
                f'[{self.project}] WARNING: provided options are not valid for Faster R-CNN (message: "{str(e)}"); falling back to defaults.'
            )
            self.options = self.getDefaultOptions()
            self.detectron2cfg = self._get_config()
            self.detectron2cfg = GenericDetectron2Model.parse_aide_config(
                self.options, self.detectron2cfg)

        #TODO: Faster R-CNN currently does not work with empty images
        self.detectron2cfg.DATALOADER.FILTER_EMPTY_ANNOTATIONS = True
Ejemplo n.º 6
0
 def getDefaultOptions(cls):
     return GenericDetectron2Model._load_default_options(
         'config/ai/model/detectron2/boundingBoxes/tridentnet.json',
         DEFAULT_OPTIONS)
 def getDefaultOptions(cls):
     return GenericDetectron2Model._load_default_options(
         'config/ai/model/detectron2/segmentationMasks/deeplabv3plus.json',
         DEFAULT_OPTIONS
     )