Fix HuggingFaceDataLoader mask casting for point cloud datasets - #88
Merged
Merged
Conversation
_cast_single previously cast any "mask" column to Image() unconditionally, assuming masks are always pixel maps. Point cloud datasets store mask as Array2D (per-point labels) instead, since there's no image to draw a mask onto. Only cast to Image() when the column isn't already Image or Array2D. Tested against Project-AgML/pheno4d_point_cloud_segmentation: mask now loads correctly as a list instead of being miscast into an image.
js2552
approved these changes
Sep 12, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fix HuggingFaceDataLoader to support point cloud mask columns
What
_cast_singleinagml/data/hf_loader.pyunconditionally cast anymaskcolumn toImage(), assuming masks are always pixel maps. Point cloud datasets (e.g.Project-AgML/pheno4d_point_cloud_segmentation) storemaskasArray2D(per-point label arrays), since there's no image to draw a pixel mask onto for 3D data. The unconditional cast broke loading for these datasets.Fix
Only cast
masktoImage()when it isn't alreadyImageorArray2D. No changes needed for object detection,objectsisn't handled specially in this file, so point cloud detection datasets already pass through unaffected.Tested against the real, live dataset
Confirmed
maskcomes back as its correct raw nested-list form (convertible vianp.array()), not miscast into an image, no data loss or corruption.