Lock pre-4.0 rife ncnn models to 2x

This commit is contained in:
n00mkrad
2022-04-17 18:39:32 +02:00
parent 9c695a3837
commit 2ac003a1b1
3 changed files with 12 additions and 3 deletions

View File

@@ -135,7 +135,7 @@ namespace Flowframes.IO
public static async Task DownloadModelFiles (AI ai, string modelDir, bool log = true)
{
string aiDir = ai.pkgDir;
Logger.Log($"DownloadModelFiles(string ai = {ai}, string model = {modelDir}, bool log = {log})", true);
Logger.Log($"DownloadModelFiles(string ai = {ai.aiName}, string model = {modelDir}, bool log = {log})", true);
try
{

View File

@@ -272,11 +272,12 @@ namespace Flowframes.Os
SetProgressCheck(outPath, factor);
int targetFrames = ((IoUtils.GetAmountOfFiles(lastInPath, false, "*.*") * factor).RoundToInt()); // TODO: Maybe won't work with fractional factors ??
string frames = mdl.Contains("v4") ? $"-n {targetFrames}" : "";
string uhdStr = await InterpolateUtils.UseUhd() ? "-u" : "";
string ttaStr = Config.GetBool(Config.Key.rifeNcnnUseTta, false) ? "-x" : "";
rifeNcnn.StartInfo.Arguments = $"{OsUtils.GetCmdArg()} cd /D {Path.Combine(Paths.GetPkgPath(), Implementations.rifeNcnn.pkgDir).Wrap()} & rife-ncnn-vulkan.exe " +
$" -v -i {inPath.Wrap()} -o {outPath.Wrap()} -n {targetFrames} -m {mdl.ToLower()} {ttaStr} {uhdStr} -g {Config.Get(Config.Key.ncnnGpus)} -f {GetNcnnPattern()} -j {GetNcnnThreads()}";
$" -v -i {inPath.Wrap()} -o {outPath.Wrap()} {frames} -m {mdl.ToLower()} {ttaStr} {uhdStr} -g {Config.Get(Config.Key.ncnnGpus)} -f {GetNcnnPattern()} -j {GetNcnnThreads()}";
Logger.Log("cmd.exe " + rifeNcnn.StartInfo.Arguments, true);

View File

@@ -157,7 +157,15 @@ namespace Flowframes.Ui
{
AI ai = Program.mainForm.GetAi();
if(ai.factorSupport == AI.FactorSupport.Fixed)
if (ai.aiName == Implementations.rifeNcnn.aiName && !Program.mainForm.GetModel(ai).dir.Contains("v4"))
{
if (factor != 2)
Logger.Log($"{ai.friendlyName} models before 4.0 only support 2x interpolation!");
return 2;
}
if (ai.factorSupport == AI.FactorSupport.Fixed)
{
int closest = ai.supportedFactors.Min(i => (Math.Abs(factor.RoundToInt() - i), i)).i;
return (float)closest;