stavrostheocharis / easy_explain

An XAI library that helps to explain AI models in a really quick & easy way
MIT License
12 stars 1 forks source link

Warning and low performance when using lrp continuously to analyze video stream #14

Open mlewelt opened 2 months ago

mlewelt commented 2 months ago

I am using YOLOv8LRP to show real-time LRP of a videostream, captured with a webcam.

The first call works normal, from the second iteration forward i receive this warnings:

Warning: Replacing previous fwd hook registered for <class 'ultralytics.nn.modules.conv.Concat'>
Warning: Replacing previous fwd hook registered for <class 'ultralytics.nn.modules.block.SPPF'>

Warnings are thrown when this code is called: lrp = YOLOv8LRP(model, power=2, eps=1, device='cpu') explanation_lrp = lrp.explain(lrpImage, cls=lrpClass, contrastive=False).cpu()

Also, performance of the application is very slow (below 1 fps), without LRP i get ~20 fps.

Full code is supplied. webcamDetectWithLRP.txt