RomeroBarata / skeleton_based_anomaly_detection

Code for the CVPR'19 paper "Learning Regularity in Skeleton Trajectories for Anomaly Detection in Videos"
132 stars 49 forks source link

converting the algorithm online #18

Closed mayaghaei closed 4 years ago

mayaghaei commented 4 years ago

Hi Romero, I am trying to use your code further than its original functionality, so any help is actually more than appreciated! at this moment I am trying to make the algorithm online or at least semi-online. so I thought one way could be to assign the "stride" value for segmenting the full trajectories as 1; it means to move only one frame further at a moment and then do some other necessary pre and post processing. I am though badly stuck in your code to find where you actually define the trajectory segmenting value? To be precise I am talking about Eq. 12 and 13 in your paper.

Do you actually think this could be a way that I could take towards making the algorithm online? I tried to change the prediction and input-lenght values in Pretrained Architectures, but obviously that gives me errors. I think maybe I need to re-train the whole network with the new values also? Do you possibly have some insight on how one could approach to convert the algorithm online? I am almost sure there would be drops in performance, but that is not my concern at this moment.

Many thanks in advance and I hope you can find a hole in your schedule to answer me. cheers

RomeroBarata commented 4 years ago

Hi @mayaghaei,

Sorry for the delay to reply. The way I see the algorithm to work in an online setting is to have an online pose detector/tracker, so you can continuously generate input for the model, which you can use to detect anomalies. You can use a pre-trained model but you'll be locked in with the restrictions it had during training (e.g. input/output length); if that's a problem you might need to pre-train another model.

The function that does the segmenting as in eqs. 12 and 13 is the function collect_trajectories in tbad/data.py. You can use it as a start point to split the trajectories the way you need.

I don't have much experience with transforming it into an online algorithm, so these are just my general thoughts on it. Good luck with it and if there is anything else I can help just let me know.

Kind regards, Romero