示例#1
0
        try:

            # create outputfolder
            outputfolder = OUTPUTBASE + os.path.basename(lm_file)[:-8] + "/"
            if (not os.path.exists(outputfolder)):
                os.mkdir(outputfolder)

            message = "image " + os.path.basename(lm_file) + " (" + str(
                n) + " of " + str(len(lm_files)) + " )"
            #if (os.path.exists(outputfolder+'merged.obj') and not OVERWRITE):
            #	print ("already done", message)
            #	continue

            # gather lm and img files
            #lms  = glob.glob(vid_folder+"/*.pts")
            img_file = esl.find_imgs_to_lms([lm_file[:-8] + '.pts'],
                                            "*.jpg")[0]

            #print (lm_file)
            #print (img_file)

            # prepare multi image fit command
            cmd = esl.assemble_command(EXE, [lm_file], [img_file],
                                       outputfolder,
                                       regularisation=30.0,
                                       iterations=10,
                                       model="3.4k")
            #cmd.replace("/user/HS204/m09113/eos/install/share/ibug_to_sfm.txt", "/user/HS204/m09113/my_project_folder/AFLW2000_fittings/ibug_to_sfm_static_contour.txt")
            #print (cmd)
            #exit()

            # print id and start cmd
示例#2
0
                                group_10_centre, 1)
                    elif experiment_idx == 7:
                        lms = random.sample(
                            group_10_centre, 1) + random.sample(
                                group_10_right, 4) + random.sample(
                                    group_20_right, 5)
                    elif experiment_idx == 8:
                        lms = random.sample(group_20_left, 3) + random.sample(
                            group_10_centre, 4) + random.sample(
                                group_20_right, 3)
                    elif experiment_idx == 9:
                        lms = random.sample(group_20_left, 1) + random.sample(
                            group_10_left, 4) + random.sample(
                                group_10_right, 4) + random.sample(
                                    group_20_right, 1)
                    imgs = esl.find_imgs_to_lms(lms, "*.png")

                    message = "id " + os.path.basename(
                        id_folder
                    ) + " expression " + exp + " pose experiment " + format(
                        experiment_idx, '02d') + ", set " + str(set_iter)
                    # prepare multi image fit command
                    cmd = esl.assemble_command(EXE,
                                               lms,
                                               imgs,
                                               outputfolder_experiment,
                                               regularisation=30.0,
                                               iterations=75)

                    # print id and start cmd
                    executor.submit(esl.start_and_log,
        try:

            # create outputfolder
            outputfolder = OUTPUTBASE + os.path.basename(vid_folder) + "/"
            if (not os.path.exists(outputfolder)):
                os.mkdir(outputfolder)

            message = "video " + os.path.basename(vid_folder) + " (" + str(
                n) + " of " + str(len(vid_folders)) + " )"
            if (os.path.exists(outputfolder + 'merged.obj') and not OVERWRITE):
                print("already done", message)
                continue

            # gather lm and img files
            lms = glob.glob(vid_folder + "/*.pts")
            imgs = esl.find_imgs_to_lms(lms, ".jpg")

            # prepare multi image fit command
            cmd = esl.assemble_command(EXE,
                                       lms,
                                       imgs,
                                       outputfolder,
                                       regularisation=30.0,
                                       iterations=75)

            # print id and start cmd
            executor.submit(esl.start_and_log,
                            "multiframe fitting on " + message,
                            cmd,
                            None,
                            log=outputfolder + LOGNAME)  #21600
            for experiment in experiments:  # each specific number of image

                #check if we have enough images with lms for this experiment
                if experiment[1] > len(lms):
                    continue

                random.seed(experiment[1] * 223)

                for set_iter in range(
                        experiment[0]
                ):  #each time same number of images but different images

                    lms_exp = random.sample(lms, experiment[1])
                    #print (lms_exp)
                    imgs_exp = esl.find_imgs_to_lms(lms_exp, "*.png")

                    # create outputfolder
                    outputfolder = OUTPUTBASE + os.path.basename(id_folder)
                    if (not os.path.exists(outputfolder)):
                        os.mkdir(outputfolder)

                    outputfolder += "/" + exp + "_only/"
                    if (not os.path.exists(outputfolder)):
                        os.mkdir(outputfolder)

                    outputfolder += format(experiment[1],
                                           '03d') + "_images_" + format(
                                               set_iter, '02d') + "/"
                    if (not os.path.exists(outputfolder)):
                        os.mkdir(outputfolder)
    for n in range(0, len(id_folders)):
        id_folder = id_folders[n]
        try:
            # make absolute
            id_folder = os.path.abspath(id_folder)
            id_num = os.path.basename(id_folder)
            message = "id " + id_num + "   (" + str(n) + " of " + str(
                len(id_folders)) + " )"

            # check if it's a folder
            #if (not os.path.isdir(id_folder)):
            #	continue;

            # gather lm and img files
            lms = glob.glob(id_folder + "/*.pts")
            imgs = esl.find_imgs_to_lms(lms, ".*[!pts]")

            # create outputfolder
            outputfolder = OUTPUTBASE + id_num + "/"
            if (not os.path.exists(outputfolder)):
                os.mkdir(outputfolder)

            # prepare multi image fit command
            cmd = esl.assemble_command(EXE,
                                       lms,
                                       imgs,
                                       outputfolder,
                                       regularisation=30.0,
                                       iterations=75)

            # print id and start cmd