2022-07-06 10:40:41 +02:00
|
|
|
|
using Flowframes.Os;
|
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
|
using System.Linq;
|
2021-08-23 16:50:18 +02:00
|
|
|
|
|
|
|
|
|
|
namespace Flowframes.Data
|
|
|
|
|
|
{
|
|
|
|
|
|
class Implementations
|
|
|
|
|
|
{
|
2022-07-26 21:08:07 +02:00
|
|
|
|
public static AI rifeCuda = new AI()
|
|
|
|
|
|
{
|
|
|
|
|
|
Backend = AI.AiBackend.Pytorch,
|
|
|
|
|
|
NameInternal = "RIFE_CUDA",
|
|
|
|
|
|
NameLong = "Real-Time Intermediate Flow Estimation",
|
|
|
|
|
|
FactorSupport = AI.InterpFactorSupport.AnyInteger,
|
|
|
|
|
|
SupportedFactors = new int[] { 2, 3, 4, 5, 6, 7, 8, 9, 10 }
|
|
|
|
|
|
};
|
2021-08-31 00:09:47 +02:00
|
|
|
|
|
2022-07-26 21:08:07 +02:00
|
|
|
|
public static AI rifeNcnn = new AI()
|
|
|
|
|
|
{
|
|
|
|
|
|
Backend = AI.AiBackend.Ncnn,
|
|
|
|
|
|
NameInternal = "RIFE_NCNN",
|
|
|
|
|
|
NameLong = "Real-Time Intermediate Flow Estimation",
|
|
|
|
|
|
FactorSupport = AI.InterpFactorSupport.AnyFloat,
|
|
|
|
|
|
SupportedFactors = new int[] { 2, 3, 4, 5, 6, 7, 8, 9, 10 },
|
|
|
|
|
|
};
|
2022-07-23 14:43:57 +02:00
|
|
|
|
|
2022-07-26 21:08:07 +02:00
|
|
|
|
public static AI rifeNcnnVs = new AI()
|
|
|
|
|
|
{
|
|
|
|
|
|
Backend = AI.AiBackend.Ncnn,
|
|
|
|
|
|
NameInternal = "RIFE_NCNN_VS",
|
|
|
|
|
|
NameLong = "Real-Time Intermediate Flow Estimation",
|
|
|
|
|
|
FactorSupport = AI.InterpFactorSupport.AnyFloat,
|
|
|
|
|
|
SupportedFactors = new int[] { 2, 3, 4, 5, 6, 7, 8, 9, 10 },
|
|
|
|
|
|
Piped = true
|
|
|
|
|
|
};
|
2022-06-01 16:23:00 +02:00
|
|
|
|
|
2022-07-26 21:08:07 +02:00
|
|
|
|
public static AI flavrCuda = new AI()
|
|
|
|
|
|
{
|
|
|
|
|
|
Backend = AI.AiBackend.Pytorch,
|
|
|
|
|
|
NameInternal = "FLAVR_CUDA",
|
|
|
|
|
|
NameLong = "Flow-Agnostic Video Representations",
|
|
|
|
|
|
FactorSupport = AI.InterpFactorSupport.AnyFloat,
|
|
|
|
|
|
SupportedFactors = new int[] { 2, 4, 8 },
|
|
|
|
|
|
};
|
2021-08-31 00:09:47 +02:00
|
|
|
|
|
2022-07-26 21:08:07 +02:00
|
|
|
|
public static AI dainNcnn = new AI()
|
|
|
|
|
|
{
|
|
|
|
|
|
Backend = AI.AiBackend.Ncnn,
|
|
|
|
|
|
NameInternal = "DAIN_NCNN",
|
|
|
|
|
|
NameLong = "Depth-Aware Video Frame Interpolation",
|
|
|
|
|
|
FactorSupport = AI.InterpFactorSupport.AnyFloat,
|
|
|
|
|
|
SupportedFactors = new int[] { 2, 3, 4, 5, 6, 7, 8 },
|
|
|
|
|
|
};
|
2021-08-31 00:09:47 +02:00
|
|
|
|
|
2022-07-26 21:08:07 +02:00
|
|
|
|
public static AI xvfiCuda = new AI()
|
|
|
|
|
|
{
|
|
|
|
|
|
Backend = AI.AiBackend.Pytorch,
|
|
|
|
|
|
NameInternal = "XVFI_CUDA",
|
|
|
|
|
|
NameLong = "eXtreme Video Frame Interpolation",
|
|
|
|
|
|
FactorSupport = AI.InterpFactorSupport.AnyInteger,
|
|
|
|
|
|
SupportedFactors = new int[] { 2, 3, 4, 5, 6, 7, 8, 9, 10 },
|
|
|
|
|
|
};
|
2021-08-23 16:50:18 +02:00
|
|
|
|
|
2022-07-26 21:08:07 +02:00
|
|
|
|
public static AI ifrnetNcnn = new AI()
|
|
|
|
|
|
{
|
|
|
|
|
|
Backend = AI.AiBackend.Ncnn,
|
|
|
|
|
|
NameInternal = "IFRNet_NCNN",
|
|
|
|
|
|
NameLong = "Intermediate Feature Refine Network",
|
|
|
|
|
|
FactorSupport = AI.InterpFactorSupport.Fixed,
|
|
|
|
|
|
SupportedFactors = new int[] { 2 },
|
|
|
|
|
|
};
|
2022-05-31 22:17:22 +02:00
|
|
|
|
|
2022-07-21 09:30:59 +02:00
|
|
|
|
|
2022-07-06 10:40:41 +02:00
|
|
|
|
public static List<AI> NetworksAll
|
|
|
|
|
|
{
|
|
|
|
|
|
get
|
|
|
|
|
|
{
|
2022-07-22 01:26:47 +02:00
|
|
|
|
return new List<AI> { rifeCuda, rifeNcnnVs, rifeNcnn, flavrCuda, dainNcnn, xvfiCuda, ifrnetNcnn };
|
2022-07-06 10:40:41 +02:00
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public static List<AI> NetworksAvailable
|
|
|
|
|
|
{
|
|
|
|
|
|
get
|
|
|
|
|
|
{
|
|
|
|
|
|
bool pytorchAvailable = Python.IsPytorchReady();
|
2022-07-06 21:53:32 +02:00
|
|
|
|
|
|
|
|
|
|
if (pytorchAvailable)
|
|
|
|
|
|
return NetworksAll;
|
|
|
|
|
|
else
|
|
|
|
|
|
return NetworksAll.Where(x => x.Backend != AI.AiBackend.Pytorch).ToList();
|
2022-07-06 10:40:41 +02:00
|
|
|
|
}
|
|
|
|
|
|
}
|
2021-08-23 16:50:18 +02:00
|
|
|
|
|
2022-07-06 10:40:41 +02:00
|
|
|
|
public static AI GetAi(string aiName)
|
2021-08-23 16:50:18 +02:00
|
|
|
|
{
|
2022-07-06 10:40:41 +02:00
|
|
|
|
foreach (AI ai in NetworksAll)
|
2021-08-23 16:50:18 +02:00
|
|
|
|
{
|
2022-07-21 10:08:53 +02:00
|
|
|
|
if (ai.NameInternal == aiName)
|
2021-08-23 16:50:18 +02:00
|
|
|
|
return ai;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2022-06-09 00:30:58 +02:00
|
|
|
|
Logger.Log($"AI implementation lookup failed! This should not happen! Please tell the developer! (Implementations.cs)");
|
2022-07-06 10:40:41 +02:00
|
|
|
|
return NetworksAll[0];
|
2021-08-23 16:50:18 +02:00
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|