Closed GDGauravDutta closed 3 years ago
This looks like pillow couldn't load the image -- what is the filetype?
Closing -- please comment with the filetype and if Pillow can load the image outside of Lobe. We only support what Pillow can open.
TypeError Traceback (most recent call last)
/tmp/ipykernel_35/1784468283.py in
/opt/conda/lib/python3.7/site-packages/lobe/model/image_model.py in predict_from_file(self, path) 58 59 def predict_from_file(self, path: str): ---> 60 return self.predict(image_utils.get_image_from_file(path)) 61 62 def predict(self, image: Image.Image) -> ClassificationResult:
/opt/conda/lib/python3.7/site-packages/lobe/model/image_model.py in predict(self, image) 61 62 def predict(self, image: Image.Image) -> ClassificationResult: ---> 63 image_processed = image_utils.preprocess_image(image, self.signature.input_image_size) 64 image_array = image_utils.image_to_array(image_processed) 65 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 1323 self.load() -> 1324 if band is not None: 1325 return self.im.getband(band) 1326 return self.im # could be abused
/opt/conda/lib/python3.7/site-packages/PIL/Image.py in load(self, data) 3354 atexit.register(core.clear_cache) 3355 -> 3356 3357 class Exif(MutableMapping): 3358 endian = None
/opt/conda/lib/python3.7/site-packages/PIL/TiffImagePlugin.py in load(self, fp) 774 tag, typ, count, data = self._unpack("HHL4s", self._ensure_read(fp, 12)) 775 --> 776 tagname = TiffTags.lookup(tag, self.group).name 777 typname = TYPES.get(typ, "unknown") 778 msg = f"tag: {tagname} ({tag}) - type: {typname} ({typ})"
TypeError: lookup() takes 1 positional argument but 2 were given
Kaggle : https://www.kaggle.com/gauravduttakiit/notebook52daed67ed
TypeError Traceback (most recent call last)