ucbdrive / hd3

Code for Hierarchical Discrete Distribution Decomposition for Match Density Estimation (CVPR 2019)
BSD 3-Clause "New" or "Revised" License
204 stars 31 forks source link

replace FunctionCorrelation cupy GPU #33

Closed duongpaKikai closed 4 years ago

duongpaKikai commented 4 years ago

We have run hd3 with us video and result very good We want to convert hd3 => TorchScript to add us program run in C++ demo for boss But when script model we get error with re.search('(SIZE_)([0-4])(\()([^\)]*)(\))', strKernel) in cupy of _FunctionCorrelation

So whether have way replace calculate Correlation with cupy. just use operator between tensor with tensor on cpu

many thank

yzcjtr commented 4 years ago

Maybe this CPU implementation of correlation (https://github.com/ClementPinard/Pytorch-Correlation-extension) can serve your purpose?

duongpaKikai commented 4 years ago

@yzcjtr thank for your help but i need implementation under form like operator of tensor pytorch because i want convert to Script model (Script model not support cupy)

yzcjtr commented 4 years ago

I believe the implementation I referenced above doesn't use cupy. It should support CPU execution as well. Anyway, there's no off-the-shelf correlation operator in official PyTorch till now I believe. Though you can find one in tensorflow addons (https://www.tensorflow.org/addons/api_docs/python/tfa/layers/CorrelationCost).

duongpaKikai commented 4 years ago

@yzcjtr its so helpfull Thank for your help