mirror of
https://github.com/lltcggie/waifu2x-caffe.git
synced 2025-06-26 21:52:49 +00:00
caffemodelとprototxtのみが存在してjsonとprototxt.protobinが存在しない状況でもエラーを吐かないようにした
This commit is contained in:
parent
b280d34413
commit
a17ad89116
@ -280,8 +280,20 @@ Waifu2x::eWaifu2xError cNet::ConstractNet(const Waifu2x::eWaifu2xModelType mode,
|
|||||||
const auto retModelBin = readProtoBinary(modelbin_path, ¶m_model);
|
const auto retModelBin = readProtoBinary(modelbin_path, ¶m_model);
|
||||||
const auto retParamBin = readProtoBinary(caffemodel_path, ¶m_caffemodel);
|
const auto retParamBin = readProtoBinary(caffemodel_path, ¶m_caffemodel);
|
||||||
|
|
||||||
if (retModelBin == Waifu2x::eWaifu2xError_OK && retParamBin == Waifu2x::eWaifu2xError_OK)
|
if ( retParamBin == Waifu2x::eWaifu2xError_OK &&
|
||||||
|
(retModelBin == Waifu2x::eWaifu2xError_OK || retModelBin == Waifu2x::eWaifu2xError_FailedOpenModelFile))
|
||||||
{
|
{
|
||||||
|
if (retModelBin == Waifu2x::eWaifu2xError_FailedOpenModelFile) // protobinのみが読み込めなかったときはprototxtから読み込む(ついでにprotobinも書き込む)
|
||||||
|
{
|
||||||
|
ret = readProtoText(model_path, ¶m_model);
|
||||||
|
if (ret != Waifu2x::eWaifu2xError_OK)
|
||||||
|
return ret;
|
||||||
|
|
||||||
|
ret = writeProtoBinary(param_model, modelbin_path);
|
||||||
|
if (ret != Waifu2x::eWaifu2xError_OK)
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
ret = SetParameter(param_model, process);
|
ret = SetParameter(param_model, process);
|
||||||
if (ret != Waifu2x::eWaifu2xError_OK)
|
if (ret != Waifu2x::eWaifu2xError_OK)
|
||||||
return ret;
|
return ret;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user