注意三個(gè)路徑:
datadir(存放image、mask、models的上一級(jí)路徑)、
savedir:在datadir基礎(chǔ)上擴(kuò)增的路徑
imagedir:在datadir基礎(chǔ)上擴(kuò)增的路徑
maskdir:在datadir基礎(chǔ)上擴(kuò)增的路徑
9.9號(hào)上午十點(diǎn)多,運(yùn)行代碼后,在D:\home\insight\Desktop\data\save_models路徑下保存了erfnet_ts模型 model.txt文件和opts.txt文件。
選定使用哪個(gè)模型之后,輸入分類number,就可以直接獲得對(duì)應(yīng)的模型結(jié)構(gòu)參數(shù)。
在訓(xùn)練模型模塊,train.py中,最后對(duì)模型執(zhí)行訓(xùn)練時(shí),執(zhí)行model = train(args,model),將參數(shù)賦值到模型進(jìn)行模型的訓(xùn)練。
if (not os.path.exists(automated_log_path)): #dont add first line if it exists with open(automated_log_path, "a") as myfile: myfile.write("Epoch\t\tTrain-loss\t\tTest-loss\t\tTrain-IoU\t\tTest-IoU\t\tlearningRate")? 在該路徑下添加新文件,并寫入一些內(nèi)容,修改:我將not前面的括號(hào)去掉了。
2021/9/9? 在自定義Dataset類時(shí)(class NeoData(Dataset):的__init__ 函數(shù)中新增變量),我自己新增了參數(shù):mask_suffix ,因?yàn)?,mask的后綴命名比image多了個(gè)‘_mask',所以就需要加入這個(gè)變量,完整的寫出mask圖片的路徑。
DataLoader 類中的num_workers參數(shù)含義是:在加載數(shù)據(jù)時(shí)使用多少個(gè)子進(jìn)程,默認(rèn)設(shè)置為0,代表使用主進(jìn)程進(jìn)行數(shù)據(jù)加載,不同的系統(tǒng)環(huán)境該參數(shù)的設(shè)定會(huì)導(dǎo)致不同的結(jié)果。源碼中的check_worker_number_rationality()函數(shù)可以對(duì)num_workers設(shè)定合理性進(jìn)行檢查。? linux系統(tǒng)可以通過len(os.sched_getaffinity(0))來直接獲取,而windows則通過os.cpu()獲取(并非cpu核數(shù),而是線程數(shù)),當(dāng)單process沒有在指定時(shí)間內(nèi)被killed,就會(huì)出現(xiàn) raise RuntimeError的提示錯(cuò)誤。
了解以下幾點(diǎn):
輸入圖像的讀入,結(jié)果的輸出,顯示預(yù)測結(jié)果為中膜與管腔輪廓線,