Repository navigation
fix(folderparser): include .webp images in directory uploads - #577
Open
BarsamErshadi wants to merge 2 commits into
Open
BarsamErshadi wants to merge 2 commits into
BarsamErshadi wants to merge 2 commits into
Conversation
parsefolder filters on IMAGE_EXTENSIONS, which left out .webp, so upload_dataset skipped those images without a message. Project.upload accepts them, and the CLI's supported formats include WebP. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This branch has not been deployed
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.
What does this PR do?
When
upload_datasetuploads a directory image by image (the default, notuse_zip_upload=True), it skips.webpimages without a message, along with any label next to them.parsefolderfilters onIMAGE_EXTENSIONS, which lists every other format inACCEPTED_IMAGE_FORMATSfromroboflow/core/project.pybut not WebP, andProject.uploadalready accepts those files. The CLI's directory upload goes throughupload_datasettoo.This adds
.webptoIMAGE_EXTENSIONS.Related Issue(s): None that I found. Open PR #575 removes a separate extension list in the CLI, but it doesn't touch this set.
Type of Change
Testing
Test details:
I added
test_lists_webp_images_with_their_labelstotests/util/test_folderparser.py. It fails on the unfixed code, where the.webpimage is missing from the result, and passes with the fix.python -m unittestfrom the repo root gives 1279 tests, OK (1 skipped).I also called
Workspace.upload_dataseton a folder witha.jpg,b.webpandc.webp, each with a label, with the project stubbed:Not verified: I did not test against the real Roboflow API, and everything ran on macOS with Python 3.12. So I can't say a real server accepts a
.webpthrough this path.ACCEPTED_IMAGE_FORMATSis my evidence that it should.Checklist
Additional Context
Behaviour to judge:
a.jpg,a.webpand onea.txt, one image now gets the label and the other goes up unlabelled, with no message. Which one depends on the orderos.walkreturns them, because the sort ignores the extension. Before this change,a.jpgalways got the label.a.jpgwitha.pngalready behaves this way, so I left that mapping alone.rfapi.upload_imagesets the part's type withmimetypes.guess_type. On Python 3.12 this depends on the system's mime tables for.webp: with no system tables it returnsNone, so the part would go out asapplication/octet-stream, while.jpg,.avifand.heicstill get their image types. I don't know how the server treats that. Single-file WebP uploads already take this path.folderparser.pyand its test file, and adds the same### Fixedheading toCHANGELOG.md. The source merges cleanly, but the new tests and the changelog entries land at the same spot, so whichever merges second needs a small rebase.