Skip to content

Commit

Permalink
add ncnn file lol
Browse files Browse the repository at this point in the history
  • Loading branch information
TNTwise committed May 15, 2024
1 parent f5e8b93 commit 59344c6
Showing 1 changed file with 39 additions and 0 deletions.
39 changes: 39 additions & 0 deletions src/torch/rife/NCNN.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
from rife_ncnn_vulkan_python import Rife
from src.programData.thisdir import thisdir as ts
import os
import numpy as np
thisdir = ts()
class RifeNCNN:
def __init__(self,
interpolation_factor,
interpolate_method,
width,
height,
ensemble,
half,
threads=2,
ncnn_gpu=0,):

self.interpolation_factor = interpolation_factor
self.interpolation_method = interpolate_method
self.width = width
self.height = height
self.ensemble = ensemble
self.half = half
self.handleModel()
self.createInterpolation(ncnn_gpu=ncnn_gpu,threads=threads)
def handleModel(self):
self.modelPath = os.path.join(thisdir,"models","rife",self.interpolation_method)
def createInterpolation(self,
ncnn_gpu=0,
threads=2):
self.render = Rife(gpuid=ncnn_gpu,
num_threads=threads,
model=self.modelPath,
uhd_mode=False)
def run1(self,i0,i1):
self.i0 = i0
self.i1 = i1
def make_inference(self,n):
return np.ascontiguousarray(self.render.process_cv2(self.i0,self.i1,timestep=n))

0 comments on commit 59344c6

Please sign in to comment.