Added ppm support and fixed attribute types #191
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.
This pull request introduces support for handling PPM image files in the
autodistill
library, along with corresponding tests to ensure functionality. The changes include updates to theload_image
function, enhancements to thesplit_data
function, and new test cases to validate PPM support.Enhancements to PPM handling:
autodistill/helpers.py
: Added special handling for PPM files in theload_image
function, including fallback mechanisms for different formats (PIL
,cv2
, andnumpy
).autodistill/helpers.py
: Updated thesplit_data
function to convert.ppm
images to.jpg
during preprocessing, ensuring consistency with other image formats. [1] [2]New tests for PPM support:
test/test_load_image.py
: Added test cases to validate PPM file loading for all supported return formats (PIL
,cv2
, andnumpy
). Also included tests for error handling with non-image files.test/test_ppm_support.py
: Introduced a utility to create test PPM files and added a standalone test script to verify PPM loading functionality.Minor updates for test setup:
test/test_load_image.py
: Imported additional modules (os
andtempfile
) to support new test cases.