tfaehse / DashcamCleaner

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

Macbook M1 Max und PyTorch #76

Closed Vakrehus closed 1 year ago

Vakrehus commented 1 year ago

How can I enable the GPU of a Macbook M1 Max? PyTorch with Apple's Metal Performance Shaders (MPS) is installed. https://pytorch.org/get-started/locally/ The flag "-m gpu" does not bring GPU support. Only the CPU is used.

tfaehse commented 1 year ago

This is interesting! Ultralytics support MPS inference (and training!) now, so you can just add device="mps" to the detector call here. I've just tested this, it seems to be seriously fast! But also buggy with larger batch sizes.

Ultralytics switched over to AGPL, so I have to adapt here if I want some of the newer features - their changed license forces me to also use a copyleft license for any derived works. That's absolutely fine for me, but I have to read up on that a bit first. Once I'm done I should be able to integrate that more permanently.

I'd assume CoreML exports are faster still, but that's too much hassle for a fairly small platform after all.

Vakrehus commented 1 year ago

Runs great, thank you very much. Went from 12fps to 24 fps on GoPro Hero7 1080p60 footage, using 1080p_nano_v8 -b 4 -q 5.0 -s 50 -t 0.4 -bw 2