ekosman / AnomalyDetectionCVPR2018-Pytorch

Pytorch version of - https://github.com/WaqasSultani/AnomalyDetectionCVPR2018
172 stars 52 forks source link

Online Via Web Cam #234

Open sania96 opened 2 months ago

sania96 commented 2 months ago

Hi @ekosman I am running this command:

python AD_live_prediction.py --feature_extractor "r3d101_KM_200ep.pth" --feature_method "r3d101" --ad_model "D:\ucf\AnomalyDetectionCVPR2018-Pytorch-main\exps\models\epoch_10.pt" --clip_length "32"

but I want that my web cam will keep on sending frames and getting the continuous graph of prediction, how can i do that? i mean if i want to use this for live streaming how can i deal with the clip length?

PS, A great Contribution by your side, And You are really active here for your followers. Thanks Regards.

ekosman commented 2 months ago

I'm not sure I get the question right. The live demo is supposed to be real time. What behavior do you get?

sania96 commented 2 months ago

For real time what should i set the clip length? as in real time the video keeps on going and it never stops, the graph being shown stops when it reaches at the end of the graph, else it should be continuous. I hope you understand my question, do let me know if not.

ekosman commented 2 months ago

The clip length correpsonds to the window size fed to the model. It doesn't limit the duration of the whole video. Basically, if you look at the input of the video model, it is fed with a tensor of shape (l,3,h,w) where l is the clip length. Whenever a new frame arrives, I slice a new short video clip and feed it into the model to get a prediction.

sania96 commented 2 months ago

Ok, and if i want to get that short clip where the anomaly has been predicted how can i het that? Thank you for your clarifications.

ekosman commented 2 months ago

I would try to record the screen.