Esempio n. 1
0
    def __init__(self, name, param):
        dataprocess.C2dImageTask.__init__(self, name)

        # Create parameters class
        if param is None:
            self.setParam(PointRendParam())
        else:
            self.setParam(copy.deepcopy(param))

        self.threshold = 0.5
        self.MODEL_NAME_CONFIG = "pointrend_rcnn_R_50_FPN_3x_coco"
        self.MODEL_NAME = "model_final_3c3198"
        self.path_to_config = "/PointRend_git/configs/InstanceSegmentation/" + self.MODEL_NAME_CONFIG + ".yaml"
        self.path_to_model = "/models/" + self.MODEL_NAME + ".pkl"
        self.folder = os.path.dirname(os.path.realpath(__file__))
        self.cfg = get_cfg()
        add_pointrend_config(self.cfg)
        self.cfg.merge_from_file(self.folder + self.path_to_config)
        self.cfg.MODEL.ROI_HEADS.SCORE_THRESH_TEST = self.threshold
        self.cfg.MODEL.WEIGHTS = self.folder + self.path_to_model
        self.loaded = False
        self.deviceFrom = ""

        # add output + set data type
        self.setOutputDataType(core.IODataType.IMAGE_LABEL, 0)
        self.addOutput(dataprocess.CImageIO(core.IODataType.IMAGE))
        self.addOutput(dataprocess.CGraphicsOutput())
Esempio n. 2
0
    def __init__(self, name, param):
        dataprocess.C2dImageTask.__init__(self, name)

        # Create parameters class
        if param is None:
            self.setParam(MorphoSnakesParam())
        else:
            self.setParam(copy.deepcopy(param))

        # add input -> initial level set
        self.addInput(dataprocess.CImageIO())

        # add output -> results image
        self.addOutput(dataprocess.CImageIO())

        # set color mask
        self.setOutputColorMap(1, 0, [[255, 0, 0]])
Esempio n. 3
0
    def __init__(self, name, param):
        dataprocess.C2dImageTask.__init__(self, name)

        # add output + set data type
        self.setOutputDataType(core.IODataType.IMAGE_LABEL, 0)
        self.addOutput(dataprocess.CImageIO(core.IODataType.IMAGE))
        self.addOutput(dataprocess.CImageIO(core.IODataType.IMAGE))
        self.model = None
        self.cfg = None
        self.colors = None
        self.dataset = ""
        self.update = False
        self.classes = None
        # Create parameters class
        if param is None:
            self.setParam(Deeplabv3plusParam())
        else:
            self.setParam(copy.deepcopy(param))
Esempio n. 4
0
    def __init__(self, name, param):
        dataprocess.C2dImageTask.__init__(self, name)
        self.net = None
        # Add input_img/output of the process here
        self.addOutput(dataprocess.CImageIO())

        # Create parameters class
        if param is None:
            self.setParam(NeuralStyleTransferParam())
        else:
            self.setParam(copy.deepcopy(param))
Esempio n. 5
0
    def __init__(self, name, param):
        dataprocess.CVideoTask.__init__(self, name)
        # Add input/output of the process here
        # Set this variable to True if you want to work with the raw Optical Flow (vector field)
        self.rawOutput = False
        if self.rawOutput:
            self.addOutput(dataprocess.CImageIO())

        self.frame_1 = None
        # Create parameters class
        if param is None:
            self.setParam(RaftOpticalFlowParam())
        else:
            self.setParam(copy.deepcopy(param))
    def __init__(self, name, param):
        dataprocess.C2dImageTask.__init__(self, name)
        if param is None:
            self.setParam(MaskRcnnParam())
        else:
            self.setParam(copy.deepcopy(param))

        # get and set config model
        self.threshold = 0.5
        self.cfg = None
        self.model_link = "COCO-InstanceSegmentation/mask_rcnn_X_101_32x8d_FPN_3x.yaml"
        self.predictor = None

        # add output + set data type
        self.setOutputDataType(core.IODataType.IMAGE_LABEL, 0)
        self.addOutput(dataprocess.CImageIO(core.IODataType.IMAGE))
        self.addOutput(dataprocess.CGraphicsOutput())
    def __init__(self, name, param):
        dataprocess.C2dImageTask.__init__(self, name)
        self.model = None
        self.class_names = []
        # Detect if we have a GPU available
        self.device = torch.device("cuda:0" if torch.cuda.is_available() else "cpu")
        # Remove graphics input
        self.removeInput(1)
        # Segmentation mask output
        self.setOutputDataType(core.IODataType.IMAGE_LABEL, 0)
        # Result image
        self.addOutput(dataprocess.CImageIO(core.IODataType.IMAGE))
        # Add graphics output
        self.addOutput(dataprocess.CGraphicsOutput())
        # Add numeric output
        self.addOutput(dataprocess.CNumericIO())

        # Create parameters class
        if param is None:
            self.setParam(MaskRcnnParam())
        else:
            self.setParam(copy.deepcopy(param))
Esempio n. 8
0
    def __init__(self, name, param):
        dataprocess.C2dImageTask.__init__(self, name)

        # Add input/output of the process here
        self.setOutputDataType(core.IODataType.IMAGE_LABEL, 0)
        self.addOutput(dataprocess.CImageIO(core.IODataType.IMAGE))
        # Add graphics output
        self.addOutput(dataprocess.CGraphicsOutput())
        self.net = None
        self.class_names = []

        # Create parameters class
        if param is None:
            self.setParam(InferYolactParam())
        else:
            self.setParam(copy.deepcopy(param))

        # Load class names
        model_folder = os.path.dirname(os.path.realpath(__file__)) + "/models"
        with open(model_folder + "/Coco_names.txt") as f:
            for row in f:
                self.class_names.append(row[:-1])
Esempio n. 9
0
    def __init__(self, name, param):
        dataprocess.C2dImageTask.__init__(self, name)

        # Create parameters class
        if param is None:
            self.setParam(PanopticFpnParam())
        else:
            self.setParam(copy.deepcopy(param))

        # get and set config model
        self.LINK_MODEL = "COCO-PanopticSegmentation/panoptic_fpn_R_101_3x.yaml"
        self.cfg = get_cfg()
        self.threshold = 0.5
        self.cfg.MODEL.ROI_HEADS.SCORE_THRESH_TEST = self.threshold
        self.cfg.merge_from_file(model_zoo.get_config_file(
            self.LINK_MODEL))  # load config from file(.yaml)
        self.cfg.MODEL.WEIGHTS = model_zoo.get_checkpoint_url(
            self.LINK_MODEL)  # download the model (.pkl)
        self.loaded = False
        self.deviceFrom = ""

        # add outputs
        self.addOutput(dataprocess.CImageIO())
        self.addOutput(dataprocess.CGraphicsOutput())