Repository navigation
Skip CSVs with fewer than six columns in folder uploads instead of sending them as annotations - #583
Merged
Merged
Conversation
The folder parser sends the rows of every CSV other than _classes.csv as the annotation of the images they name. A table of image metadata in the folder fails every listed image's annotation save, and when it sorts before the folder's annotation CSV it is used in that CSV's place. The server's CSV parser reads boxes only from rows of six or more columns, so the folder parser now reads a CSV as annotations only when it is _classes.csv or has at least six columns, and skips other CSVs with a warning. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
digaobarbosa
approved these changes
Nov 16, 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.
What does this PR do?
Failure. The annotate API answers some folder-upload annotation saves with a 500,
TypeError: Cannot read properties of undefined (reading 'width'). In the last 30 days, 938 of them came fromroboflow-python/1.7.3folder uploads in two workspaces (555 on 2026-10-27, 383 on 2026-11-08). Each is aname=annotation.csvsave whose body is a CSV header plus one row of a metadata table: a filename followed by three or four values such as a split, a count, scores or a status, with no box columns. roboflow/roboflow#19525 makes the API answer 400 for these; this PR stops the SDK from sending them.Root cause.
parsefolderreads every.csvother than_classes.csvas an annotation CSV: each image named in its first column gets the header plus its rows asannotation.csv. A metadata CSV in the folder becomes the annotation of every image it lists, and when it sorts before the folder's annotation CSV (/metadata.csvbefore/train/_annotations.csv), it is used in that CSV's place. The server's CSV parser reads boxes only from rows of six or more columns, so these rows hold no annotation.Fix.
_loadAnnotationsreads a CSV as annotations only when it is_classes.csv(multi-label classification, which the SDK reads itself) or its first line has at least six columns, the fewest of any box layout the server reads (RetinaNet and VoTT have six, Tensorflow Object Detection eight). It skips other CSVs and printswarning: skipping <file>: annotation CSVs have at least six columns, like the parser's other warnings. Their images upload with the folder's other annotations, or without one. An empty CSV, which raisedIndexError, is skipped the same way.Changed files:
roboflow/util/folderparser.py:_is_annotation_csv, used by_loadAnnotations.tests/util/test_folderparser.py: the regression test.CHANGELOG.md: a Fixed entry.Related Issue(s): roboflow/roboflow#19525 (the API half: 400 instead of 500).
Type of Change
Testing
Test details:
test_parse_csv_skips_metadata_csv: a folder with two images,train/_annotations.csv(Tensorflow layout, a row fora.jpg) andmetadata.csv(four columns, rows for both images).a.jpggets the_annotations.csvrow,b.jpggets no annotation, and the warning names/metadata.csv. Onmainit fails:a.jpggets the metadata row.python -m unittest: 1280 tests OK, 1 skipped (Python 3.12, macOS);tests.util.test_folderparseralso passes on Python 3.10.make check_code_qualitypasses, and so do the pre-commit pins (ruff 0.15.10, bandit 1.9.4)._classes.csvpair with the same images, with the same text, onmainand on this branch.Checklist
Additional Context
_classes.csvname, the one the SDK reads and the annotate API docs give; under another name it is skipped with the warning.use_zip_upload=True,--zip-upload) don't use this parser.folderparser.py(fix: support case-insensitive images/labels folders in YOLO datasets #421, fix(folderparser): use csv.reader to handle RFC 4180 quoted fields in annotation CSVs #490, Fix SDK data handling, error reporting, and transfers #575, fix(folderparser): take the split from directory names before substrings #576, fix(folderparser): include .webp images in directory uploads #577) don't change_loadAnnotations.🤖 Generated with Claude Code