def get_boxes_simplified(db_filename, data_directory, capture_ids, label_type, detection_type, parent_type, x_stride=db_export.x_stride_dft, y_offset=db_export.y_offset_dft): ''' Simple work flow for finding all the detected and labeled boxes given a data directory and database file. ''' if detection_type is None: detection_type = label_type if capture_ids is not None: detection_capture_ids = capture_ids label_capture_ids = capture_ids else: detection_capture_ids = process_export.find_capture_ids(data_directory) label_capture_ids = None detected_boxes_dict = dict( process_export.detected_boxes(data_directory, detection_type, detection_capture_ids)) detected_parent_boxes_dict = dict( process_export.detected_boxes(data_directory, parent_type, detection_capture_ids)) if 1: if db_filename[-3:] == "txt": labeled_boxes_dict = boxes_from_txt(db_filename, label_type, label_capture_ids) else: labeled_boxes_dict = db_export.boxes_from_db( db_filename, label_type, x_stride, y_offset, label_capture_ids) # a development option to read clear_lables and all_labels if 0: labeled_boxes_dict = db_export.boxes_from_db(db_filename, 'all_plates', x_stride, y_offset, label_capture_ids) labeled_boxes_dict tmpdict = db_export.boxes_from_db(db_filename, 'clear_plates', x_stride, y_offset, label_capture_ids) for key in tmpdict: if key in labeled_boxes_dict: labeled_boxes_dict[key] += tmpdict[key] else: labeled_boxes_dict[key] = tmpdict[key] if capture_ids is None: reduce_to_intersection(detected_boxes_dict, labeled_boxes_dict) return detected_boxes_dict, detected_parent_boxes_dict, labeled_boxes_dict
def get_boxes_simplified(db_filename, data_directory, capture_ids, label_type, detection_type, parent_type, x_stride=db_export.x_stride_dft, y_offset=db_export.y_offset_dft, scale=1): # Added "scale" as input parameter ''' Simple work flow for finding all the detected and labeled boxes given a data directory and database file. ''' ''' Modified codes for loading "detected_boxes_dic", "labeled_boxes_dic" on 6/30 by tchen. ''' if detection_type is None: detection_type = label_type if capture_ids is not None: detection_capture_ids = capture_ids label_capture_ids = capture_ids else: detection_capture_ids = process_export.find_capture_ids( data_directory) label_capture_ids = None # Added load_detected_boxes function by tchen on 6/30 driveid = db_filename[-20:-4] detected_boxes_dict = load_detected_boxes(driveid, data_directory, scale) # detected_boxes_dict = dict(load_detected_boxes(driveid, data_directory)) detected_parent_boxes_dict = detected_boxes_dict detected_boxes_dict = dict(process_export.detected_boxes( data_directory, detection_type, detection_capture_ids)) ''' detected_parent_boxes_dict = dict(process_export.detected_boxes( data_directory, parent_type, detection_capture_ids)) ''' if 1: if db_filename[-3:] == "txt": labeled_boxes_dict = boxes_from_txt( db_filename, label_type, label_capture_ids) else: labeled_boxes_dict = db_export.boxes_from_db( db_filename, label_type, x_stride, y_offset, label_capture_ids) # a development option to read clear_lables and all_labels if 0: labeled_boxes_dict = db_export.boxes_from_db( db_filename, 'all_plates', x_stride, y_offset, label_capture_ids) labeled_boxes_dict tmpdict = db_export.boxes_from_db( db_filename, 'clear_plates', x_stride, y_offset, label_capture_ids) for key in tmpdict: if key in labeled_boxes_dict: labeled_boxes_dict[key] += tmpdict[key] else: labeled_boxes_dict[key] = tmpdict[key] ''' if capture_ids is None: reduce_to_intersection(detected_exiboxes_dict, lasbeled_boxes_dict) ''' return detected_boxes_dict,detected_parent_boxes_dict, labeled_boxes_dict
def get_boxes_simplified(db_filename, data_directory, capture_ids, label_type, detection_type, parent_type, x_stride=db_export.x_stride_dft, y_offset=db_export.y_offset_dft, scale=1): # Added "scale" as input parameter ''' Simple work flow for finding all the detected and labeled boxes given a data directory and database file. ''' ''' Modified codes for loading "detected_boxes_dic", "labeled_boxes_dic" on 6/30 by tchen. ''' if detection_type is None: detection_type = label_type if capture_ids is not None: detection_capture_ids = capture_ids label_capture_ids = capture_ids else: detection_capture_ids = process_export.find_capture_ids(data_directory) label_capture_ids = None # Added load_detected_boxes function by tchen on 6/30 driveid = db_filename[-20:-4] detected_boxes_dict = load_detected_boxes(driveid, data_directory, scale) # detected_boxes_dict = dict(load_detected_boxes(driveid, data_directory)) detected_parent_boxes_dict = detected_boxes_dict detected_boxes_dict = dict( process_export.detected_boxes(data_directory, detection_type, detection_capture_ids)) ''' detected_parent_boxes_dict = dict(process_export.detected_boxes( data_directory, parent_type, detection_capture_ids)) ''' if 1: if db_filename[-3:] == "txt": labeled_boxes_dict = boxes_from_txt(db_filename, label_type, label_capture_ids) else: labeled_boxes_dict = db_export.boxes_from_db( db_filename, label_type, x_stride, y_offset, label_capture_ids) # a development option to read clear_lables and all_labels if 0: labeled_boxes_dict = db_export.boxes_from_db(db_filename, 'all_plates', x_stride, y_offset, label_capture_ids) labeled_boxes_dict tmpdict = db_export.boxes_from_db(db_filename, 'clear_plates', x_stride, y_offset, label_capture_ids) for key in tmpdict: if key in labeled_boxes_dict: labeled_boxes_dict[key] += tmpdict[key] else: labeled_boxes_dict[key] = tmpdict[key] ''' if capture_ids is None: reduce_to_intersection(detected_exiboxes_dict, lasbeled_boxes_dict) ''' return detected_boxes_dict, detected_parent_boxes_dict, labeled_boxes_dict
def get_boxes_simplified(db_filename, data_directory, capture_ids, label_type, detection_type, parent_type, x_stride=db_export.x_stride_dft, y_offset=db_export.y_offset_dft): ''' Simple work flow for finding all the detected and labeled boxes given a data directory and database file. ''' if detection_type is None: detection_type = label_type if capture_ids is not None: detection_capture_ids = capture_ids label_capture_ids = capture_ids else: detection_capture_ids = process_export.find_capture_ids( data_directory) label_capture_ids = None detected_boxes_dict = dict(process_export.detected_boxes( data_directory, detection_type, detection_capture_ids)) detected_parent_boxes_dict = dict(process_export.detected_boxes( data_directory, parent_type, detection_capture_ids)) if 1: if db_filename[-3:] == "txt": labeled_boxes_dict = boxes_from_txt( db_filename, label_type, label_capture_ids) else: labeled_boxes_dict = db_export.boxes_from_db( db_filename, label_type, x_stride, y_offset, label_capture_ids) # a development option to read clear_lables and all_labels if 0: labeled_boxes_dict = db_export.boxes_from_db( db_filename, 'all_plates', x_stride, y_offset, label_capture_ids) labeled_boxes_dict tmpdict = db_export.boxes_from_db( db_filename, 'clear_plates', x_stride, y_offset, label_capture_ids) for key in tmpdict: if key in labeled_boxes_dict: labeled_boxes_dict[key] += tmpdict[key] else: labeled_boxes_dict[key] = tmpdict[key] if capture_ids is None: reduce_to_intersection(detected_boxes_dict, labeled_boxes_dict) return detected_boxes_dict,detected_parent_boxes_dict, labeled_boxes_dict