forensic-architecture / mtriage

framework to orchestrate the download and analysis of media
Other
98 stars 16 forks source link

Modular rank #155

Closed breezykermo closed 4 years ago

breezykermo commented 4 years ago

Refactors the summative logic of the Rank analyser into a function.

This makes more sense now that post_analyse can optionally return an element, as it means that the ranking of CvJsons can all be done within an analyser that is doing inference on frames.

By making the logic available as a function in utils, ranking can easily be inserted into any analyser's post_analyse.

In making this work, I realised that some of the refactoring around dest_q broke parallel processing, as in some cases self.dest_q wasn't available in post_analyse. I've thus made dest_q a multiprocessing Manager.Value. There's a bit of abstraction leakage between Mtmodule and Analyser here (where the former is supposed to encapsulate all the parallelisation logic, with the latter unaware of whether its functions are in serial or parallel). I've commented this inline with a note, as it works for now.

I've also kept the Rank analyser, which just has an identity function for analyse_element, and employs the aforementioned rank function in post_analyse. This is both an example for the time being, and makes the Rank analyser still work as before for backwards compatibility. I'll eventually remove this I think.