plantcv icon indicating copy to clipboard operation
plantcv copied to clipboard

measurements from past images being stored when establishing thresholds in jupyter

Open AubreyHawks opened this issue 3 years ago • 5 comments

I’m running into an issue while establishing thresholds in jupyter. If I start by working with an image with multiple plants and switch to working with an image with fewer plants in the same notebook, I get a ‘ghost’ plant from the first image in the output file for the second image. If the specified plant IDs are used for both images, the measurements are being updated. This still happens when I create a new output file, so I don’t think it is an issue with new measurements being appended to the old file, but perhaps the old measurements are being cached somewhere and included in the output?

AubreyHawks avatar Jan 04 '22 18:01 AubreyHawks

Hi @AubreyHawks, could you upload your notebook here? GitHub does not allow attaching files ending in ipynb but if you zip the notebook first it will let you upload it. Thanks!

nfahlgren avatar Jan 04 '22 18:01 nfahlgren

Hi @AubreyHawks, your workflow looks good. You are able to see the individual results for each plant in your output CSV file correct? Is it just that you want a separate output image for each plant from pcv.analyze_object?

nfahlgren avatar Jan 04 '22 20:01 nfahlgren

Hi @nfahlgren, Yes, I see the individual results in the CSV. I'm mostly trying to understand why the measurements from the previous image are still showing up in the results for the new image when I start the workflow from the beginning. If I'm understanding correctly, the pcv.analyze_object variable is still storing the information for previous IDs and only updating the IDs that are being used for the image with fewer plants, even if I run all blocks of code from the beginning- is that correct? If that is accurate, then it would be helpful to be able to specify which IDs I would like to see in the output.

AubreyHawks avatar Jan 06 '22 17:01 AubreyHawks

Ah okay I think I see! We record results in the background in pcv.outputs. And as you have seen you can record more than one set of results by using different label inputs to functions like analyze_object. When you run the notebook from the top the previous results are still stored in pcv.outputs and any new measurements would be appended to the outputs. Two ways to avoid that happening are either to restart your notebook kernel before rerunning the notebook, that would clear out everything in cache.

Or alternatively, adding the following code near the top of your workflow in a cell that gets rerun:

pcv.outputs.clear()

nfahlgren avatar Jan 06 '22 21:01 nfahlgren