You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am having some problems with the upolygon.find_contours function.
I have some input masks that make the function run endlessly, while my computer RAM starts increasing until it reaches 100% and python kernel crashes and/or I terminate the find_contours execution.
If I try to run the opencv cv2.findContours function I don't have this problem, however the hierarchical structure of the output is quite different from the one of upolygon.find_contours.
Unfortunately I am not able to map the output of cv2.findContours to a format similar to the upolygon.find_contours output, as the upolygon code has no docstring/comments explaining the output format.
Any idea of how either to fix the find_contours problem, or how to map cv2.findContours output to upolygon.find_contours output?
Here some details:
Windows 11
python 3.10.8
upolygon 0.1.10 (updated this morning to the latest release)
importjsonfromupolygonimportfind_contours, rle_decodefromdarwin.importer.formats.cocoimportdecode_binary_rlewithopen('data.json') asf:
data=eval(f.read())
mask_index=0# select any of the masks from the data.json file-all of them lead to an errorsegmentation=data[mask_index]
counts=decode_binary_rle(segmentation["counts"])
mask=rle_decode(counts, segmentation["size"][::-1])
# this is the upolygon function that runs endlessly_labels, external, _internal=find_contours(mask)
# this is the opencv find contours function that works as expected on the same maskimportcv2contours,hierarchy=cv2.findContours(mask,cv2.RETR_TREE, cv2.CHAIN_APPROX_SIMPLE)
What's weird, for example, is that the first top-left mask gives this error, but if I crop the image tighter around the annotation (leaving some padding around it, I am using as coordinates [2100:4100,1500:6600]) the find_contours function runs smoothly, even though what I cut out was just pixels having value=0.
The text was updated successfully, but these errors were encountered:
Thanks for the thorough steps to recreate, we have a ticket in our backlog now to look into this, and you can speak to your CX reps for updates if you need them. The code you've submitted will be very helpful in recreating the issue.
@Nathanjp91@owencjones
Hey guys, I have seen from the logs that you have found the problem in the function and fixed it. Do you have an ETA on when the changes will be merged into main?
Thanks for having worked on this!
@fgraffitti-cyberhawk We have it in QA at the moment but because of the nature of the issue and the code involved was taking longer than expected. The fix is currently in a branch here of darwin-py. There's some issue getting it deployed because upolygon needs to be rebuilt with a new version for pypi to accept it in darwin-py, but you could install that branch of darwin-py and test if it resolves your issues.
I am having some problems with the upolygon.find_contours function.
I have some input masks that make the function run endlessly, while my computer RAM starts increasing until it reaches 100% and python kernel crashes and/or I terminate the find_contours execution.
If I try to run the opencv cv2.findContours function I don't have this problem, however the hierarchical structure of the output is quite different from the one of upolygon.find_contours.
Unfortunately I am not able to map the output of cv2.findContours to a format similar to the upolygon.find_contours output, as the upolygon code has no docstring/comments explaining the output format.
Any idea of how either to fix the find_contours problem, or how to map cv2.findContours output to upolygon.find_contours output?
Here some details:
Windows 11
python 3.10.8
upolygon 0.1.10 (updated this morning to the latest release)
I link a json file containing a few examples of masks (in RLE format) that give the error : https://cyberhawk-my.sharepoint.com/:u:/g/personal/francesco_graffitti_thecyberhawk_com/EQLKLbPehtRJpoxPoGiGnHgB-u4WuqsD6fFj4zWyfRHxaA?e=rZclfs
And here is the plot of those same masks:
Code to reproduce the error:
What's weird, for example, is that the first top-left mask gives this error, but if I crop the image tighter around the annotation (leaving some padding around it, I am using as coordinates [2100:4100,1500:6600]) the find_contours function runs smoothly, even though what I cut out was just pixels having value=0.
The text was updated successfully, but these errors were encountered: