Example #1
0
    def __init__(self, conf):
        logger.debug(' ----- ' + self.__class__.__name__ + ' init')

        KwiverProcess.__init__(self, conf)

        camtrawl_setup_config(self, ctalgo.FishStereoMeasurments.default_params())

        self.add_config_trait('output_fpath', 'output_fpath', 'camtrawl_out.csv',
                              'output file to write detection measurements')
        self.declare_config_using_trait('output_fpath')
        self.add_config_trait('cal_fpath', 'cal_fpath', 'cal_201608.mat',
                              'matlab or npz file with calibration info')
        self.declare_config_using_trait('cal_fpath')

        # optional = process.PortFlags()
        required = process.PortFlags()
        required.add(self.flag_required)

        # self.add_port_trait('camera' + '1', 'camera', 'Left camera calibration')
        # self.add_port_trait('camera' + '2', 'camera', 'Right camera calibration')
        self.add_port_trait('detected_object_set' + '1', 'detected_object_set', 'Detections from camera1')
        self.add_port_trait('detected_object_set' + '2', 'detected_object_set', 'Detections from camera2')
        self.add_port_trait('image_file_name' + '1', 'image_file_name', 'desc1')
        self.add_port_trait('image_file_name' + '2', 'image_file_name', 'desc2')
        # self.add_port_trait('frame_id1', 'int', 'frame id')
        # self.add_port_trait('frame_id2', 'int', 'frame id')

        #  declare our input port ( port-name,flags)
        # self.declare_input_port_using_trait('camera' + '1', optional)
        # self.declare_input_port_using_trait('camera' + '2', optional)
        self.declare_input_port_using_trait('image_file_name' + '1', required)
        self.declare_input_port_using_trait('image_file_name' + '2', required)
        self.declare_input_port_using_trait('detected_object_set' + '1', required)
        self.declare_input_port_using_trait('detected_object_set' + '2', required)
Example #2
0
    def __init__(self, conf):
        KwiverProcess.__init__(self, conf)

        self.add_config_trait()

        # register port traits
        self.add_port_trait("exemplar_uids", "string_vector",
                            "Positive exemplar descriptor UUIDs")
        self.add_port_trait("positive_uids", "string_vector",
                            "Positive sample UIDs")
        self.add_port_trait("negative_uids", "string_vector",
                            "Negative sample UIDs")
        self.add_port_trait("result_descritpor_uids", "string_vector",
                            "Result ranked descriptor UUIDs in rank order.")
        self.add_port_trait(
            "result_descriptor_scores", "double_vector",
            "Result ranked descriptor distance score values "
            "in rank order.")

        # set up required flags
        optional = process.PortFlags()
        required = process.PortFlags()
        required.add(self.flag_required)

        ## declare our input port ( port-name,flags)
        # user-provided positive examplar descriptors.
        self.declare_input_port_using_trait('descriptor_set', required)
        # UUIDs for the user provided positive exemplar descriptors
        self.declare_input_port_using_trait('exemplar_uids', required)
        # user adjudicated positive and negative descriptor UUIDs
        self.declare_input_port_using_trait('positive_uids', optional)
        self.declare_input_port_using_trait('negative_uids', optional)

        # Output, ranked descriptor UUIDs
        self.declare_output_port_using_trait('result_descritpor_uids',
                                             optional)
        # Output, ranked descriptor scores.
        self.declare_output_port_using_trait('result_descriptor_scores',
                                             optional)

        ## Member variables to be configured in ``_configure``.
        # Path to the json config file for the DescriptorIndex
        self.di_json_config_path = None
        self.di_json_config = None
        # Path to the json config file for the NearestNeighborsIndex
        self.nn_json_config_path = None
        self.nn_json_config = None
        # Number of top, refined descriptor UUIDs to return per step.
        self.query_return_n = None
        # Set of descriptors to pull positive/negative querys from.
        self.descriptor_set = None
        # Nearest Neighbors index to use for IQR working index population.
        self.neighbor_index = None
        # IQR session state object
        self.iqr_session = None
        # Factory for converting vital descriptors to smqtk. Currently just
        # use in-memory elements for conversion.
        self.smqtk_descriptor_element_factory = smqtk.representation.DescriptorElementFactory(
            smqtk.representation.descriptor_element.local_elements.
            DescriptorMemoryElement, {})
    def __init__(self, conf):
        KwiverProcess.__init__(self, conf)

        # register python config file
        self.add_config_trait(
            'config_file', 'config_file', '',
            'Path to the json configuration file for the descriptor index to fetch from.'
        )
        self.declare_config_using_trait('config_file')

        self.add_config_trait(
            'video_name', 'video_name', '',
            'Video name'
        )
        self.declare_config_using_trait('video_name')

        self.add_config_trait(
            'conn_str', 'conn_str', '',
            'Connection string'
        )
        self.declare_config_using_trait('conn_str')

        # set up required flags
        optional = process.PortFlags()
        required = process.PortFlags()
        required.add(self.flag_required)

        self.declare_input_port_using_trait('object_track_set', required)
        self.declare_output_port_using_trait('object_track_set', optional)
Example #4
0
    def __init__(self, conf):
        print("[DEBUG] ----- init")
        KwiverProcess.__init__(self, conf)

        self.add_config_trait("modelFile", "modelFile", "Model File",
                              "Path to TF Inference Graph.")

        self.declare_config_using_trait("modelFile")

        self.add_config_trait("normImageType", "normImageType", "",
                              "Type of normalization for input image.")

        self.declare_config_using_trait("normImageType")

        self.add_config_trait("confidenceThresh", "confidenceThresh", ".5",
                              "Confidence threshold for detection.")

        self.declare_config_using_trait("confidenceThresh")

        self.add_port_trait("image_norm", "image", "Normalized image")

        # set up required flags
        optional = process.PortFlags()
        required = process.PortFlags()
        required.add(self.flag_required)

        #  declare our input port ( port-name,flags)
        self.declare_input_port_using_trait("image", required)
        self.declare_output_port_using_trait("detected_object_set", optional)
        self.declare_output_port_using_trait("image_norm", optional)
Example #5
0
    def __init__(self, conf):
        KwiverProcess.__init__(self, conf)

        # register python config file
        self.add_config_trait(
            'config_file', 'config_file', '',
            'Path to the json configuration file for the descriptor index to add to.'
        )
        self.declare_config_using_trait('config_file')
        self.add_config_trait(
            'max_frame_buffer', 'max_frame_buffer', '0',
            'Maximum number of frames to buffer descriptors over for larger batch sizes'
        )
        self.declare_config_using_trait('max_frame_buffer')
        self.add_config_trait(
            'max_descriptor_buffer', 'max_descriptor_buffer', '10000',
            'Maximum number of descriptors to buffer over to make larger batch sizes'
        )
        self.declare_config_using_trait('max_descriptor_buffer')

        # set up required flags
        optional = process.PortFlags()
        required = process.PortFlags()
        required.add(self.flag_required)

        # declare our input port ( port-name,flags)
        self.declare_input_port_using_trait('descriptor_set', required)
        self.declare_input_port_using_trait('string_vector', required)
        self.declare_output_port_using_trait('descriptor_set', optional)
        self.declare_output_port_using_trait('string_vector', optional)
Example #6
0
    def __init__(self, conf):
        logger.debug(' ----- ' + self.__class__.__name__ + ' init')

        KwiverProcess.__init__(self, conf)

        camtrawl_setup_config(self, ctalgo.FishStereoMeasurments.default_params())

        self.add_config_trait('output_fpath', 'output_fpath', 'camtrawl_out.csv',
                              'output file to write detection measurements')
        self.declare_config_using_trait('output_fpath')
        self.add_config_trait('cal_fpath', 'cal_fpath', 'cal_201608.mat',
                              'matlab or npz file with calibration info')
        self.declare_config_using_trait('cal_fpath')

        # optional = process.PortFlags()
        required = process.PortFlags()
        required.add(self.flag_required)

        # self.add_port_trait('camera' + '1', 'camera', 'Left camera calibration')
        # self.add_port_trait('camera' + '2', 'camera', 'Right camera calibration')
        self.add_port_trait('detected_object_set' + '1', 'detected_object_set', 'Detections from camera1')
        self.add_port_trait('detected_object_set' + '2', 'detected_object_set', 'Detections from camera2')
        self.add_port_trait('image_file_name' + '1', 'file_name', 'desc1')
        self.add_port_trait('image_file_name' + '2', 'file_name', 'desc2')
        # self.add_port_trait('frame_id1', 'int', 'frame id')
        # self.add_port_trait('frame_id2', 'int', 'frame id')

        #  declare our input port ( port-name,flags)
        # self.declare_input_port_using_trait('camera' + '1', optional)
        # self.declare_input_port_using_trait('camera' + '2', optional)
        self.declare_input_port_using_trait('image_file_name' + '1', required)
        self.declare_input_port_using_trait('image_file_name' + '2', required)
        self.declare_input_port_using_trait('detected_object_set' + '1', required)
        self.declare_input_port_using_trait('detected_object_set' + '2', required)
Example #7
0
    def __init__(self, conf):
        KwiverProcess.__init__(self, conf)

        # set up required flags
        optional = process.PortFlags()
        required = process.PortFlags()
        required.add(self.flag_required)

        #  declare our ports (port-name, flags)
        self.declare_input_port_using_trait('image', required)
        self.declare_output_port_using_trait('image', optional)
Example #8
0
    def __init__(self, conf):
        KwiverProcess.__init__(self, conf)

        # declare our configuration items
        self.declare_configuration_key('output', 'output-homog.txt',
                                       'The output file name.')

        required = sprokit.pipeline.process.PortFlags()
        required.add(self.flag_required)

        # create input ports
        self.add_port_trait('homography', 'homography_src_to_ref',
                            'Input homographies')
        self.declare_input_port_using_trait('homography', required)
Example #9
0
    def __init__(self, config):
        KwiverProcess.__init__(self, config)

        add_declare_config(self, "min_iou", str(DEFAULT_MIN_IOU),
                           "Minimum IOU to associate a detection to a track")

        optional = process.PortFlags()
        required = process.PortFlags()
        required.add(self.flag_required)

        self.declare_input_port_using_trait('detected_object_set', required)
        self.declare_input_port_using_trait('timestamp', required)
        self.declare_input_port_using_trait('homography_src_to_ref', required)

        self.declare_output_port_using_trait('object_track_set', optional)
Example #10
0
 def __init__(self, conf):
     KwiverProcess.__init__(self, conf)
     # set up required flags
     required = process.PortFlags()
     required.add(self.flag_required)
     # Add the type trait
     self.add_type_trait( "BBoxWithMultipleDescriptors",
                          "BBoxWithMultipleDescriptors",
                          datum.Datum.get_datum,
                          datum.new )
     # Create a new port trait
     self.add_port_trait( "BBoxWithMultipleDescriptors",
                          "BBoxWithMultipleDescriptors",
                          "Custom python data type" )
     # Declare the port using the trait
     self.declare_input_port_using_trait("BBoxWithMultipleDescriptors", required)
Example #11
0
    def __init__(self, conf):
        print('conf = {!r}'.format(conf))
        logger.debug(' ----- init ' + self.__class__.__name__)
        KwiverProcess.__init__(self, conf)

        camtrawl_setup_config(self, ctalgo.GMMForegroundObjectDetector.default_params())

        # set up required flags
        optional = process.PortFlags()
        required = process.PortFlags()
        required.add(self.flag_required)

        #  declare our input port ( port-name,flags)
        self.declare_input_port_using_trait('image', required)

        self.declare_output_port_using_trait('detected_object_set', optional )
Example #12
0
    def __init__(self, conf):
        print('conf = {!r}'.format(conf))
        logger.debug(' ----- init ' + self.__class__.__name__)
        KwiverProcess.__init__(self, conf)

        camtrawl_setup_config(self, ctalgo.GMMForegroundObjectDetector.default_params())

        # set up required flags
        optional = process.PortFlags()
        required = process.PortFlags()
        required.add(self.flag_required)

        #  declare our input port ( port-name,flags)
        self.declare_input_port_using_trait('image', required)

        self.declare_output_port_using_trait('detected_object_set', optional )
Example #13
0
    def __init__(self, conf):
        KwiverProcess.__init__(self, conf)

        # register python config file
        self.add_config_trait(
            'config_file', 'config_file', '',
            'Path to the json configuration file for the descriptor index to fetch from.'
        )
        self.declare_config_using_trait('config_file')

        # set up required flags
        optional = process.PortFlags()
        required = process.PortFlags()
        required.add(self.flag_required)

        self.declare_input_port_using_trait('descriptor_set', required)
        self.declare_output_port_using_trait('string_vector', optional)
Example #14
0
    def __init__(self, conf):
        KwiverProcess.__init__(self, conf)

        # declare configuration
        self.add_config_trait("model_file", "model_file",
                                'dummy.model', 'Model file for the classifier')
        self.declare_config_using_trait('model_file')

        # set up flags
        required = process.PortFlags()
        required.add(self.flag_required)
        optional = process.PortFlags()
        
        # declare ports
        self.declare_input_port_using_trait('image', required)
        self.declare_input_port_using_trait('file_name', optional )
        self.declare_output_port_using_trait( 'double_vector', required );
    def __init__(self, conf):
        KwiverProcess.__init__(self, conf)

        # set up required flags
        optional = process.PortFlags()
        required = process.PortFlags()
        required.add(self.flag_required)

        #  declare our input port (port-name,flags)
        self.declare_input_port_using_trait('object_track_set', required)
        self.declare_input_port_using_trait('timestamp', required)
        self.declare_output_port_using_trait('detected_object_set', optional)

        # since viame gives us all tracks each time we just want to organize them by frame
        # on the first time _step is called.
        self.track_dict_initialized = False
        self.track_dict = {}
Example #16
0
    def __init__(self, conf):
        KwiverProcess.__init__(self, conf)

        # set up configs
        self.add_config_trait("good_match_percent", "good_match_percent",
                              '0.15', 'Good match percent [0.0,1.0].')
        self.add_config_trait("ratio_test", "ratio_test", '0.85',
                              'Feature point test ratio')
        self.add_config_trait("match_height", "match_height", '512',
                              'Match height.')
        self.add_config_trait("min_matches", "min_matches", '4',
                              'Minimum number of feature matches')
        self.add_config_trait("min_inliers", "min_inliers", '4',
                              'Minimum number of inliers')

        self.declare_config_using_trait('good_match_percent')
        self.declare_config_using_trait('ratio_test')
        self.declare_config_using_trait('match_height')
        self.declare_config_using_trait('min_matches')
        self.declare_config_using_trait('min_inliers')

        # set up required flags
        optional = process.PortFlags()
        required = process.PortFlags()
        required.add(self.flag_required)

        # declare our ports (port-name, flags)
        self.add_port_trait("optical_image", "image", "Input image")
        self.add_port_trait("thermal_image", "image", "Input image")

        self.add_port_trait("warped_optical_image", "image", "Output image")
        self.add_port_trait("warped_thermal_image", "image", "Output image")
        self.add_port_trait("optical_to_thermal_homog", "homography",
                            "Output homog")
        self.add_port_trait("thermal_to_optical_homog", "homography",
                            "Output homog")

        self.declare_input_port_using_trait('optical_image', required)
        self.declare_input_port_using_trait('thermal_image', required)

        self.declare_output_port_using_trait('warped_optical_image', optional)
        self.declare_output_port_using_trait('warped_thermal_image', optional)
        self.declare_output_port_using_trait('optical_to_thermal_homog',
                                             optional)
        self.declare_output_port_using_trait('thermal_to_optical_homog',
                                             optional)
Example #17
0
    def __init__(self, conf):
        KwiverProcess.__init__(self, conf)

	# Add trait for our output port
        self.add_port_trait( 'vector', 'double_vector', 'Output descriptor vector' )

        # set up required flags
        required = process.PortFlags()
        required.add(self.flag_required)

        #  declare our ports ( port-name, flags)
        self.declare_input_port_using_trait('image', required)
        self.declare_output_port_using_trait('vector', required )

        # declare our configuration
        self.declare_configuration_key( "config_file", "",
                "Descriptor configuration file name" )
Example #18
0
    def __init__(self, conf):
        KwiverProcess.__init__(self, conf)

        self.add_config_trait("text", "text", 'Hello World',
                              'Text to display to user.')

        self.declare_config_using_trait('text')

        #self.add_port_trait('detections', 'detected_object_set', 'Output detections')

        # set up required flags
        optional = process.PortFlags()
        required = process.PortFlags()
        required.add(self.flag_required)

        #  declare our input port ( port-name,flags)
        self.declare_input_port_using_trait('image', required)
        self.declare_output_port_using_trait('detected_object_set', optional)
Example #19
0
    def __init__(self, conf):
        KwiverProcess.__init__(self, conf)

        self.add_config_trait("text", "text", 'Hello World',
          'Text to display to user.')

        self.declare_config_using_trait('text')

        self.add_port_trait('out_image', 'image', 'Processed image')

        # set up required flags
        optional = process.PortFlags()
        required = process.PortFlags()
        required.add(self.flag_required)

        #  declare our input port ( port-name,flags)
        self.declare_input_port_using_trait('image', required)
        self.declare_output_port_using_trait('out_image', optional )
Example #20
0
    def __init__(self, conf):
        KwiverProcess.__init__(self, conf)

        self.add_config_trait("example_param",
          "example_param",
          'Default Value',
          'Text to display to user.')

        self.declare_config_using_trait('example_param')

        # set up required flags
        optional = process.PortFlags()
        required = process.PortFlags()
        required.add(self.flag_required)

        #  declare our input port (port-name,flags)
        self.declare_input_port_using_trait('image', required)
        self.declare_output_port_using_trait('detected_object_set', optional)
Example #21
0
    def __init__(self, conf):
        KwiverProcess.__init__(self, conf)

        # Add trait for our output port
        self.add_port_trait('vector', 'double_vector',
                            'Output descriptor vector')

        # set up required flags
        required = process.PortFlags()
        required.add(self.flag_required)

        #  declare our ports ( port-name, flags)
        self.declare_input_port_using_trait('image', required)
        self.declare_output_port_using_trait('vector', required)

        # declare our configuration
        self.declare_configuration_key("config_file", "",
                                       "Descriptor configuration file name")
Example #22
0
    def __init__(self, conf):
        KwiverProcess.__init__(self, conf)

        self.add_config_trait("output", "output", '.',
        'The path of the file to output to.')

        self.declare_config_using_trait( 'output' )

        self.add_port_trait( 'out_image', 'image', 'Processed image' )

        # set up required flags
        optional = process.PortFlags()
        required = process.PortFlags()
        required.add(self.flag_required)

        #  declare our input port ( port-name,flags)
        self.declare_input_port_using_trait('image', required)

        self.declare_output_port_using_trait('out_image', optional )
Example #23
0
    def __init__(self, conf):
        KwiverProcess.__init__(self, conf)

        self.add_config_trait("output", "output", '.',
                              'The path of the file to output to.')

        self.declare_config_using_trait('output')

        self.add_port_trait('out_image', 'image', 'Processed image')

        # set up required flags
        optional = process.PortFlags()
        required = process.PortFlags()
        required.add(self.flag_required)

        #  declare our input port ( port-name,flags)
        self.declare_input_port_using_trait('image', required)

        self.declare_output_port_using_trait('out_image', optional)
    def __init__( self, conf ):
        KwiverProcess.__init__( self, conf )

        # set up configs
        self.add_config_trait( "good_match_percent", "good_match_percent",
                               '0.15', 'Good match percent [0.0,1.0].' )
        self.add_config_trait( "ratio_test", "ratio_test",
                               '0.85', 'Feature point test ratio' )
        self.add_config_trait( "match_height", "match_height",
                               '512', 'Match height.' )
        self.add_config_trait( "min_matches", "min_matches",
                               '4', 'Minimum number of feature matches' )
        self.add_config_trait( "min_inliers", "min_inliers",
                               '4', 'Minimum number of inliers' )

        self.declare_config_using_trait( 'good_match_percent' )
        self.declare_config_using_trait( 'ratio_test' )
        self.declare_config_using_trait( 'match_height' )
        self.declare_config_using_trait( 'min_matches' )
        self.declare_config_using_trait( 'min_inliers' )

        # set up required flags
        optional = process.PortFlags()
        required = process.PortFlags()
        required.add( self.flag_required )

        # declare our ports (port-name, flags)
        self.add_port_trait( "optical_image", "image", "Input image" )
        self.add_port_trait( "thermal_image", "image", "Input image" )

        self.add_port_trait( "warped_optical_image", "image", "Output image" )
        self.add_port_trait( "warped_thermal_image", "image", "Output image" )
        self.add_port_trait( "optical_to_thermal_homog", "homography", "Output homog" )
        self.add_port_trait( "thermal_to_optical_homog", "homography", "Output homog" )

        self.declare_input_port_using_trait( 'optical_image', required )
        self.declare_input_port_using_trait( 'thermal_image', required )

        self.declare_output_port_using_trait( 'warped_optical_image', optional )
        self.declare_output_port_using_trait( 'warped_thermal_image', optional )
        self.declare_output_port_using_trait( 'optical_to_thermal_homog', optional )
        self.declare_output_port_using_trait( 'thermal_to_optical_homog', optional )
Example #25
0
    def __init__(self, conf):
        KwiverProcess.__init__(self, conf)

        # register python config file
        self.add_config_trait(
            'config_file', 'config_file', '',
            'Path to the json configuration file for the descriptor index to add to.'
        )
        self.declare_config_using_trait('config_file')

        # set up required flags
        optional = process.PortFlags()
        required = process.PortFlags()
        required.add(self.flag_required)

        # declare our input port ( port-name,flags)
        self.declare_input_port_using_trait('descriptor_set', required)
        self.declare_input_port_using_trait('string_vector', required)
        self.declare_output_port_using_trait('descriptor_set', optional)
        self.declare_output_port_using_trait('string_vector', optional)
Example #26
0
    def __init__( self, conf ):
        KwiverProcess.__init__( self, conf )

        self.add_config_trait( "text",    # Config name
          "text",                         # Config type
          'Hello World',                  # Default value
          'Text to display to user.' )    # Config

        self.declare_config_using_trait( 'text' )  # Register config name

        # Would be used if declaring a new output field 'out_image' instead
        # of the default 'image' output port name defined in KwiverProcess
        #self.add_port_trait( 'out_image', 'image', 'Processed image' )

        # set up required port flags
        optional = process.PortFlags()
        required = process.PortFlags()
        required.add( self.flag_required )

        # declare our input and output ports ( port-name, flags )
        self.declare_input_port_using_trait( 'image', required )
        self.declare_output_port_using_trait( 'image', optional )
    def __init__(self, conf):
        KwiverProcess.__init__(self, conf)

        # set up configs
        self.add_config_trait("reference_image", "reference_image", '',
                              'Reference noise image')
        self.add_config_trait("response_kernel", "response_kernel", '25',
                              'Response kernel size.')
        self.add_config_trait("smooth_kernel", "smooth_kernel", '50',
                              'Local average kernel size')

        self.declare_config_using_trait('reference_image')
        self.declare_config_using_trait('response_kernel')
        self.declare_config_using_trait('smooth_kernel')

        # set up required flags
        optional = process.PortFlags()
        required = process.PortFlags()
        required.add(self.flag_required)

        # declare our ports (port-name, flags)
        self.declare_input_port_using_trait('image', required)
        self.declare_output_port_using_trait('image', optional)
    def __init__(self, conf):
        KwiverProcess.__init__(self, conf)

        # self.add_config_trait("match_iou",
        #   "match_iou",
        #   '.8',
        #   'IOU to declare two boxes matching')

        # self.declare_config_using_trait('match_iou')

        # set up required flags
        optional = process.PortFlags()
        required = process.PortFlags()
        required.add(self.flag_required)

        self.dos1_port_name = 'detected_object_set' + '1'
        self.dos2_port_name = 'detected_object_set' + '2'
        #  declare our input port (port-name,flags)
        self.add_port_trait(self.dos1_port_name, 'detected_object_set',
                            'Detections from camera1')
        self.add_port_trait(self.dos2_port_name, 'detected_object_set',
                            'Detections from camera2')
        self.declare_input_port_using_trait(self.dos1_port_name, required)
        self.declare_input_port_using_trait(self.dos2_port_name, required)

        self.matches_port_name = 'detected_object_set' + '_matches'
        self.new_detections_port_name = 'detected_object_set' + '_new_detections'
        self.add_port_trait(self.matches_port_name, 'detected_object_set',
                            'Detections from camera3')
        self.add_port_trait(self.new_detections_port_name,
                            'detected_object_set', 'Detections from camera3')
        self.declare_output_port_using_trait(self.matches_port_name, optional)
        self.declare_output_port_using_trait(self.new_detections_port_name,
                                             optional)
        print(dir(self))
        print(self.input_ports())
Example #29
0
    def __init__(self, conf):
        KwiverProcess.__init__(self, conf)

        # register port and config traits
        self.add_port_traits()
        self.add_config_traits()

        # set up required flags
        optional = process.PortFlags()
        required = process.PortFlags()
        required.add(self.flag_required)

        ## declare our input port ( port-name,flags)
        # user-provided positive examplar descriptors.
        self.declare_input_port_using_trait('positive_descriptor_set', required)
        self.declare_input_port_using_trait('positive_exemplar_uids', required)
        # user-provided negative examplar descriptors.
        self.declare_input_port_using_trait('negative_descriptor_set', optional)
        self.declare_input_port_using_trait('negative_exemplar_uids', optional)
        # user adjudicated positive and negative descriptor UUIDs
        self.declare_input_port_using_trait('iqr_positive_uids', optional)
        self.declare_input_port_using_trait('iqr_negative_uids', optional)
        # input model if pre-generated
        self.declare_input_port_using_trait('iqr_query_model', optional)

        # Output, ranked descriptor UUIDs
        self.declare_output_port_using_trait('result_uids', optional)
        # Output, feedback descriptor UUIDs in decreasing order of 
        # importance
        self.declare_output_port_using_trait('feedback_uids', optional)
        # Output, ranked descriptor scores.
        self.declare_output_port_using_trait('result_scores', optional)
        # Output, distances of feedback descriptors from the separating plane
        # in increasing order of magnitude.  These distances correspond to
        # feedback_uids.
        self.declare_output_port_using_trait('feedback_distances', optional)
        # Output, feedback scores corresponding to the descriptors.
        self.declare_output_port_using_trait('feedback_scores', optional)
        # Output, trained IQR model.
        self.declare_output_port_using_trait('result_model', optional)

        ## Member variables to be configured in ``_configure``.
        # Path to the json config file for the DescriptorIndex
        self.di_json_config_path = None
        self.di_json_config = None
        # Path to the json config file for the NearestNeighborsIndex
        self.nn_json_config_path = None
        self.nn_json_config = None
        # Number of top, refined descriptor UUIDs to return per step.
        self.query_return_n = None
        # Set of descriptors to pull positive/negative querys from.
        self.descriptor_set = None
        # Nearest Neighbors index to use for IQR working index population.
        self.neighbor_index = None
        # IQR session state object
        self.iqr_session = None
        # Factory for converting vital descriptors to smqtk. Currently just
        # use in-memory elements for conversion.
        self.smqtk_descriptor_element_factory = smqtk.representation.DescriptorElementFactory(
            smqtk.representation.descriptor_element.local_elements.DescriptorMemoryElement,
            {}
        )
Example #30
0
    def __init__(self, conf):
        KwiverProcess.__init__(self, conf)

        # register port and config traits
        self.add_port_traits()
        self.add_config_traits()

        # set up required flags
        optional = process.PortFlags()
        required = process.PortFlags()
        required.add(self.flag_required)

        ## declare our input port ( port-name,flags)
        # user-provided positive examplar descriptors.
        self.declare_input_port_using_trait('positive_descriptor_set',
                                            required)
        self.declare_input_port_using_trait('positive_exemplar_uids', required)
        # user-provided negative examplar descriptors.
        self.declare_input_port_using_trait('negative_descriptor_set',
                                            optional)
        self.declare_input_port_using_trait('negative_exemplar_uids', optional)
        # user adjudicated positive and negative descriptor UUIDs
        self.declare_input_port_using_trait('iqr_positive_uids', optional)
        self.declare_input_port_using_trait('iqr_negative_uids', optional)
        # input model if pre-generated
        self.declare_input_port_using_trait('iqr_query_model', optional)

        # Output, ranked descriptor UUIDs
        self.declare_output_port_using_trait('result_uids', optional)
        # Output, feedback descriptor UUIDs in decreasing order of
        # importance
        self.declare_output_port_using_trait('feedback_uids', optional)
        # Output, ranked descriptor scores.
        self.declare_output_port_using_trait('result_scores', optional)
        # Output, distances of feedback descriptors from the separating plane
        # in increasing order of magnitude.  These distances correspond to
        # feedback_uids.
        self.declare_output_port_using_trait('feedback_distances', optional)
        # Output, feedback scores corresponding to the descriptors.
        self.declare_output_port_using_trait('feedback_scores', optional)
        # Output, trained IQR model.
        self.declare_output_port_using_trait('result_model', optional)

        ## Member variables to be configured in ``_configure``.
        # Path to the json config file for the DescriptorIndex
        self.di_json_config_path = None
        self.di_json_config = None
        # Path to the json config file for the NearestNeighborsIndex
        self.nn_json_config_path = None
        self.nn_json_config = None
        # Number of top, refined descriptor UUIDs to return per step.
        self.query_return_n = None
        # Set of descriptors to pull positive/negative querys from.
        self.descriptor_set = None
        # Nearest Neighbors index to use for IQR working index population.
        self.neighbor_index = None
        # IQR session state object
        self.iqr_session = None
        # Factory for converting vital descriptors to smqtk. Currently just
        # use in-memory elements for conversion.
        self.smqtk_descriptor_element_factory = smqtk.representation.DescriptorElementFactory(
            smqtk.representation.descriptor_element.local_elements.
            DescriptorMemoryElement, {})