# 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) MultiKal.predict(i=i) image = db.setImage("", db_path, timestamp=i) # Detection step SegMap = TS.detect(image.data) X, Y = np.random.rand(0, 1, (2, N)) X *= arena_w Y *= arena_h print("Found %s Objects!" % len(Positions))
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() for image in images: print(time()-start) start = time() i = image.get_id()
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() Detection_write_queue = Queue() Track_write_queue = Queue() segmentation_pipe_in, segmentation_pipe_out = Pipe() detection_pipe_in, detection_pipe_out = Pipe()
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=10) #start_frame=start_frame, end_frame=3) for image in images: start = time() i = image.get_id() # Prediction step MultiKal.predict(u=np.zeros((model.Control_dim, )).T, i=i) # Segmentation step