Skip to content
This repository has been archived by the owner on Aug 20, 2020. It is now read-only.

Better error handling #17

Open
7thstorm opened this issue Apr 17, 2019 · 3 comments
Open

Better error handling #17

7thstorm opened this issue Apr 17, 2019 · 3 comments

Comments

@7thstorm
Copy link

Hello,
I am trying to convert over 500,000 files and each little error stops the processing and I have to then hunt for the missing item in my xml files. For example, it appears that one or more of my xml files were missing the tag, so instead of identifying the file(s), the script throws and error and quits.
In another very common error, the tag is missing ion one or more files
Another error type: The value in the classes file does not match the name value in the xml file. This is very common, in case of a typo. For example, one of my files could have a misspelling. But the system stops processing.

Ideally, since it is very common to process tens of thousands of files, a better way of handling this would be to ( a ) print the name of the offending file on the screen ( b ) or better still, rename the offending file, by adding a suffix, so that one can go through all invalid files and fix them.

Hope you'll take my suggestion.

Right now, I'm processing 500K files and am on my 15th iteration, as it stops after every single error
Thanks

@7thstorm
Copy link
Author

I found another error, but no way of knowing which file
2019-04-17_0-13-54

@ssaru
Copy link
Owner

ssaru commented Apr 30, 2019

Ok I will be trying
Thanks!

@Maharshi-Aupera
Copy link

@7thstorm I suspect that error was because of zero dimension in your one of the .xml annotation file.
Change the following lines: https://github.com/ssaru/convert2Yolo/blob/master/Format.py#L238-L243
and replace them with:

im_mah = Image.open("/Path/to/your/jpeg/image/" + filename[:-4] + ".jpg")

size = {
           "width": im_mah.width,
          "height": im_mah.height,
          "depth": 3
          }

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants