#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 executor.submit(esl.start_and_log, "multiframe fitting on " + message, cmd, None, log=outputfolder + LOGNAME) #21600 except Exception as e: print("ERROR on " + message + ": " + str(e))
if len(imgs) == 0: print('f**k!!! ohohohohoh', template[1].images) with open(outputfolder + LOGNAME, 'w') as out: out.write('no images with lms found') continue lms = [x.split('.')[0] + '.pts' for x in imgs] #lms = glob.glob(id_folder+"/*.pts") #imgs = esl.find_imgs_to_lms (lms, ".*[!pts]") # 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 #esl.start_and_log("multiframe fitting on "+message, cmd, None, log=outputfolder+LOGNAME) #21600 #except Exception as e: # print("ERROR on " + message + ": " + str(e))
outputfolder += EXPERIMENT if (not os.path.exists(outputfolder)): os.mkdir(outputfolder) id_and_expr_folder = id_folder + expression # gather lm and img files lms = glob.glob(id_and_expr_folder + "/*.pts") imgs = esl.find_imgs_to_lms(lms, "*.png") for i in range(len(lms)): try: # prepare multi image fit command img_num = os.path.splitext(os.path.basename(lms[i]))[0] cmd = esl.assemble_command(EXE, lms[i], imgs[i], outputfolder + img_num) #print (cmd) # print id and start cmd message = "id " + os.path.basename( id_folder) + " expression " + exp + " img num " + img_num if (os.path.exists(outputfolder + img_num + '.png') and not OVERWRITE): print("already done", message) continue print("single frame fitting on", message) with open(outputfolder + img_num + "." + LOGNAME, "w") as logfile: logfile.write(cmd + "\n \n")
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+"/annot/*.pts") imgs = glob.glob(id_folder + "/frames/*.png") if (not os.path.exists(id_folder + "/out/")): os.mkdir(id_folder + "/out/") print('Make directory: ' + id_folder) for img in imgs: lm = img.replace('frames', 'annot').replace('png', 'pts') #print (lm) outputfolder = img.replace('frames', 'out') #print (outputfolder) m = message + " - (" + str(img) + " of " + str( len(imgs)) + " )" cmd = esl.assemble_command(EXE, lm, img, outputfolder) cmd = cmd.replace("\\", "/") print(cmd) executor.submit(esl.start_and_log, "multiframe fitting on " + m, cmd, None, log=outputfolder + LOGNAME) #21600 except Exception as e: print("ERROR on " + message + ": " + str(e))
outputfolder += format(experiment[1], '03d') + "_images_" + format( set_iter, '02d') + "/" if (not os.path.exists(outputfolder)): os.mkdir(outputfolder) message = "id " + os.path.basename( id_folder) + " expression " + exp + " with " + str( experiment[1]) + " images, set " + str(set_iter) if (os.path.exists(outputfolder + 'merged.obj') and not OVERWRITE): print("already done", message) continue # prepare multi image fit command cmd = esl.assemble_command(EXE, lms_exp, imgs_exp, outputfolder, regularisation=30.0, iterations=10, model="1.7k") # print id and start cmd executor.submit(esl.start_and_log, "multiframe fitting on " + message, cmd, None, log=outputfolder + LOGNAME) #21600