Skip to content

Commit

Permalink
fixed rife-ncnn
Browse files Browse the repository at this point in the history
  • Loading branch information
NevermindNilas committed Mar 17, 2024
1 parent c49c892 commit c3e5316
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 9 deletions.
2 changes: 1 addition & 1 deletion TheAnimeScripter.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ var panelGlobal = this;
var TheAnimeScripter = (function() {

var scriptName = "TheAnimeScripter";
var scriptVersion = "v1.4.7";
var scriptVersion = "v1.4.8";

// Default Values for the settings
var outputFolder = app.settings.haveSetting(scriptName, "outputFolder") ? app.settings.getSetting(scriptName, "outputFolder") : "undefined";
Expand Down
4 changes: 2 additions & 2 deletions build.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ def create_executable():
main_path = os.path.join(base_dir, "main.py")
icon_path = os.path.join(base_dir, "demos", "icon.ico")
rife_ncnn_models_path = os.path.join(
distribution("rife_ncnn_vulkan_python_TAS").locate_file("rife_ncnn_vulkan_python"),
distribution("rife_ncnn_vulkan_python").locate_file("rife_ncnn_vulkan_python"),
"models",
)

Expand All @@ -62,7 +62,7 @@ def create_executable():
"--add-data",
f"{universal_ncnn_models_path};upscale_ncnn_py/models",
"--hidden-import",
"rife_ncnn_vulkan_python.rife_ncnn_vulkan_python_wrapper",
"rife_ncnn_vulkan_python_tas.rife_ncnn_vulkan_python_wrapper",
"--hidden-import",
"upscale_ncnn_py.upscale_ncnn_py_wrapper",
"--collect-all",
Expand Down
2 changes: 1 addition & 1 deletion main.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
else:
mainPath = os.path.dirname(os.path.abspath(__file__))

scriptVersion = "1.4.7"
scriptVersion = "1.4.8"
warnings.filterwarnings("ignore")


Expand Down
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,5 @@ realcugan-ncnn-py
pytorch-lightning
torch
torchvision
https://github.com/NevermindNilas/TAS-Modes-Host/releases/download/main/rife_ncnn_vulkan_python_TAS-2.0.6-cp312-cp312-win_amd64.whl
https://github.com/NevermindNilas/TAS-Modes-Host/releases/download/main/rife_ncnn_vulkan_python-1.2.1-cp312-cp312-win_amd64.whl
https://github.com/NevermindNilas/TAS-Modes-Host/releases/download/main/upscale_ncnn_py-1.2.0-cp312-none-win_amd64.whl
7 changes: 6 additions & 1 deletion src/initializeModels.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,12 @@ def intitialize_models(self):
from src.rifencnn.rifencnn import rifeNCNN

interpolate_process = rifeNCNN(
UHD, self.interpolate_method, self.ensemble
UHD,
self.interpolate_method,
self.ensemble,
self.nt,
new_width,
new_height,
)
case "gmfss":
from src.gmfss.gmfss_fortuna_union import GMFSS
Expand Down
10 changes: 7 additions & 3 deletions src/rifencnn/rifencnn.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
from rife_ncnn_vulkan_python import Rife

class rifeNCNN:
def __init__(self, UHD, interpolate_method, ensemble=False):
def __init__(self, UHD, interpolate_method, ensemble=False, nt=1, width=1920, height=1080):
self.UHD = UHD
self.interpolate_method = interpolate_method
self.nt = nt
self.height = height
self.width = width

# Since the built in models folder use the default naming without
# Ncnn or other suffixes, we need to change the name to match the
Expand All @@ -30,13 +33,14 @@ def __init__(self, UHD, interpolate_method, ensemble=False):
tta_mode=False,
tta_temporal_mode=False,
uhd_mode=self.UHD,
num_threads=1,
num_threads=self.nt,
)

self.frame1 = None
self.shape = (self.height, self.width)

def make_inference(self, timestep):
output = self.rife.process(self.frame1, self.frame2, timestep=timestep)
output = self.rife.process(self.frame1, self.frame2, timestep=timestep, shape=self.shape)

return output

Expand Down

0 comments on commit c3e5316

Please sign in to comment.