예제 #1
0
def random_shape_sample():
    for i in range(5, 10):
        in_path = random_shape_net_object()
        out_path_ori = r"/home/zgong8/data_out/base-" + str(i) + "-ori.obj"
        out_path1 = r"/home/zgong8/data_out/base-" + str(i) + "-1.obj"
        file_path1 = r"/home/zgong8/data_out/base-" + str(i) + "-1.txt"
        out_path2 = r"/home/zgong8/data_out/base-" + str(i) + "-2.obj"
        file_path2 = r"/home/zgong8/data_out/base-" + str(i) + "-2.txt"
        empty_pipeline = Pipeline(0)
        empty_pipeline.process_shape_file(in_path, out_path_ori)

        deformation_level = i % 3 + 1

        status = False
        while not status:
            ppl, status = run_leveled_pipeline(3, in_path, out_path1)
            with open(file_path1, 'w') as f:
                f.write(in_path)
                f.write("\n")
                f.write(str(ppl))
                f.write("\n")
                f.write("status: ")
                f.write(str(status))
                f.write("\n")
                f.write("score: ")
                f.write(str(ppl.estimate_deform_score()))
                if status:
                    f.write("\n")
                    f.write("manifold: ")
                    f.write(str(is_manifold(file=out_path1)))
                    f.write("\n")
                    f.write("cut_at: ")
                    f.write(str(ppl.cut_by_point_cloud))
            f.close()
        status = False
        while not status:
            ppl, status = run_leveled_pipeline(1, in_path, out_path2)
            with open(file_path2, 'w') as f:
                f.write(in_path)
                f.write("\n")
                f.write(str(ppl))
                f.write("\n")
                f.write("status: ")
                f.write(str(status))
                f.write("\n")
                f.write("score: ")
                f.write(str(ppl.estimate_deform_score()))
                if status:
                    f.write("\n")
                    f.write("manifold: ")
                    f.write(str(is_manifold(file=out_path2)))
                    f.write("\n")
                    f.write("cut_at: ")
                    f.write(str(ppl.cut_by_point_cloud))
            f.close()
        print("{} done!".format(str(i)))
def validate_for_examples():

    f_name = r"/home/zgong8/PerceptualMetric/examples/data_out/bi_high_{}.obj"
    for i in range(10):
        _f_name = f_name.format(i)
        print(_f_name)
        print(is_manifold(file=_f_name))
def shape_net_test():
    yes = 0
    no = 0
    for file in iterate_shape_net():
        if is_manifold(file=file):
            yes += 1
        else:
            no += 1
    print(yes, no)
예제 #4
0
def random_shape_net_object():
    res = None
    while res is None:
        lv1 = _get_lv1()
        f1 = np.random.choice(lv1)
        full_f1 = join(root, f1)
        lv2 = listdir(full_f1)
        f2 = np.random.choice(lv2)
        full_f2 = join(full_f1, f2, MODEL_FOLDER)
        lv3 = listdir(full_f2)
        for f3 in lv3:
            if f3.endswith(OBJECT_EXT):
                res = join(full_f2, f3)
        if res is not None:
            if not is_manifold(res):
                res = None
    return res
def random_shape_net_test():
    file = random_shape_net_object()
    print(file)
    print(is_manifold(file=file))
def single_test():
    in_path = os.path.join(curr_dir, data_in_dir, file_name)
    print(is_manifold(file=in_path))