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.
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 casesself.dest_q
wasn't available inpost_analyse
. I've thus madedest_q
a multiprocessingManager.Value
. There's a bit of abstraction leakage betweenMtmodule
andAnalyser
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 foranalyse_element
, and employs the aforementionedrank
function inpost_analyse
. This is both an example for the time being, and makes theRank
analyser still work as before for backwards compatibility. I'll eventually remove this I think.