比賽記錄(一)
一、AI換裝:
1:模型安裝與調試
Viton -Gan
項目地址:
https://github.com/shionhonda/viton-gan
clone好以後,目錄中只有文件,沒有文件夾,缺少:
1:編譯環境,torch -gpu版本地址:鏈接:https://pan.baidu.com/s/1d6ThY0AlhDF-cJQenL8vLw
提取碼:j784 通過pip install XXXXXXX.whl安裝 (python3.7, 64位,cuda爲10.2)
通過pip或者conda安裝:https://pytorch.org/見此
如圖:
其餘的基本上就是個個可視化的,直接安裝就行。
2:需要下載data數據集:包含:
見此:https://pan.baidu.com/share/init?surl=bdB3mdWBAD8-5uYoa3Kp4Q 提取碼:8aum
腳本介紹,以及後續運行順序
說明:
2:代碼運行
運行train_gmm
如果運行報錯:
Traceback (most recent call last):
File "train.py", line 191, in <module>
main()
File "train.py", line 176, in main
train_gmm(opt, train_loader, model, board)
File "train.py", line 58, in train_gmm
inputs = train_loader.next_batch()
File "/vton/cinastanbean-cp-vton/cp_dataset.py", line 166, in next_batch
...
tensor.sub_(mean[:, None, None]).div_(std[:, None, None])
RuntimeError: output with shape [1, 256, 192] doesn't match the broadcast shape [3, 256, 192]
self.transform = transforms.Compose([ \
transforms.ToTensor(), \
transforms.Normalize((0.5, 0.5, 0.5), (0.5, 0.5, 0.5))])
self.transform = transforms.Compose([ \
transforms.ToTensor(), \
transforms.Normalize((0.5,), (0.5,))])
測試時,不用改epoch爲100,測試用1-10就行
會在:
裏面的GMM打開:
3:運行run_gmm
要是報runtime錯,請修改batchsize,降低到6左右
要是報一個out of memenoy 請降低n_worker 爲0-4左右
然後運行結束後會在data /train 和test 或者val中各添加兩個擬合,與掩碼圖片:
4,然後就運行train _tom
需要一個VGG19模型,請點擊:https://blog.csdn.net/Da_Yuan8421/article/details/88836970
寫錯了。應該是torch 下面的checkpoints裏面
運行train_tom這個是生成最後的擬合模型,根據你的epoch數決定
會在根目錄的result裏面的TOM下生成模型pth
(這個我有訓練好65個epoch的)
然後就最後run_tom:
結果如圖:(只訓練了幾個epoch)
目標效果: