mirror of
https://github.com/lltcggie/waifu2x-caffe.git
synced 2025-06-26 13:42:48 +00:00
GUIでバッチサイズを設定できるようにした
CropSizeで出力が変わるモデルでCropSizeを変えずに高速化するため
This commit is contained in:
parent
6effe0dfaa
commit
1428d36cee
@ -97,5 +97,7 @@
|
|||||||
"IDC_STATIC_USE_GPU_NO":"Use GPU No",
|
"IDC_STATIC_USE_GPU_NO":"Use GPU No",
|
||||||
"IDC_RADIO_MODEL_UPCONV_RGB":"2-D illust (UpRGB Model)",
|
"IDC_RADIO_MODEL_UPCONV_RGB":"2-D illust (UpRGB Model)",
|
||||||
"IDC_RADIO_MODEL_UPCONV_PHOTO":"Photo (UpPhoto Model)",
|
"IDC_RADIO_MODEL_UPCONV_PHOTO":"Photo (UpPhoto Model)",
|
||||||
"MessageLogFatalError":"A fatal error has occurred.\r\nThere is a possibility the split size is too large"
|
"MessageLogFatalError":"A fatal error has occurred.\r\nThere is a possibility the split size is too large",
|
||||||
|
"IDC_STATIC_BATCH_SIZE":"Batch size",
|
||||||
|
"MessageBatchSizeCheckError":"Batch size must be greater than 0",
|
||||||
}
|
}
|
||||||
|
@ -97,5 +97,7 @@
|
|||||||
"IDC_STATIC_USE_GPU_NO":"使用GPU No",
|
"IDC_STATIC_USE_GPU_NO":"使用GPU No",
|
||||||
"IDC_RADIO_MODEL_UPCONV_RGB":"2次元イラスト (UpRGBモデル)",
|
"IDC_RADIO_MODEL_UPCONV_RGB":"2次元イラスト (UpRGBモデル)",
|
||||||
"IDC_RADIO_MODEL_UPCONV_PHOTO":"写真・アニメ (UpPhotoモデル)",
|
"IDC_RADIO_MODEL_UPCONV_PHOTO":"写真・アニメ (UpPhotoモデル)",
|
||||||
"MessageLogFatalError":"致命的なエラーが発生しました。\r\n分割サイズが大きすぎる可能性があります"
|
"MessageLogFatalError":"致命的なエラーが発生しました。\r\n分割サイズが大きすぎる可能性があります",
|
||||||
|
"IDC_STATIC_BATCH_SIZE":"バッチサイズ",
|
||||||
|
"MessageBatchSizeCheckError":"バッチサイズは0より大きい整数である必要があります"
|
||||||
}
|
}
|
||||||
|
@ -25,6 +25,8 @@
|
|||||||
|
|
||||||
const size_t AR_PATH_MAX(1024);
|
const size_t AR_PATH_MAX(1024);
|
||||||
|
|
||||||
|
const int MaxBatchSizeList = 20;
|
||||||
|
|
||||||
const int MinCommonDivisor = 50;
|
const int MinCommonDivisor = 50;
|
||||||
const int DefaultCommonDivisor = 128;
|
const int DefaultCommonDivisor = 128;
|
||||||
const std::pair<int, int> DefaultCommonDivisorRange = {90, 140};
|
const std::pair<int, int> DefaultCommonDivisorRange = {90, 140};
|
||||||
@ -38,6 +40,7 @@ const TCHAR * const MultiFileStr = TEXT("(Multi File)");
|
|||||||
|
|
||||||
const UINT_PTR nIDEventTimeLeft = 1000;
|
const UINT_PTR nIDEventTimeLeft = 1000;
|
||||||
|
|
||||||
|
|
||||||
LangStringList DialogEvent::langStringList;
|
LangStringList DialogEvent::langStringList;
|
||||||
HWND DialogEvent::dh;
|
HWND DialogEvent::dh;
|
||||||
|
|
||||||
@ -488,6 +491,22 @@ bool DialogEvent::SyncMember(const bool NotSyncCropSize, const bool silent)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
TCHAR buf[AR_PATH_MAX] = TEXT("");
|
||||||
|
GetWindowText(GetDlgItem(dh, IDC_COMBO_BATCH_SIZE), buf, _countof(buf));
|
||||||
|
buf[_countof(buf) - 1] = TEXT('\0');
|
||||||
|
|
||||||
|
TCHAR *ptr = nullptr;
|
||||||
|
batch_size = _tcstol(buf, &ptr, 10);
|
||||||
|
if (!ptr || *ptr != '\0' || batch_size <= 0)
|
||||||
|
{
|
||||||
|
batch_size = 1;
|
||||||
|
ret = false;
|
||||||
|
|
||||||
|
MessageBox(dh, langStringList.GetString(L"MessageBatchSizeCheckError").c_str(), langStringList.GetString(L"MessageTitleError").c_str(), MB_OK | MB_ICONERROR);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
use_tta = SendMessage(GetDlgItem(dh, IDC_CHECK_TTA), BM_GETCHECK, 0, 0) == BST_CHECKED;
|
use_tta = SendMessage(GetDlgItem(dh, IDC_CHECK_TTA), BM_GETCHECK, 0, 0) == BST_CHECKED;
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
@ -1116,6 +1135,8 @@ void DialogEvent::SaveIni(const bool isSyncMember)
|
|||||||
|
|
||||||
WritePrivateProfileString(TEXT("Setting"), TEXT("LastInputDirFix"), tInputDirFix.c_str(), getTString(SettingFilePath).c_str());
|
WritePrivateProfileString(TEXT("Setting"), TEXT("LastInputDirFix"), tInputDirFix.c_str(), getTString(SettingFilePath).c_str());
|
||||||
WritePrivateProfileString(TEXT("Setting"), TEXT("LastOutputDirFix"), tOutputDirFix.c_str(), getTString(SettingFilePath).c_str());
|
WritePrivateProfileString(TEXT("Setting"), TEXT("LastOutputDirFix"), tOutputDirFix.c_str(), getTString(SettingFilePath).c_str());
|
||||||
|
|
||||||
|
WritePrivateProfileString(TEXT("Setting"), TEXT("LastBatchSize"), to_tstring(batch_size).c_str(), getTString(SettingFilePath).c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
struct stFindParam
|
struct stFindParam
|
||||||
@ -1596,6 +1617,7 @@ void DialogEvent::SetWindowTextLang()
|
|||||||
SET_WINDOW_TEXT(IDC_BUTTON_OUTPUT_REF);
|
SET_WINDOW_TEXT(IDC_BUTTON_OUTPUT_REF);
|
||||||
SET_WINDOW_TEXT(IDC_BUTTON_APP_SETTING);
|
SET_WINDOW_TEXT(IDC_BUTTON_APP_SETTING);
|
||||||
SET_WINDOW_TEXT(IDC_BUTTON_CLEAR_OUTPUT_DIR);
|
SET_WINDOW_TEXT(IDC_BUTTON_CLEAR_OUTPUT_DIR);
|
||||||
|
SET_WINDOW_TEXT(IDC_STATIC_BATCH_SIZE);
|
||||||
|
|
||||||
#undef SET_WINDOW_TEXT
|
#undef SET_WINDOW_TEXT
|
||||||
|
|
||||||
@ -1794,6 +1816,21 @@ void DialogEvent::Create(HWND hWnd, WPARAM wParam, LPARAM lParam, LPVOID lpData)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
HWND hbatch = GetDlgItem(dh, IDC_COMBO_BATCH_SIZE);
|
||||||
|
|
||||||
|
// バッチサイズリストに数列を突っ込んでいく
|
||||||
|
int mindiff = INT_MAX;
|
||||||
|
int defaultListIndex = -1;
|
||||||
|
for(int i = 1; i <= MaxBatchSizeList; i++)
|
||||||
|
{
|
||||||
|
tstring str(to_tstring(i));
|
||||||
|
SendMessage(hbatch, CB_ADDSTRING, 0, (LPARAM)str.c_str());
|
||||||
|
}
|
||||||
|
|
||||||
|
SendMessage(hbatch, CB_SETCURSEL, 0, 0);
|
||||||
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
HWND hcrop = GetDlgItem(dh, IDC_COMBO_CROP_SIZE);
|
HWND hcrop = GetDlgItem(dh, IDC_COMBO_CROP_SIZE);
|
||||||
|
|
||||||
@ -1896,6 +1933,8 @@ void DialogEvent::Create(HWND hWnd, WPARAM wParam, LPARAM lParam, LPVOID lpData)
|
|||||||
GetPrivateProfileString(TEXT("Setting"), TEXT("LastOutputDirFix"), TEXT(""), tmp, _countof(tmp), getTString(SettingFilePath).c_str());
|
GetPrivateProfileString(TEXT("Setting"), TEXT("LastOutputDirFix"), TEXT(""), tmp, _countof(tmp), getTString(SettingFilePath).c_str());
|
||||||
tmp[_countof(tmp) - 1] = TEXT('\0');
|
tmp[_countof(tmp) - 1] = TEXT('\0');
|
||||||
tOutputDirFix = tmp;
|
tOutputDirFix = tmp;
|
||||||
|
|
||||||
|
batch_size = GetPrivateProfileInt(TEXT("Setting"), TEXT("LastBatchSize"), 1, getTString(SettingFilePath).c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
TCHAR *ptr = nullptr;
|
TCHAR *ptr = nullptr;
|
||||||
@ -2069,6 +2108,11 @@ void DialogEvent::Create(HWND hWnd, WPARAM wParam, LPARAM lParam, LPVOID lpData)
|
|||||||
else
|
else
|
||||||
SendMessage(GetDlgItem(hWnd, IDC_CHECK_TTA), BM_SETCHECK, BST_UNCHECKED, 0);
|
SendMessage(GetDlgItem(hWnd, IDC_CHECK_TTA), BM_SETCHECK, BST_UNCHECKED, 0);
|
||||||
|
|
||||||
|
if (1 <= batch_size && batch_size <= MaxBatchSizeList)
|
||||||
|
{
|
||||||
|
SendMessage(GetDlgItem(dh, IDC_COMBO_BATCH_SIZE), CB_SETCURSEL, batch_size - 1, 0);
|
||||||
|
}
|
||||||
|
|
||||||
SetWindowText(GetDlgItem(hWnd, IDC_EDIT_SCALE_RATIO), tScaleRatio.c_str());
|
SetWindowText(GetDlgItem(hWnd, IDC_EDIT_SCALE_RATIO), tScaleRatio.c_str());
|
||||||
SetWindowText(GetDlgItem(hWnd, IDC_EDIT_SCALE_WIDTH), tScaleWidth.c_str());
|
SetWindowText(GetDlgItem(hWnd, IDC_EDIT_SCALE_WIDTH), tScaleWidth.c_str());
|
||||||
SetWindowText(GetDlgItem(hWnd, IDC_EDIT_SCALE_HEIGHT), tScaleHeight.c_str());
|
SetWindowText(GetDlgItem(hWnd, IDC_EDIT_SCALE_HEIGHT), tScaleHeight.c_str());
|
||||||
@ -2440,7 +2484,8 @@ void DialogEvent::Create(HWND hWnd, WPARAM wParam, LPARAM lParam, LPVOID lpData)
|
|||||||
|
|
||||||
if (cmdBatchSizeFile.isSet())
|
if (cmdBatchSizeFile.isSet())
|
||||||
{
|
{
|
||||||
batch_size = cmdBatchSizeFile.getValue();
|
SetWindowText(GetDlgItem(dh, IDC_COMBO_CROP_SIZE), to_tstring(cmdCropSizeFile.getValue()).c_str());
|
||||||
|
//batch_size = cmdBatchSizeFile.getValue();
|
||||||
|
|
||||||
isSetParam = true;
|
isSetParam = true;
|
||||||
}
|
}
|
||||||
|
Binary file not shown.
Binary file not shown.
Loading…
x
Reference in New Issue
Block a user