v7labs / darwin-py

Library and commandline tool for managing datasets on darwin.v7labs.com
MIT License
115 stars 42 forks source link

[DAR-1910][External] Fixed rare TypeError bug when importing COCO annotations #839

Closed JBWilkie closed 4 months ago

JBWilkie commented 4 months ago

Problem

When importing a directory of COCO annotation files, the importer returns a List[List[AnnotationFile]] type. This causes darwin-py to try flattening the list. If there are any NoneTypes in parsed_files at this point, a TypeError will be thrown: 'NoneType' object is not iterable.

Solution

These NoneTypes in parsed_files come from files that the importer was unable to parse. Therefore, remove all NoneTypes from parsed_files prior. Note that we can't simply filter for .json files, since some annotation files are in the .xml format

Changelog

Fixed rare bug when importing directories of COCO annotations

linear[bot] commented 4 months ago

DAR-1910 BUG: The .DS_Store file can break the darwin-py importer