machine-shop / mothra

Automated butterfly wing length measurement
Other
27 stars 15 forks source link

joblib warnings on persisting input arguments #49

Open alexdesiqueira opened 4 years ago

alexdesiqueira commented 4 years ago

I'm receiving joblib warnings on "persisting input arguments"

pipeline.py:184: UserWarning: Persisting input arguments took 0.92s to run.
If this happens often in your code, it can cause performance problems 
(results will be correct in all cases). 
The reason for this is probably some large input arguments for a wrapped
 function (e.g. large strings).
THIS IS A JOBLIB ISSUE. If you can, kindly provide the joblib's team with an
 example so that they can fix the problem.
  T_space, top_ruler = ruler_detection.main(image_rgb, axes)

pipeline.py:187: UserWarning: Persisting input arguments took 0.86s to run.
If this happens often in your code, it can cause performance problems 
(results will be correct in all cases). 
The reason for this is probably some large input arguments for a wrapped
 function (e.g. large strings).
THIS IS A JOBLIB ISSUE. If you can, kindly provide the joblib's team with an
 example so that they can fix the problem.
  bfly_rgb, bfly_bin = binarization.main(image_rgb, top_ruler, args.grabcut, axes)

Should we worry about that? Thank you!

stefanv commented 4 years ago

I presume this is because we pass in large NumPy arrays. Why would they say this is a joblib issue? It takes time to checksum a large array. Maybe check with the joblib folks?

alexdesiqueira commented 4 years ago

There are issues opened in joblib in the same fashion, the most recent one from eight days ago. @AdamGleave suggests a workaround in this one:

As a workaround I am currently using np.set_printoptions to reduce the verbosity of repr(x) on a NumPy array x. We could potentially use the same trick in _persist_input (restoring the original options with a {get,set}_printoptions pair), but this does not feel very satisfactory.

Maybe it suits us...? I'll have to check the code.