ayoolaolafenwa / PixelLib

Visit PixelLib's official documentation https://pixellib.readthedocs.io/en/latest/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

AttributeError: 'str' object has no attribute 'decode'

varungupta31 opened this issue · comments

I'm trying to run semantic and instance segmentation, but I am getting the error:

AttributeError: 'str' object has no attribute 'decode'

I'm using tensorflow 2.0.0
and have followed the installation instructions mentioned.

I'm using the code:

import pixellib
from pixellib.instance import instance_segmentation

segment_image = instance_segmentation()
segment_image.load_model("mask_rcnn_coco.h5")
segment_image.segmentImage("Images/cycle.jpg",show_bboxes=True, output_image_name= "res1.jpg")

The same is happening for the semanctic segmentation model using deeplabv3_xception65_ade20k.h5, and

import pixellib
from pixellib.semantic import semantic_segmentation

segment_image = semantic_segmentation()
segment_image.load_ade20k_model("deeplabv3_xception65_ade20k.h5")
segment_image.segmentAsAde20k("Images/cycle.jpg", overlay = True, output_image_name="image_new.jpg")

How can I resolve this?

I found out the solution,
I downgraded my h5py version to 2.10.0 and the error went away by:

pip uninstall h5py
pip install h5py==2.10.0

Another way suggested (though I didn't check it myself), was to remove .encode("utf-8") from the line where the model is being read.