Closed RocketFlash closed 3 years ago
JIT compiler supports only bullion operators.
The DHT
module is a C++ extension that cannot be recognized
by the JIT compiler.
An ugly workaround here is to only convert the backbone and then fed the features to DHT module.
@zeakey What if I reimplement DHT
on PyTorch? How much do you think inference will slow down? If DHT
will be on pure PyTorch, so it will be easy to convert the model to Torchscript and run the code on CPU, righ ?
@RocketFlash The naive version of DHT that does not parallel at all will slow down about 1000x.
OMG :(
Do you have pure torch implementation code? Could you share it if you have ?
@RocketFlash Sorry, the implementation of the python version of DHT is only used in the early time of the project to verify the correctness and speedup. But I can't find it now. It just uses many loop blocks and you can refer to the OpenCV implementation (HT) on a single feature map.
@Hanqer could you explain, why you're adding value from featuremap in cuda code?
float val = feat[imgIndex];
atomicAdd(&(output[outIndex]), val);
I didn't get an idea, why not just adding 1 in accumulator?
@RocketFlash DHT accumulates the feature values instead of counting the quantized number. This is different from the original Hough Transform. You can refer to Eq.(4) in the paper.
Got it, thank you ! :)
Hi! Is it possible to convert trained model to torchscript using
torch.jit.trace
ortorch.jit.script
? I tried to convert trained model, it can be converted usingtorch.jit.trace
but I can't save it. Saving gives an error: