How to get the anonymizing_video_by_DSFD running

Viewed 71

My goal is to use this GitHub repo to blur the faces of my input videos.

Current progress and problems: I have cloned the repo and then get familiar with it. But when I try to get it running on my end, I keep getting error messages like:

Traceback (most recent call last):
  File "demo.py", line 261, in <module> 
    test_oneimage()
  File "demo.py", line 230, in test_oneimage
    det0 = infer(net, img, transform, thresh, cuda, shrink)
  File "demo.py", line 107, in infer
    y = net(x)  # forward pass
  File "/home/lakeside/.local/lib/python3.8/site-packages/torch/nn/modules/module.py", line 889, in _call_impl
    result = self.forward(*input, **kwargs)
  File "/home/lakeside/Desktop/Anonymizing_video_by_DSFD/face_ssd.py", line 342, in forward
    output = self.detect(
  File "/home/lakeside/.local/lib/python3.8/site-packages/torch/autograd/function.py", line 159, in __call__
    raise RuntimeError(
RuntimeError: Legacy autograd function with non-static forward method is deprecated. Please use new-style autograd function with static forward method. (Example: https://pytorch.org/docs/stable/autograd.html#torch.autograd.Function)

And then I try to search a solution for resolving this, I have tried to add @staticmethod before the forward method and use something like:

y = net.apply(x)

But then it gives me error that:

demo.py:103: UserWarning: volatile was removed and now has no effect. Use `with torch.no_grad():` instead.
  x = Variable(x.unsqueeze(0), volatile=True)
Traceback (most recent call last):
  File "demo.py", line 261, in <module>
    test_oneimage()
  File "demo.py", line 230, in test_oneimage
    det0 = infer(net, img, transform, thresh, cuda, shrink)
  File "demo.py", line 107, in infer
    y = net.apply(x)  # forward pass
  File "/home/lakeside/.local/lib/python3.8/site-packages/torch/nn/modules/module.py", line 473, in apply
    module.apply(fn)
  File "/home/lakeside/.local/lib/python3.8/site-packages/torch/nn/modules/module.py", line 473, in apply
    module.apply(fn)
  File "/home/lakeside/.local/lib/python3.8/site-packages/torch/nn/modules/module.py", line 474, in apply
    fn(self)
TypeError: 'Tensor' object is not callable

I have tried to figure this out, but no luck so far. I see on this Reddit post that there are some people get it work successfully.

0 Answers
Related