Real-Time Super-Resolution System of 4K-Video Based on Deep Learning----閱讀階段
本篇主要記錄分享,github上的具體操作與實踐,實作一次完整的test實踐,
再次,感謝作者分享他們的研究成果及代碼
文章地址:Real-Time Super-Resolution System of 4K-Video Based on Deep Learning
參考申明 :
Yanpeng Cao, Chengcheng Wang, Changjun Song, Yongming Tang and He Li. EGVSR. https://github.com/Thmen/EGVSR, 2021.
@misc{thmen2021egvsr,
author = {Yanpeng Cao, Chengcheng Wang, Changjun Song, Yongming Tang and He Li},
title = {EGVSR},
howpublished = {\url{https://github.com/Thmen/EGVSR}},
year = {2021}
}
正文
基礎:ubuntu18.04 anaconda3
專案地址 先大致閱讀一遍相關內容,再進行具體實踐;閱讀程序中主要檢查自身配置是否能夠滿足專案所需要的環境(Dependencies & Experimental Environment)以及其相關的注意事項,筆者主要以test進行具體操作:
1.ubuntu終端下載Github
git clone + github專案git鏈接
如果提示無git命令,就安裝git命令,以下陳述句作用相同,根據情況嘗試,
sudo apt install git
sudo pip3 install git
pip install git #筆者常用 conda中缺module
2.安裝requirements.txt配置環境
根據專案的Dependencies ,可以在專案檔案夾中,找到requirements.txt,與其作用相同,因此直接install requirements.txt即可:

這里筆者使用的是Anaconda3創建的虛擬環境
conda create -n py37 python=3.7 #命令創建一個名稱為py37的python版本為3.7的虛擬環境
source activate py37 #進入虛擬環境

且安裝時需要cd到requirements.txt的同一目錄下,ls 查看目錄,cd進入目錄

conda install --yes --file requirements.txt
3.下載Testing Datasets
根據要求解壓到對應檔案夾

4. 運行test.sh
如果成功運行,那么test也就到此結束,
sh test.sh
5.問題羅列
但是,很明顯,真正的問題才剛剛開始出現;尤其對python略知一二的我還是面臨了巨大挑戰,
問題1:error:??????excepted one_argument
usage: main.py [-h] --exp_dir EXP_DIR --mode MODE --model MODEL --opt OPT
[--gpu_id GPU_ID] [--lr_size LR_SIZE] [--test_speed]
main.py: error: argument --model: expected one argument

解決:
方法一:修改main.py(有效性強)
方法二:修改test.sh,或者將相關引數直接以命令列輸入到終端
(筆者同時對main.py和test.sh都作了修改)

問題2:import相關module,其在Vscode樣式為白色,初步判定為未import成功
解決:現學python
【Python學習】08 函式|實參和形參|回傳值1-4
【Python學習】08 函式模塊化6
【Python學習】09 類
然后,觀察到main.py等檔案中相關import失敗,經過查找資料,判定為此時相關的module與main.py不在同一目錄下,因此import需要修改,
import torch
import utils.base_utils as base_utils #筆者修改
import utils.data_utils as data_utils #筆者修改
from data.__init__ import create_dataloader, prepare_data #筆者修改
#from data import create_dataloader, prepare_data #原import方式,注釋
from models import define_model
from models.networks import define_generator
from metrics.metric_calculator import MetricCalculator
from metrics.model_summary import register, profile_model
#from utils import base_utils, data_utils #原import方式,注釋
問題3:_pickle.UnpicklingError: A load persistent id instruction was encountered,
but no persistent_load function was specified.
解決:報錯點在net.load_state_dict(torch.load(load_path)) ,感覺load_state_dict好像不存在
,考慮是不是pytorch有什么注意項,隨后發現和pytorch的版本有很大的關聯,
專案雖然在Dependencies中表示Pytorch在1.0.0以上,但是其實際上還是有要求的,在其req.txt,這也是筆者慘痛的教訓(畢竟這個錯誤點花了很久很久的時間才解決)
這里明確了torch==1.7.1查詢Pytorch_previous-versions,檢查對應版本進行安裝
conda install pytorch==1.7.1 torchvision==0.8.2 torchaudio==0.7.2 cudatoolkit=10.1 -c pytorch
總結:
以上問題按出現順序進行整理,僅代表個人判斷和解決方式, test成功!
轉載請註明出處,本文鏈接:https://www.uj5u.com/qita/292148.html
標籤:其他
上一篇:聲音分類及其實戰(二)
