Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ValueError: 'RoadEdge_RaisedCurb' is not a valid EgoRoadClass #47

Open
SyedShafiq opened this issue Apr 14, 2024 · 6 comments
Open

ValueError: 'RoadEdge_RaisedCurb' is not a valid EgoRoadClass #47

SyedShafiq opened this issue Apr 14, 2024 · 6 comments
Assignees
Labels
bug Something isn't working

Comments

@SyedShafiq
Copy link

SyedShafiq commented Apr 14, 2024

Hello,

I am encountering the following error:
ValueError: 'RoadEdge_RaisedCurb' is not a valid EgoRoadClass

This is error is generated when I am running the following piece of code in devkit_tutorial.

from zod.utils.polygon_transformations import polygons_to_binary_mask

zod_frame = zod_frames[9158]

#get the ego road annotations
polygon_annotations = zod_frame.get_annotation(AnnotationProject.EGO_ROAD)
# convert the polygons to a binary mask (which can be used
# for ground truth in e.g. semantic segmentation)
mask = polygons_to_binary_mask(polygon_annotations)

# visualize the mask
plt.axis("off")
plt.imshow(mask)
plt.show()

Could you please suggest a workaround so that I can see the segmentation on the image? Seems like there are more than 2 classes in the EgoAnnotation data.

@atonderski
Copy link
Collaborator

Very sorry for your issues. parsing was indeed broken for ego road (for a subset of frames at least). This PR should fix it.

@atonderski atonderski added the bug Something isn't working label Apr 15, 2024
@atonderski atonderski self-assigned this Apr 15, 2024
@SyedShafiq
Copy link
Author

Thank you for your quick response. When can I expect it to be merged with the main branch?

@wljungbergh
Copy link
Member

This PR is now merged. If you are using the source code you can simply take down the latest changes! If you are using the pypi package, that will be updated later this week!

@ollema
Copy link
Collaborator

ollema commented Apr 19, 2024

hi @SyedShafiq! could you please confirm if the PR resolved your issues so we could close this issue? thanks!

@SyedShafiq
Copy link
Author

This is the error, encountered.

Exception has occurred: TypeError       (note: full exception trace is shown but execution is paused at: _run_module_as_main)
'EgoRoadAnnotation' object is not iterable
  File "D:\Thesis_Shafiq\Scene_Risk\Code\zodRepo\zod\utils\polygon_transformations.py", line 38, in polygons_to_binary_mask
    for polygon in multi_polygon:
  File "D:\Thesis_Shafiq\Scene_Risk\Code\zodRepo\examples\devkit_tutorialPy.py", line 322, in <module>
    mask = polygons_to_binary_mask(polygon_annotations)
  File "C:\Users\I010392\AppData\Local\Programs\Python\Python310\Lib\runpy.py", line 86, in _run_code
    exec(code, run_globals)
  File "C:\Users\I010392\AppData\Local\Programs\Python\Python310\Lib\runpy.py", line 196, in _run_module_as_main (Current frame)
    return _run_code(code, main_globals, None,
TypeError: 'EgoRoadAnnotation' object is not iterable``

Upon debugging, there seems to be an error in this piece of code from polygin_transformations.py file:

def polygons_to_binary_mask(multi_polygons, img_shape=(2168, 3848)):
    """
    Create binary mask for list of multi-polygons
    """
    assert len(img_shape) == 2

    mask = _create_image_mask(img_shape)
    for multi_polygon in multi_polygons:
        for polygon in multi_polygon:
            mask += polygon_to_mask(polygon, img_shape, 1)
    return mask.astype(bool)

@atonderski
Copy link
Collaborator

atonderski commented Apr 22, 2024

You are right, the notebook still had issues with ego road annotations.
Should be fixed here (also added another test to check for errors in the tutorial)
54c698d

Can you install/pull from latest master and try again? Sorry about the hassle

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants