Skip to content
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

imgclass: Make errors non-fatal #1

Merged
merged 1 commit into from
Mar 19, 2018
Merged

imgclass: Make errors non-fatal #1

merged 1 commit into from
Mar 19, 2018

Conversation

mgalgs
Copy link
Contributor

@mgalgs mgalgs commented Mar 19, 2018

Editor's note: I suspect there may be reason that you have to bail out on error? Just wanted to get the discussion going.


If imgclass encounters a corrupt image it will fail and bail out. Here's
an example in the wild:

Create new model with 26 classes? (y/n): y
new model created: 5aaf257815a3e7eb
Teach and validate Classificationbox with 187198 (80%) random images? (y/n): y
 36023 / 187198 [=========================>--------------------------------------------------------------------------------------------------------]  19.24% 8h23m1s2018/03/18 21:50:55 teaching: Tween_Leggings/image_2IlTxYG.jpeg: classificationbox: 5aaf257815a3e7eb:5aaf257815a3e7eb could not preprocess the input: could not pre process the image for feature 'image': model predict image returns an error Traceback (most recent call last):
  File "/tmp/mb951297289", line 41, in predict_img
  File "/env/local/lib/python2.7/site-packages/PIL/Image.py", line 1743, in resize
    self.load()
  File "/env/local/lib/python2.7/site-packages/PIL/ImageFile.py", line 233, in load
    "(%d bytes not processed)" % len(b))
IOError: image file is truncated (13 bytes not processed)

This can be particularly annoying while working on large datasets.

Rather than bailing out on error just print the error on soldier onward.

If imgclass encounters a corrupt image it will fail and bail out.  Here's
an example in the wild:

    Create new model with 26 classes? (y/n): y
    new model created: 5aaf257815a3e7eb
    Teach and validate Classificationbox with 187198 (80%) random images? (y/n): y
     36023 / 187198 [=========================>--------------------------------------------------------------------------------------------------------]  19.24% 8h23m1s2018/03/18 21:50:55 teaching: Tween_Leggings/image_2IlTxYG.jpeg: classificationbox: 5aaf257815a3e7eb:5aaf257815a3e7eb could not preprocess the input: could not pre process the image for feature 'image': model predict image returns an error Traceback (most recent call last):
      File "/tmp/mb951297289", line 41, in predict_img
      File "/env/local/lib/python2.7/site-packages/PIL/Image.py", line 1743, in resize
        self.load()
      File "/env/local/lib/python2.7/site-packages/PIL/ImageFile.py", line 233, in load
        "(%d bytes not processed)" % len(b))
    IOError: image file is truncated (13 bytes not processed)

This can be particularly annoying while working on large datasets.

Rather than bailing out on error just print the error on soldier onward.
Copy link
Contributor

@matryer matryer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@matryer matryer merged commit ad39574 into machinebox:master Mar 19, 2018
@matryer
Copy link
Contributor

matryer commented Mar 19, 2018

Thank you.

@mgalgs mgalgs deleted the non-fatal-errors branch March 19, 2018 16:24
@ghost ghost mentioned this pull request Dec 10, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants