awslabs / amazon-lookout-for-vision-python-sdk

Apache License 2.0
7 stars 3 forks source link

An error in "upload_from_local" method of "Image" class #2

Closed youngmki closed 3 years ago

youngmki commented 3 years ago

Hello. I'm working as a Data Scientist at AWS ProServe Korea, and I've tested Lookout for Vision to try it out on an enterprise project. On the way, I found an error in this Python SDK.

The following error occurs when calling the upload_from_local method of the Image object.

.../lookoutvision/image.py in upload_from_local(self, bucket, s3_path, train_and_test, test_split, prefix, content_type, processes_num)
    443                 batches = [training_set, validation_set]
    444                 if "good" in p:
--> 445                     if len(files) >= 20 and (len(training_set) < 10 or len(validation) < 10):
    446                         validation_set = files[:10]
    447                         training_set = files[10:]

NameError: name 'validation' is not defined

It seems that the code should be corrected as follows.

def upload_from_local(self, bucket, s3_path="", train_and_test=True, test_split=0.2, prefix="",
                          content_type="image/jpeg", processes_num=10):
...
                batches = [training_set, validation_set]
                if "good" in p:
                    if len(files) >= 20 and (len(training_set) < 10 or len(validation_set) < 10):
                        validation_set = files[:10]
                        training_set = files[10:]
...

Thank you.

pespila commented 3 years ago

Hi, thanks a lot for reporting this issue! We released an update April 14th that fixed the issue. Can you please update your Python library using pip and try again? Another bug was fix today when creating the train/test splits. Thanks for your support!