2019-02-28

一、運行train程序

運行程序的命令行:

記得先轉(zhuǎn)到當(dāng)前目錄下

再執(zhí)行如下命令行:

注意端口名稱與自己分配的端口

CUDA_VISIBLE_DEVICES=0 python train.py --dataroot ./datasets/cell3 --name?cell3_spcyclegan --model cycle_lo_seg --no_dropout --which_model_netG resnet_9blocks --display_id 2 --display_port 8097 --input_nc 1 --output_nc 1 --phase train --identity 0 >log_file/cell3.out?

開啟visdom的鏈接如下:

python -m visdom.server

在后臺跑程序的代碼如下:

CUDA_VISIBLE_DEVICES=0 nohup python train.py --dataroot ./datasets/cell3 --name?cell3_spcyclegan --model cycle_lo_seg --no_dropout --which_model_netG resnet_9blocks --display_id 2 --display_port 8097 --input_nc 1 --output_nc 1 --phase train --identity 0 >log_file/cell3.out &

二、進(jìn)行sequence的label

1、groundtruth label

1、導(dǎo)入15張圖,imageJ? import the image sequence,并且記得勾上轉(zhuǎn)成8bit。

2、選擇1024*1024*15 dimension,最右側(cè)的滾動條可以選擇圖像序號。

3、label的時候記得勾上3D。

4、注意paint over這里選擇 all visibel labels

5、記得用brush的時候清除label的時候把3D取消掉。

其實這樣來回變動著標(biāo)記真的蠻快的。一個小時就標(biāo)記好了15張圖片。

2、color coding

1、把圖像轉(zhuǎn)成png形式,我是把圖像分成slices,然后逐一存成png格式的。

2、改python文件里的維度。

3、丟進(jìn)linux服務(wù)器。

3、overlay the image

matlab進(jìn)行圖像疊加的方法:

參考網(wǎng)址:

https://blog.csdn.net/wzz110011/article/details/78174003

我是用tif格式進(jìn)行疊加的,采用的代碼如下,是用matlab寫的:

%add images

close;

clear all;

clc;

A1 = imread('image00015.tif');

A2 = imread('z0015.tif');

K = imlincomb(0.5,A1,0.5,A2);

imwrite(K,'c0015.tif')

4、組成4幅圖

把4幅圖合在一起:

哪四幅圖?分別是:原圖,灰色的分割圖,彩色的分割圖,以及彩色的疊加圖。

遇到問題:灰色的分割圖不能正常顯示

解決辦法:

imagesc(a2,[0,4]);% four is the max value in a2

colormap(gray);

遇到問題:合在一起有空隙

考慮圖像拼接。圖像拼接不行。

這篇文章里講了如何消除空白區(qū)域。

https://blog.csdn.net/shanchuan2012/article/details/53980288

5、合成視頻

參考自己之前的文章:Windows系統(tǒng)下安裝FFmpeg并進(jìn)行照片合成視頻

ffmpeg -loop 1 -f image2 -i d:/video2/c%04d.tif -vcodec libx264 -r 3 -t 5 test.mp4

3是幀數(shù),5是秒數(shù),乘起來就是總照片數(shù)目。

三、運行test的程序

原來的命令行:

CUDA_VISIBLE_DEVICES=2 python test.py --dataroot ./datasets/biospy --name biospy_spcyclegan --model test_seg --phase test --which_model_netG resnet_9blocks --no_dropout --display_id 0 --dataset_mode single --which_direction AtoB --which_epoch 200 --loadSize 256 --fineSize 256 --how_many 1280

實際的命令行:

CUDA_VISIBLE_DEVICES=0 python test.py --dataroot ./datasets/cell3 --name cell3_spcyclegan --model test_seg --phase test --which_model_netG resnet_9blocks --no_dropout --display_id 0 --dataset_mode single --which_direction AtoB --which_epoch 200 --loadSize 1024 --fineSize 256 --how_many 5

我需要查看這些參數(shù)的具體用途:

how many? ?-how many test images to run

self.parser.add_argument('--loadSize', type=int, default=286, help='scale images to this size')

self.parser.add_argument('--fineSize', type=int, default=256, help='then crop to this size')

注意:finesize如果改成1024,會出現(xiàn)out of memory的問題。

所以你需要怎么做?

遇到問題1:img_path不大對

img_path = model.get_image_paths()

model = create_model(opt)

在cycle_lo_seg_model中我找到了對應(yīng)代碼

def get_image_paths(self):

? ? ? ? return self.image_paths

更詳細(xì)的內(nèi)容在set_input這個函數(shù)里。

self.image_paths = input['A_paths' if AtoB else 'B_paths']

那么其中的A_path和B_path又分別是什么呢?

重點是找到set_input函數(shù)的括號里的input.

遇到問題2:只能處理256*256大小的圖像

解決辦法:1024*1024大小的圖像可以拆分成4*4個256*256大小的圖像,然后拼接。

最后編輯于
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時請結(jié)合常識與多方信息審慎甄別。
平臺聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點,簡書系信息發(fā)布平臺,僅提供信息存儲服務(wù)。

相關(guān)閱讀更多精彩內(nèi)容

  • (190114 更新一下,我沒有碰到過安裝問題,所以有關(guān)安裝的問題, 我也愛莫能助。。) 今天介紹一下,我經(jīng)常用的...
    MrFred_4606閱讀 504評論 0 0
  • 1、安裝tensorflow 在anaconda prompt中 用conda list 查看已安裝的庫 2、py...
    Sshaylee閱讀 444評論 0 0
  • Huawei launches new $2,600 foldable 5G phone to rival Sam...
    白池染閱讀 1,939評論 0 1
  • 今天練車了,感覺要熱化。還有實驗報告,快了快了。今天也讀到了一個家族的故事。
    carpediem_2ca9閱讀 178評論 0 0
  • 感謝我的雙腿,帶我給兒子買口罩,讓我自由的生活,謝謝謝謝謝謝 感謝我的雙眼,讓我閱讀優(yōu)美的文字,讓我看到帥氣的兒子...
    寧曦閱讀 151評論 0 0

友情鏈接更多精彩內(nèi)容