def main():
    # run in ~/Data/Arctic/canada_arctic/autoMapping/multiArea_sub_images on tesia
    ini_list = io_function.get_file_list_by_pattern('./','area*.ini')
    txt_list = io_function.get_file_list_by_pattern('./','area*.txt')
    for txt in txt_list:
        ini_s = io_function.read_list_from_txt(txt)
        ini_list.extend(ini_s)

    ini_list = [os.path.abspath(item) for item in ini_list]
    file_names = [ io_function.get_name_no_ext(item) for item in ini_list ]

    cur_dir = os.getcwd()

    # show
    [print(item) for item in ini_list]
    time.sleep(3)

    for name, area_ini in zip(file_names,ini_list):
        word_dir = os.path.join(cur_dir,name)
        io_function.mkdir(word_dir)
        os.chdir(word_dir)
        # copy and modify main_para.ini
        io_function.copyfiletodir(os.path.join(cur_dir,'main_para.ini'),'./',overwrite=True)
        io_function.copyfiletodir(os.path.join(cur_dir,'exe.sh'),'./',overwrite=True)

        parameters.write_Parameters_file('main_para.ini','training_regions',area_ini)

        # run exe.sh
        res = os.system('./exe.sh')
        if res !=0:
            print(res)
            sys.exit(1)

        os.chdir(cur_dir)
Пример #2
0
import parameters
import basic_src.basic as basic

para_file = "para.ini"

# patchSize = 65
patchSize = 455
# while(patchSize<460):
while(patchSize >= 65):
    basic.outputlogMessage("Test on Patch size (train): train_patch_width=%d, train_patch_height=%d"%(patchSize,patchSize))

    # change the para.ini file
    # parameters.write_Parameters_file(para_file,"patch_width",patchSize)
    # parameters.write_Parameters_file(para_file, "patch_height", patchSize)
    parameters.write_Parameters_file(para_file,"train_patch_width",patchSize)
    parameters.write_Parameters_file(para_file, "train_patch_height", patchSize)



    #running the model
    if os.path.isfile("./whole_process.sh") is False:
        basic.outputlogMessage("Please copy whole_process.sh file first")
        sys.exit(1)
    os.system("./whole_process.sh")

    #move results, only the shapefile
    os.system("rm post_pro_val_result/UAV_DOM_Eboling*.png")
    os.system("rm post_pro_val_result/UAV_DOM_Eboling*.tif")
    os.system("mv post_pro_val_result post_pro_val_result_patch"+str(patchSize))
Пример #3
0
def modify_parameter(para_file, para_name, new_value):
    parameters.write_Parameters_file(para_file, para_name, new_value)