class Evaluator(object):
    def __init__(self):
        self.pos_System_Markers = {}
        self.neg_System_Markers = {}
        self.GT_Markers = {}
        self.gt_db = None
        self.system_db = None

    def load_GT_marker_from_clickpoints(self, path, type):
        self.gt_db = DataFileExtended(path)
        markers = np.asarray([[m.image.sort_index, m.x, m.y] for m in self.gt_db.getMarkers(type=type)])
        self.GT_Markers.update(dict([[t, markers[markers.T[0]==t].T[1:]] for t in set(markers.T[0])]))

    def load_pos_System_marker_from_clickpoints(self, path, type):
        self.system_db = DataFileExtended(path)
        markers = np.asarray([[self.gt_db.getImage(filename=m.image.filename).sort_index, m.x, m.y] for m in self.system_db.getMarkers(type=type)
                              if self.gt_db.getImage(filename=m.image.filename) is not None])
        self.pos_System_Markers.update(dict([[t, markers[markers.T[0]==t].T[1:]] for t in set(markers.T[0])]))

    def load_neg_System_marker_from_clickpoints(self, path, type):
        self.system_db = DataFileExtended(path)
        markers = np.asarray([[self.gt_db.getImage(filename=m.image.filename).sort_index, m.x, m.y] for m in self.system_db.getMarkers(type=type)
                              if self.gt_db.getImage(filename=m.image.filename) is not None])
        self.neg_System_Markers.update(dict([[t, markers[markers.T[0]==t].T[1:]] for t in set(markers.T[0])]))

    def save_marker_to_GT_db(self, markers, path, type):
        if function is None:
            function = lambda x : x
        self.gt_db = DataFileExtended(path)

        with self.gt_db.db.atomic() as transaction:
            self.gt_db.deleteMarkers(type=type)
            for t in markers:
                self.gt_db.setMarkers(image=self.gt_db.getImage(frame=t),x=markers[t].T[0],y=markers[t].T[1], type=type)

    def save_marker_to_System_db(self, markers, path, type):
        if function is None:
            function = lambda x : x
        self.system_db = DataFileExtended(path)

        with self.system_db.db.atomic() as transaction:
            self.system_db.deleteMarkers(type=type)
            for t in markers:
                self.system_db.setMarkers(image=self.system_db.getImage(frame=t),x=markers[t].T[0],y=markers[t].T[1], type=type)
예제 #2
0
                           model,
                           np.diag(Q),
                           np.diag(R),
                           meas_dist=Meas_Dist,
                           state_dist=State_Dist)
    MultiKal.LogProbabilityThreshold = log_prob_threshold

    # Extended Clickpoints Database for usage with pengutack
    from PenguTrack.DataFileExtended import DataFileExtended
    # Open ClickPoints Database
    db = DataFileExtended("./ExampleData/sim_data.cdb", "w")
    # Define ClickPoints Marker
    detection_marker_type = db.setMarkerType(name="Detection_Marker",
                                             color="#FF0000",
                                             style='{"scale":1.2}')
    db.deleteMarkers(type=detection_marker_type)
    track_marker_type = db.setMarkerType(name="Track_Marker",
                                         color="#00FF00",
                                         mode=db.TYPE_Track)
    db.deleteMarkers(type=track_marker_type)
    prediction_marker_type = db.setMarkerType(name="Prediction_Marker",
                                              color="#0000FF")
    db.deleteMarkers(type=prediction_marker_type)
    # Delete Old Tracks
    db.deleteTracks(type=track_marker_type)

    # Start Iteration over Images
    db_path = db.setPath("")
    print('Starting Iteration')
    for i in range(T):
        # Prediction step, without applied control(vector of zeros)
예제 #3
0
    PT_Detection_Type = db.setMarkerType(name="PT_Detection_Marker", color="#FFFF00", style='{"scale":0.8}')
if db.getMarkerType(name="PT_Track_Marker"):
    PT_Track_Type = db.getMarkerType(name="PT_Track_Marker")
else:
    PT_Track_Type = db.setMarkerType(name="PT_Track_Marker", color="#00FF00", mode=db.TYPE_Track)
if db.getMarkerType(name="PT_Prediction_Marker"):
    PT_Prediction_Type = db.getMarkerType(name= "PT_Prediction_Marker")
else:
    PT_Prediction_Type = db.setMarkerType(name="PT_Prediction_Marker", color="#0000FF")
if db.getMarkerType(name="PT_Stitch_Marker"):
    PT_Stitch_Type = db.getMarkerType(name="PT_Stitch_Marker")
else:
    PT_Stitch_Type = db.setMarkerType(name="PT_Stitch_Marker", color="#FF8800", mode=db.TYPE_Track)

# Delete Old Tracks
db.deleteMarkers(type=PT_Detection_Type)
db.deleteMarkers(type=PT_Track_Type)
db.deleteMarkers(type=PT_Prediction_Type)
db.deleteMarkers(type=PT_Stitch_Type)

db.deleteTracks(type=PT_Track_Type)
db.deleteTracks(type=PT_Stitch_Type)

# Start Iteration over Images
print('Starting Iteration')

from multiprocessing import Process,Queue,Pipe

# segmentation_queue = Queue(10)
Image_write_queue = Queue()
SegMap_write_queue = Queue()
예제 #4
0
    marker_type = db.setMarkerType(name="PT_Detection_Marker", color="#FFFF00", style='{"scale":0.8}')
if db.getMarkerType(name="PT_Track_Marker"):
    marker_type2 = db.getMarkerType(name="PT_Track_Marker")
else:
    marker_type2 = db.setMarkerType(name="PT_Track_Marker", color="#00FF00", mode=db.TYPE_Track)
if db.getMarkerType(name="PT_Prediction_Marker"):
    marker_type3 = db.getMarkerType(name= "PT_Prediction_Marker")
else:
    marker_type3 = db.setMarkerType(name="PT_Prediction_Marker", color="#0000FF")
if db.getMarkerType(name="PT_Stitch_Marker"):
    marker_type4 = db.getMarkerType(name="PT_Stitch_Marker")
else:
    marker_type4 = db.setMarkerType(name="PT_Stitch_Marker", color="#FF8800", mode=db.TYPE_Track)

# Delete Old Tracks
db.deleteMarkers(type=marker_type)
db.deleteMarkers(type=marker_type2)
db.deleteMarkers(type=marker_type3)
db.deleteMarkers(type=marker_type4)

db.deleteTracks(type=marker_type2)
db.deleteTracks(type=marker_type4)



# Start Iteration over Images
print('Starting Iteration')
images = db.getImageIterator(start_frame=20)#start_frame=start_frame, end_frame=3)
# images = db.getImageIterator(start_frame=10272, end_frame=10311)#start_frame=start_frame, end_frame=3)

start = time()