def get_info_along_ray(scene,cache,cam,u,v,prefix,identifier="") : print("Ray Probe"); boxm2_batch.init_process("boxm2CppRayProbeProcess"); boxm2_batch.set_input_from_db(0,scene); boxm2_batch.set_input_from_db(1,cache); boxm2_batch.set_input_from_db(2,cam); boxm2_batch.set_input_unsigned(3,u); boxm2_batch.set_input_unsigned(4,v); boxm2_batch.set_input_string(5,prefix); boxm2_batch.set_input_string(6,identifier); boxm2_batch.run_process(); (id, type) = boxm2_batch.commit_output(0); len_array_1d = boxm2_batch.get_bbas_1d_array_float(id); (id, type) = boxm2_batch.commit_output(1); alpha_array_1d = boxm2_batch.get_bbas_1d_array_float(id); (id, type) = boxm2_batch.commit_output(2); vis_array_1d = boxm2_batch.get_bbas_1d_array_float(id); (id, type) = boxm2_batch.commit_output(3); tabs_array_1d = boxm2_batch.get_bbas_1d_array_float(id); if (prefix != "") : (id, type) = boxm2_batch.commit_output(4); data_array_1d = boxm2_batch.get_bbas_1d_array_float(id); (id, type) = boxm2_batch.commit_output(5); nelems = boxm2_batch.get_output_int(id); return len_array_1d, alpha_array_1d, vis_array_1d ,tabs_array_1d, data_array_1d, nelems; else : return len_array_1d, alpha_array_1d, vis_array_1d ,tabs_array_1d;
def probe_intensities(scene, cpu_cache, str_cache, point): boxm2_batch.init_process("boxm2CppBatchProbeIntensitiesProcess") boxm2_batch.set_input_from_db(0, scene) boxm2_batch.set_input_from_db(1, cpu_cache) boxm2_batch.set_input_from_db(2, str_cache) boxm2_batch.set_input_float(3, point[0]) boxm2_batch.set_input_float(4, point[1]) boxm2_batch.set_input_float(5, point[2]) boxm2_batch.run_process() (id, type) = boxm2_batch.commit_output(0) intensities = boxm2_batch.get_bbas_1d_array_float(id) (id, type) = boxm2_batch.commit_output(1) visibilities = boxm2_batch.get_bbas_1d_array_float(id) return intensities, visibilities
def probe_intensities(scene, cpu_cache, str_cache, point): boxm2_batch.init_process("boxm2CppBatchProbeIntensitiesProcess"); boxm2_batch.set_input_from_db(0,scene); boxm2_batch.set_input_from_db(1,cpu_cache); boxm2_batch.set_input_from_db(2,str_cache); boxm2_batch.set_input_float(3,point[0]); boxm2_batch.set_input_float(4,point[1]); boxm2_batch.set_input_float(5,point[2]); boxm2_batch.run_process(); (id,type) = boxm2_batch.commit_output(0); intensities=boxm2_batch.get_bbas_1d_array_float(id); (id,type) = boxm2_batch.commit_output(1); visibilities=boxm2_batch.get_bbas_1d_array_float(id); return intensities, visibilities
def blob_precision_recall(cd_img, gt_img, mask_img=None): boxm2_batch.init_process("boxm2BlobPrecisionRecallProcess") boxm2_batch.set_input_from_db(0, cd_img) boxm2_batch.set_input_from_db(1, gt_img) if mask_img: boxm2_batch.set_input_from_db(2, mask_img) boxm2_batch.run_process() (id, type) = boxm2_batch.commit_output(0) precision = boxm2_batch.get_bbas_1d_array_float(id) (id, type) = boxm2_batch.commit_output(1) recall = boxm2_batch.get_bbas_1d_array_float(id) #return tuple of true positives, true negatives, false positives, etc.. return (precision, recall)
def pixel_wise_roc(cd_img, gt_img, mask_img=None): boxm2_batch.init_process("vilPixelwiseRocProcess") boxm2_batch.set_input_from_db(0, cd_img) boxm2_batch.set_input_from_db(1, gt_img) if mask_img: boxm2_batch.set_input_from_db(2, mask_img) boxm2_batch.run_process() (id, type) = boxm2_batch.commit_output(0) tp = boxm2_batch.get_bbas_1d_array_float(id) (id, type) = boxm2_batch.commit_output(1) tn = boxm2_batch.get_bbas_1d_array_float(id) (id, type) = boxm2_batch.commit_output(2) fp = boxm2_batch.get_bbas_1d_array_float(id) (id, type) = boxm2_batch.commit_output(3) fn = boxm2_batch.get_bbas_1d_array_float(id) #return tuple of true positives, true negatives, false positives, etc.. return (tp, tn, fp, fn)
def compute_camera_to_world_homography(cam,plane,inverse = False): boxm2_batch.init_process("vpglComputeImageToWorldHomographyProcess"); boxm2_batch.set_input_from_db(0, cam); boxm2_batch.set_input_float_array(1, plane); boxm2_batch.set_input_bool(2, inverse); boxm2_batch.run_process(); (id, type) = boxm2_batch.commit_output(0); homg2d = boxm2_batch.get_bbas_1d_array_float(id); return homg2d
def pixel_wise_roc(cd_img, gt_img, mask_img=None) : boxm2_batch.init_process("vilPixelwiseRocProcess"); boxm2_batch.set_input_from_db(0,cd_img); boxm2_batch.set_input_from_db(1,gt_img); if mask_img: boxm2_batch.set_input_from_db(2,mask_img); boxm2_batch.run_process(); (id,type) = boxm2_batch.commit_output(0); tp = boxm2_batch.get_bbas_1d_array_float(id); (id,type) = boxm2_batch.commit_output(1); tn = boxm2_batch.get_bbas_1d_array_float(id); (id,type) = boxm2_batch.commit_output(2); fp = boxm2_batch.get_bbas_1d_array_float(id); (id,type) = boxm2_batch.commit_output(3); fn = boxm2_batch.get_bbas_1d_array_float(id); #return tuple of true positives, true negatives, false positives, etc.. return (tp, tn, fp, fn);
def compute_camera_to_world_homography(cam, plane, inverse=False): boxm2_batch.init_process("vpglComputeImageToWorldHomographyProcess") boxm2_batch.set_input_from_db(0, cam) boxm2_batch.set_input_float_array(1, plane) boxm2_batch.set_input_bool(2, inverse) boxm2_batch.run_process() (id, type) = boxm2_batch.commit_output(0) homg2d = boxm2_batch.get_bbas_1d_array_float(id) return homg2d
def generate_roc(tclsf, class_out_prob_img, class_out_color_img, orig_img, prefix_for_bin_files, positive_category_name,category_id_file): boxm2_batch.init_process("sdetTextureClassifierROCProcess"); boxm2_batch.set_input_from_db(0, tclsf); boxm2_batch.set_input_from_db(1, class_out_prob_img); boxm2_batch.set_input_from_db(2, class_out_color_img); boxm2_batch.set_input_from_db(3, orig_img); boxm2_batch.set_input_string(4, prefix_for_bin_files); boxm2_batch.set_input_string(5, positive_category_name); boxm2_batch.set_input_string(6, category_id_file); boxm2_batch.run_process(); (id,type) = boxm2_batch.commit_output(0); tp = boxm2_batch.get_bbas_1d_array_float(id); boxm2_batch.remove_data(id); (id,type) = boxm2_batch.commit_output(1); tn = boxm2_batch.get_bbas_1d_array_float(id); boxm2_batch.remove_data(id); (id,type) = boxm2_batch.commit_output(2); fp = boxm2_batch.get_bbas_1d_array_float(id); boxm2_batch.remove_data(id); (id,type) = boxm2_batch.commit_output(3); fn = boxm2_batch.get_bbas_1d_array_float(id); boxm2_batch.remove_data(id); (id,type) = boxm2_batch.commit_output(4); tpr = boxm2_batch.get_bbas_1d_array_float(id); boxm2_batch.remove_data(id); (id,type) = boxm2_batch.commit_output(5); fpr = boxm2_batch.get_bbas_1d_array_float(id); boxm2_batch.remove_data(id); (id,type) = boxm2_batch.commit_output(6); outimg = dbvalue(id,type); return tp, tn, fp, fn, tpr, fpr, outimg;
def get_info_along_ray(scene, cache, cam, u, v, prefix, identifier=""): print("Ray Probe") boxm2_batch.init_process("boxm2CppRayProbeProcess") boxm2_batch.set_input_from_db(0, scene) boxm2_batch.set_input_from_db(1, cache) boxm2_batch.set_input_from_db(2, cam) boxm2_batch.set_input_unsigned(3, u) boxm2_batch.set_input_unsigned(4, v) boxm2_batch.set_input_string(5, prefix) boxm2_batch.set_input_string(6, identifier) boxm2_batch.run_process() (id, type) = boxm2_batch.commit_output(0) len_array_1d = boxm2_batch.get_bbas_1d_array_float(id) (id, type) = boxm2_batch.commit_output(1) alpha_array_1d = boxm2_batch.get_bbas_1d_array_float(id) (id, type) = boxm2_batch.commit_output(2) vis_array_1d = boxm2_batch.get_bbas_1d_array_float(id) (id, type) = boxm2_batch.commit_output(3) tabs_array_1d = boxm2_batch.get_bbas_1d_array_float(id) (id, type) = boxm2_batch.commit_output(4) res_array_1d = boxm2_batch.get_bbas_1d_array_float(id) if (prefix != ""): (id, type) = boxm2_batch.commit_output(5) data_array_1d = boxm2_batch.get_bbas_1d_array_float(id) (id, type) = boxm2_batch.commit_output(6) nelems = boxm2_batch.get_output_int(id) return len_array_1d, alpha_array_1d, vis_array_1d, tabs_array_1d, res_array_1d, data_array_1d, nelems else: return len_array_1d, alpha_array_1d, vis_array_1d, tabs_array_1d, res_array_1d
def pixel_wise_roc(cd_img, gt_img, mask_img=None): boxm2_batch.init_process("vilPixelwiseRocProcess") boxm2_batch.set_input_from_db(0, cd_img) boxm2_batch.set_input_from_db(1, gt_img) if mask_img: boxm2_batch.set_input_from_db(2, mask_img) boxm2_batch.run_process() (id, type) = boxm2_batch.commit_output(0) tp = boxm2_batch.get_bbas_1d_array_float(id) boxm2_batch.remove_data(id) (id, type) = boxm2_batch.commit_output(1) tn = boxm2_batch.get_bbas_1d_array_float(id) boxm2_batch.remove_data(id) (id, type) = boxm2_batch.commit_output(2) fp = boxm2_batch.get_bbas_1d_array_float(id) boxm2_batch.remove_data(id) (id, type) = boxm2_batch.commit_output(3) fn = boxm2_batch.get_bbas_1d_array_float(id) boxm2_batch.remove_data(id) (id, type) = boxm2_batch.commit_output(6) outimg = dbvalue(id, type) # return tuple of true positives, true negatives, false positives, etc.. return (tp, tn, fp, fn, outimg)
def query_cell(scene,cache,point,model_name,model_type): #Point should be 3 len, for a x, y, z coordinate OR #4 in lenght, blk_i, blk_j, blk_k, index if len(point)==3: (blk, index) = get_index_from_3d_point(scene,cache,point) point = blk+(index,) boxm2_batch.init_process("boxm2CppQueryCellProcess"); boxm2_batch.set_input_from_db(0, scene) boxm2_batch.set_input_from_db(1, cache) boxm2_batch.set_input_int(2, point[0]) boxm2_batch.set_input_int(3, point[1]) boxm2_batch.set_input_int(4, point[2]) boxm2_batch.set_input_int(5, point[3]) boxm2_batch.set_input_string(6, model_name) boxm2_batch.set_input_string(7, model_type) boxm2_batch.run_process(); (id,type) = boxm2_batch.commit_output(0); data=boxm2_batch.get_bbas_1d_array_float(id); boxm2_batch.remove_data(id); return data
def query_cell(scene, cache, point, model_name, model_type): #Point should be 3 len, for a x, y, z coordinate OR #4 in lenght, blk_i, blk_j, blk_k, index if len(point) == 3: (blk, index) = get_index_from_3d_point(scene, cache, point) point = blk + (index, ) boxm2_batch.init_process("boxm2CppQueryCellProcess") boxm2_batch.set_input_from_db(0, scene) boxm2_batch.set_input_from_db(1, cache) boxm2_batch.set_input_int(2, point[0]) boxm2_batch.set_input_int(3, point[1]) boxm2_batch.set_input_int(4, point[2]) boxm2_batch.set_input_int(5, point[3]) boxm2_batch.set_input_string(6, model_name) boxm2_batch.set_input_string(7, model_type) boxm2_batch.run_process() (id, type) = boxm2_batch.commit_output(0) data = boxm2_batch.get_bbas_1d_array_float(id) boxm2_batch.remove_data(id) return data
def get_info_along_ray(scene, cache, cam, u, v, prefix, identifier=""): print("Ray Probe") boxm2_batch.init_process("boxm2CppRayProbeProcess") boxm2_batch.set_input_from_db(0, scene) boxm2_batch.set_input_from_db(1, cache) boxm2_batch.set_input_from_db(2, cam) boxm2_batch.set_input_unsigned(3, u) boxm2_batch.set_input_unsigned(4, v) boxm2_batch.set_input_string(5, prefix) boxm2_batch.set_input_string(6, identifier) boxm2_batch.run_process() (id, type) = boxm2_batch.commit_output(0) len_array_1d = boxm2_batch.get_bbas_1d_array_float(id) boxm2_batch.remove_data(id) (id, type) = boxm2_batch.commit_output(1) alpha_array_1d = boxm2_batch.get_bbas_1d_array_float(id) boxm2_batch.remove_data(id) (id, type) = boxm2_batch.commit_output(2) vis_array_1d = boxm2_batch.get_bbas_1d_array_float(id) boxm2_batch.remove_data(id) (id, type) = boxm2_batch.commit_output(3) tabs_array_1d = boxm2_batch.get_bbas_1d_array_float(id) boxm2_batch.remove_data(id) (id, type) = boxm2_batch.commit_output(4) res_array_1d = boxm2_batch.get_bbas_1d_array_float(id) boxm2_batch.remove_data(id) if (prefix != ""): (id, type) = boxm2_batch.commit_output(5) data_array_1d = boxm2_batch.get_bbas_1d_array_float(id) boxm2_batch.remove_data(id) (id, type) = boxm2_batch.commit_output(6) nelems = boxm2_batch.get_output_int(id) boxm2_batch.remove_data(id) return len_array_1d, alpha_array_1d, vis_array_1d, tabs_array_1d, res_array_1d, data_array_1d, nelems else: return len_array_1d, alpha_array_1d, vis_array_1d, tabs_array_1d, res_array_1d