def determine_average_id_by_mean(self): average = np.round( self.match_ids_sum * 1.0 / self.match_ids_count) # keep in mind numpy rounds 0.5 to 0 self.determined_id = aux.binary_id_to_int(average) return self.determined_id
def determine_average_id_with_confidence(self): average = np.round( self.ids_sum_confidence / self.confidence_count) # keep in mind numpy rounds 0.5 to 0 self.determined_id = aux.binary_id_to_int(average) return self.determined_id
def determine_average_id_with_saliency(self): average = np.round( self.ids_sum_saliency / self.saliency_count) # keep in mind numpy rounds 0.5 to 0 self.determined_id = aux.binary_id_to_int(average) return self.determined_id
def derive_id_by_distribution_convergence( self ): # another try with adding an observation # TODO: parameter alpha needs to be adjusted # TODO! converged_dist = np.round( self.ids_dists ) determined_id = aux.binary_id_to_int( converged_dist ) return determined_id
def get_mean_id( self ): if self.mean_id_needs_update: average = np.round( self.detections_ids_sum*1.0 / self.detections_ids_count ) # keep in mind numpy rounds 0.5 to 0 self.mean_id = aux.binary_id_to_int( average ) self.mean_id_needs_update = False return self.mean_id
def get_mean_id(self): if self.mean_id_needs_update: average = np.round(self.detections_ids_sum * 1.0 / self.detections_ids_count ) # keep in mind numpy rounds 0.5 to 0 self.mean_id = aux.binary_id_to_int(average) self.mean_id_needs_update = False return self.mean_id
def edit_id( self ): if len( self.current_paths ) == 1: current_path = self.current_paths[ 0 ] if self.tag_view.binary_id is not None: new_id = aux.binary_id_to_int( self.tag_view.binary_id ) self.path_manager.move( current_path, new_id ) memorize_path = current_path self.build_path_tree() self.build_path_details( [ memorize_path ] ) else: self.tag_view.setTag( 0 ) self.edit_id_button.setText( 'Save Id' )
def edit_id(self): if len(self.current_paths) == 1: current_path = self.current_paths[0] if self.tag_view.binary_id is not None: new_id = aux.binary_id_to_int(self.tag_view.binary_id) self.path_manager.move(current_path, new_id) memorize_path = current_path self.build_path_tree() self.build_path_details([memorize_path]) else: self.tag_view.setTag(0) self.edit_id_button.setText('Save Id')
def __init__( self, detection_id, timestamp, position, localizer_saliency, decoded_id ): self.detection_id = detection_id self.timestamp = timestamp # type TimeStamp self.position = position # numpy array of x- and y-position self.localizer_saliency = localizer_saliency self.decoded_id = decoded_id # list of floats self.decoded_mean = None self.readability = Readability.Completely self.taken = False # to control allocation to paths if self.decoded_id is not None: self.decoded_mean = aux.binary_id_to_int( np.round( np.array( self.decoded_id ) ) )
def __init__(self, detection_id, timestamp, position, localizer_saliency, decoded_id): self.detection_id = detection_id self.timestamp = timestamp # type TimeStamp self.position = position # numpy array of x- and y-position self.localizer_saliency = localizer_saliency self.decoded_id = decoded_id # list of floats self.decoded_mean = None self.readability = Readability.Completely self.taken = False # to control allocation to paths if self.decoded_id is not None: self.decoded_mean = aux.binary_id_to_int( np.round(np.array(self.decoded_id)))
def update_view(self): self.scene().clear() if self.binary_id is not None: circle = QtGui.QGraphicsEllipseItem(10, 10, 80, 80) circle.setPen(self.white_pen) circle.setBrush(self.white_brush) self.scene().addItem(circle) for i, digit in enumerate(self.binary_id): section = TagSection(i, self.flip_id_bit) section.setStartAngle(90 * 16 + i * 30 * 16 - self.rotation * 16) section.setSpanAngle(30 * 16) section.setPen(self.white_pen) if digit: section.setBrush(self.white_brush) else: section.setBrush(self.black_brush) self.scene().addItem(section) inner_circle = QtGui.QGraphicsEllipseItem(34, 34, 32, 32) inner_circle.setPen(self.white_pen) inner_circle.setBrush(self.white_brush) self.scene().addItem(inner_circle) inner_half = QtGui.QGraphicsEllipseItem(34, 34, 32, 32) inner_half.setStartAngle(180 * 16 - self.rotation * 16) inner_half.setSpanAngle(180 * 16) inner_half.setPen(self.white_pen) inner_half.setBrush(self.black_brush) self.scene().addItem(inner_half) id_text = QtGui.QGraphicsSimpleTextItem( str(aux.binary_id_to_int(self.binary_id))) id_text.setPos(0, 0) id_text.setBrush(self.black_brush) self.scene().addItem(id_text) rotate_button = RotateButton(80, 80, self.rotate_tag) rotate_button.setPen(self.no_pen) rotate_button.setBrush(self.button_brush) self.scene().addItem(rotate_button)
def update_view( self ): self.scene().clear() if self.binary_id is not None: circle = QtGui.QGraphicsEllipseItem( 10, 10, 80, 80 ) circle.setPen( self.white_pen ) circle.setBrush( self.white_brush ) self.scene().addItem( circle ) for i, digit in enumerate( self.binary_id ): section = TagSection( i, self.flip_id_bit ) section.setStartAngle( 90*16 + i*30*16 - self.rotation*16 ) section.setSpanAngle( 30*16 ) section.setPen( self.white_pen ) if digit: section.setBrush( self.white_brush ) else: section.setBrush( self.black_brush ) self.scene().addItem( section ) inner_circle = QtGui.QGraphicsEllipseItem( 34, 34, 32, 32 ) inner_circle.setPen( self.white_pen ) inner_circle.setBrush( self.white_brush ) self.scene().addItem( inner_circle ) inner_half = QtGui.QGraphicsEllipseItem( 34, 34, 32, 32 ) inner_half.setStartAngle( 180*16 - self.rotation*16 ) inner_half.setSpanAngle( 180*16 ) inner_half.setPen( self.white_pen ) inner_half.setBrush( self.black_brush ) self.scene().addItem( inner_half ) id_text = QtGui.QGraphicsSimpleTextItem( str( aux.binary_id_to_int( self.binary_id ) ) ) id_text.setPos( 0, 0 ) id_text.setBrush( self.black_brush ) self.scene().addItem( id_text ) rotate_button = RotateButton( 80, 80, self.rotate_tag ) rotate_button.setPen( self.no_pen ) rotate_button.setBrush( self.button_brush ) self.scene().addItem( rotate_button )
def determine_average_id_by_weighted_neighbourhood_2iter( self ): average = self.ids_sum_weighted_neighbourhood*1.0 / self.ids_count new_sum = np.zeros( 12 ) new_count = 0 for d in self.detections.values(): candidates = [ c[0] for c in d.candidate_ids ] for c in candidates: c_bin = aux.int_id_to_binary( c ) h_dis = float( np.sum( np.abs( c_bin - average ) ) ) if h_dis < 4: # here is the hamming distance limitation new_sum += aux.weighted_neighbourhood_id( c ) new_count += 1 if new_count > 0: new_average = np.round( new_sum*1.0 / new_count ) else: new_average = np.round( average ) determined_id = aux.binary_id_to_int( new_average ) return determined_id
def __init__(self, detection_id, timestamp, position, localizer_saliency, decoded_id, data_source, readability=Readability.Completely): self.detection_id = detection_id self.timestamp = timestamp # type TimeStamp self.position = position # numpy array of x- and y-position self.localizer_saliency = localizer_saliency self.decoded_id = decoded_id # list of floats self.decoded_mean = None self.data_source = data_source self.readability = readability self.path = None if self.decoded_id is not None: self.decoded_mean = aux.binary_id_to_int( np.round(np.array(self.decoded_id)))
def derive_id_by_distribution_straight_forward( self ): average = np.round( self.ids_dist / self.ids_count ) determined_id = aux.binary_id_to_int( average ) return determined_id
def determine_average_id_with_saliency( self ): average = np.round( self.ids_sum_saliency / self.saliency_count ) # keep in mind numpy rounds 0.5 to 0 determined_id = aux.binary_id_to_int( average ) return determined_id
def determine_average_id_by_mean_mean( self ): average = np.round( self.ids_sum_mean*1.0 / self.ids_count ) # keep in mind numpy rounds 0.5 to 0 determined_id = aux.binary_id_to_int( average ) return determined_id
def determine_average_id_by_weighted_neighbourhood( self ): average = np.round( self.ids_sum_weighted_neighbourhood*1.0 / self.ids_count ) # keep in mind numpy rounds 0.5 to 0 determined_id = aux.binary_id_to_int( average ) return determined_id
def determine_average_id_with_confidence( self ): average = np.round( self.ids_sum_confidence / self.confidence_count ) # keep in mind numpy rounds 0.5 to 0 determined_id = aux.binary_id_to_int( average ) return determined_id