Skip to content

Error while predicting result #25

@GDGauravDutta

Description

@GDGauravDutta

TypeError Traceback (most recent call last)
in
10 img = Image.open('./{}'.format(a))
11 print(a)
---> 12 result = model.predict(img)
13 # Print top prediction
14 print('Model Prediction : {}'.format(result.prediction))

/opt/conda/lib/python3.7/site-packages/lobe/model/image_model.py in predict(self, image)
45
46 def predict(self, image: Image.Image) -> ClassificationResult:
---> 47 image_processed = image_utils.preprocess_image(image, self.signature.input_image_size)
48 image_array = image_utils.image_to_array(image_processed)
49 results = self.backend.predict(image_array)

/opt/conda/lib/python3.7/site-packages/lobe/image_utils.py in preprocess_image(image, size)
83
84 def preprocess_image(image: Image.Image, size: Tuple[int, int]) -> Image.Image:
---> 85 image_processed = update_orientation(image)
86
87 # resize and crop image to the model's required size

/opt/conda/lib/python3.7/site-packages/lobe/image_utils.py in update_orientation(image)
47 exif_orientation_tag = 0x0112
48 if hasattr(image, '_getexif'):
---> 49 exif = image._getexif()
50 if exif != None and exif_orientation_tag in exif:
51 orientation = exif.get(exif_orientation_tag, 1)

/opt/conda/lib/python3.7/site-packages/PIL/JpegImagePlugin.py in _getexif(self)
473
474 def _getexif(self):
--> 475 return _getexif(self)
476
477 def _getmp(self):

/opt/conda/lib/python3.7/site-packages/PIL/JpegImagePlugin.py in _getexif(self)
496 if "exif" not in self.info:
497 return None
--> 498 return self.getexif()._get_merged_dict()
499
500

/opt/conda/lib/python3.7/site-packages/PIL/Image.py in getexif(self)
1322 return self.im # could be abused
1323
-> 1324 def getextrema(self):
1325 """
1326 Gets the the minimum and maximum pixel values for each band in

/opt/conda/lib/python3.7/site-packages/PIL/Image.py in load(self, data)
3354 self._data = {}
3355 self._ifds = {}
-> 3356 self._info = None
3357 self._loaded_exif = None
3358

/opt/conda/lib/python3.7/site-packages/PIL/TiffImagePlugin.py in load(self, fp)
766 tag, typ, count, data = self._unpack("HHL4s", self._ensure_read(fp, 12))
767
--> 768 tagname = TiffTags.lookup(tag, self.group).name
769 typname = TYPES.get(typ, "unknown")
770 msg = f"tag: {tagname} ({tag}) - type: {typname} ({typ})"

TypeError: lookup() takes 1 positional argument but 2 were given

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions