tfaehse / DashcamCleaner

Censor identifiable information in videos, in particular dashcam recordings in Germany.
GNU Affero General Public License v3.0
130 stars 27 forks source link

error with `TypeError: unsupported operand type(s) for /: 'tuple' and 'int'` #62

Closed joshinils closed 1 year ago

joshinils commented 1 year ago

split from #61

diff --git a/dashcamcleaner/src/blurrer.py b/dashcamcleaner/src/blurrer.py
index fb0b269..fc878b4 100644
--- a/dashcamcleaner/src/blurrer.py
+++ b/dashcamcleaner/src/blurrer.py
@@ -36,7 +36,7 @@ class VideoBlurrer:
         :return: detected faces and plates
         """
         scale = self.parameters["inference_size"]
-        results_list = self.detector(images, size=(scale,)).xyxy
+        results_list = self.detector(images, size=scale).xyxy
         return [
             [
                 Detection(

https://github.com/tfaehse/DashcamCleaner/blob/ab39a9c208fdeafe0687ddb6a02683123cb87921/dashcamcleaner/src/blurrer.py#L142

https://github.com/tfaehse/DashcamCleaner/commit/b3dc71dc77617a8121f38a6f5b83f7b6cfbd62ac#diff-dc15d6e41ef6c6b5e2ae45f31eb3dd289b44ea277afa9438d0d8e4cb1ee90090R140

joshinils commented 1 year ago

I don't know why this was changed, but it does not work for me when it is a tuple

tfaehse commented 1 year ago

Unfortunately, torch hub (or Ultralytics?) changed this on their end, so we have to replicate it - your torch cache is probably just still on the old version, I had the same issue. It should be in ~/.cache/torch, just delete it and run the tool again, it should pull the changes automatically.

There's also a warning about untrusted sources by now - but I think we can ignore that, given that I'm hopeful that we can move to YOLOv8 which is a bit nicer to integrate, thanks to Ultralytic's new PyPi package :)

joshinils commented 1 year ago

indeed that was the issue, removed it, got a download, and an error that a float is not iterable, git restore all fine, thanks.