-
Notifications
You must be signed in to change notification settings - Fork 1.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Ignore Empty Newlines in Yolo Label File #584
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hello there, thank you for opening an PR ! 🙏🏻 The team was notified and they will get back to you asap.
Refactored import paths for test utility methods across multiple test files to align with a recent package restructure. Enriched 'read_txt_file' functionality in 'file.py' allowing to optionally skip empty lines, enhancing flexibility for various use-cases. Added tests for the new 'read_txt_file' behavior in a new 'test_file.py'. Renamed 'utils.py' in test package to 'test_utils.py' for better differentiation from the util package in the source code.
Added linting rule exceptions for 'test/utils/test_file.py' in 'pyproject.toml'. Specifically, the 'W291' error which checks for trailing whitespace is ignored for this test file. This is necessary to test whether 'read_txt_file' function in 'test_utils.py' correctly ignores trailing whitespaces in varies test scenarios.
Hi, @SummitStudiosDev! 👋🏻 Thanks a lot for your interest in our project. I moved the solution into @onuralpszr I tried to exclude |
Signed-off-by: Onuralp SEZER <thunderbirdtr@gmail.com>
exclude not needed and fixed. |
Signed-off-by: Onuralp SEZER <thunderbirdtr@gmail.com>
@onuralpszr, we still need to fix the test. The test was broken by auto-format. All you did was change the expected result to match the test broken by auto format. |
Thanks a lot for your help, @SummitStudiosDev 🙏🏻 Let's merge this. I will solve test problems on my own. |
Description
I had an empty newline after the label in one of my yolo label files, it started broke the entire program, failing to load the dataset.
I went to yolo.py and I added a line printing out values, and it gave me
[]
as causing the problem, which makes sense.I then went and added a line printing
print(lines)
(becausevalues = line.split()
andfor line in lines:
), and I gotpreceding the error message which led me to conclude that there must be an extra newline.
Adding a check to see if values is length 0, and if it is just run a continue statement solves the problem and the library simply ignores the empty line instead of throwing an error.
Type of change
How has this change been tested, please provide a testcase or example of how you tested the change?
My program now runs, and I didn't have to modify my label txts at all.
Any specific deployment considerations
This would be a rather harmless ease-of-convivence fix, as all it does is ignore empty Newlines in a yolo label file, which otherwise would crash the entire program.
This is my first pull request so sorry if it's confusing!