From 8b53d0f086f44723cb6e101c12e42e63fb4c6a63 Mon Sep 17 00:00:00 2001 From: lltcggie Date: Fri, 23 Nov 2018 23:29:30 +0900 Subject: [PATCH] =?UTF-8?q?=E5=90=84=E7=A8=AE=E3=82=B3=E3=83=9E=E3=83=B3?= =?UTF-8?q?=E3=83=89=E3=83=A9=E3=82=A4=E3=83=B3=E3=82=AA=E3=83=97=E3=82=B7?= =?UTF-8?q?=E3=83=A7=E3=83=B3=E3=81=ABcunet=E8=BF=BD=E5=8A=A0=20resolved?= =?UTF-8?q?=20#132?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- waifu2x-caffe-gui/MainDialog.cpp | 34 ++++++++++++-------------------- waifu2x-caffe-gui/MainDialog.h | 12 +++++++++++ waifu2x-caffe/Source.cpp | 2 +- 3 files changed, 26 insertions(+), 22 deletions(-) diff --git a/waifu2x-caffe-gui/MainDialog.cpp b/waifu2x-caffe-gui/MainDialog.cpp index 8cac70c..1556071 100644 --- a/waifu2x-caffe-gui/MainDialog.cpp +++ b/waifu2x-caffe-gui/MainDialog.cpp @@ -2242,15 +2242,13 @@ void DialogEvent::Create(HWND hWnd, WPARAM wParam, LPARAM lParam, LPVOID lpData) false, 0, &cmdNoOverwriteConstraint, cmd); std::vector cmdModelTypeConstraintV; - cmdModelTypeConstraintV.push_back(L"upconv_7_anime_style_art_rgb"); - cmdModelTypeConstraintV.push_back(L"upconv_7_photo"); - cmdModelTypeConstraintV.push_back(L"anime_style_art_rgb"); - cmdModelTypeConstraintV.push_back(L"photo"); - cmdModelTypeConstraintV.push_back(L"anime_style_art_y"); - cmdModelTypeConstraintV.push_back(L"upresnet10"); + for (int i = 0; i < eModelTypeEnd; i++) + { + cmdModelTypeConstraintV.push_back(ModelTypeList[i]); + } TCLAPW::ValuesConstraint cmdModelTypeConstraint(cmdModelTypeConstraintV); TCLAPW::ValueArg cmdModelType(L"y", L"model_type", L"model type", - false, L"upconv_7_anime_style_art_rgb", &cmdModelTypeConstraint, cmd); + false, DefaultModelType, &cmdModelTypeConstraint, cmd); // definition of command line argument : end @@ -2506,20 +2504,14 @@ void DialogEvent::Create(HWND hWnd, WPARAM wParam, LPARAM lParam, LPVOID lpData) if (cmdModelType.isSet()) { int index = 0; - if (cmdModelType.getValue() == L"upconv_7_anime_style_art_rgb") - index = 0; - else if (cmdModelType.getValue() == L"upconv_7_photo") - index = 1; - else if (cmdModelType.getValue() == L"anime_style_art_rgb") - index = 2; - else if (cmdModelType.getValue() == L"photo") - index = 3; - else if (cmdModelType.getValue() == L"anime_style_art_y") - index = 4; - else if (cmdModelType.getValue() == L"upresnet10") - index = 4; - else - index = 0; + for (int i = 0; i < eModelTypeEnd; i++) + { + if (cmdModelType.getValue() == ModelTypeList[i]) + { + index = i; + break; + } + } SendMessage(GetDlgItem(dh, IDC_COMBO_MODEL), CB_SETCURSEL, index, 0); diff --git a/waifu2x-caffe-gui/MainDialog.h b/waifu2x-caffe-gui/MainDialog.h index 0a43f86..102d7dd 100644 --- a/waifu2x-caffe-gui/MainDialog.h +++ b/waifu2x-caffe-gui/MainDialog.h @@ -46,6 +46,18 @@ const tstring ModelPathList[eModelTypeEnd] = { TEXT("models/cunet"), }; +const std::wstring ModelTypeList[eModelTypeEnd] = { + L"upconv_7_anime_style_art_rgb", + L"upconv_7_photo", + L"anime_style_art_rgb", + L"photo", + L"anime_style_art_y", + L"upresnet10", + L"cunet", +}; + +const std::wstring DefaultModelType = ModelTypeList[DefaultModel]; + const std::wstring ModelTitleLangKeyList[eModelTypeEnd] = { L"IDC_RADIO_MODEL_UPCONV_RGB", L"IDC_RADIO_MODEL_UPCONV_PHOTO", diff --git a/waifu2x-caffe/Source.cpp b/waifu2x-caffe/Source.cpp index 241b233..6fb3f58 100644 --- a/waifu2x-caffe/Source.cpp +++ b/waifu2x-caffe/Source.cpp @@ -155,7 +155,7 @@ int main(int argc, char** argv) ValueArg cmdModelPath(TEXT(""), TEXT("model_dir"), TEXT("path to custom model directory (don't append last / )"), false, - TEXT("models/upconv_7_anime_style_art_rgb"), TEXT("string"), cmd); + TEXT("models/cunet"), TEXT("string"), cmd); std::vector cmdProcessConstraintV; cmdProcessConstraintV.push_back(TEXT("cpu"));