axinc-ai / ailia-models

The collection of pre-trained, state-of-the-art AI models for ailia SDK
1.98k stars 316 forks source link

ADD DAIN #417

Open kyakuno opened 3 years ago

kyakuno commented 3 years ago

Frame interpolation

https://github.com/baowenbo/DAIN MIT

DAIN ncnn vulkan https://github.com/nihui/dain-ncnn-vulkan

ooe1123 commented 3 years ago

以下のエラーのため、特定のバージョンのscipyを入れる。 pip install scipy==1.1.0

Traceback (most recent call last):
  File "demo_MiddleBury.py", line 13, in <module>
    from scipy.misc import imread, imsave
ImportError: cannot import name 'imread' from 'scipy.misc' (/usr/local/lib/python3.7/dist-packages/scipy/misc/__init__.py)
ooe1123 commented 3 years ago

CUDAエクステンションをビルドするために、pytorch==1.4.0 以前を入れる。

ooe1123 commented 3 years ago

試しにエクスポートを試みると以下のエラーが発生する。

  File "/content/DAIN/PWCNet/correlation_package_pytorch1_0/correlation.py", line 59, in forward
    result = CorrelationFunction(self.pad_size, self.kernel_size, self.max_displacement,self.stride1, self.stride2, self.corr_multiply)(input1, input2)
RuntimeError: Attempted to trace CorrelationFunction, but tracing of legacy functions is not supported

torch.autograd.Function を継承したモジュールを使っているのが原因のようだったので、 torch.autograd.Function を単純に torch.nn.Module に置き換えてみたところ、 ( class CorrelationFunction(Function) → class CorrelationFunction(nn.Module) ) 推論だけは行えるが、エクスポート時には以下の別のエラーが発生する。

  File "/content/DAIN/PWCNet/correlation_package_pytorch1_0/correlation.py", line 30, in forward
    self.pad_size, self.kernel_size, self.max_displacement,self.stride1, self.stride2, self.corr_multiply)
IndexError: _Map_base::at