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

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

Closed
varungupta31 opened this issue Feb 26, 2022 · 1 comment
Closed

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

varungupta31 opened this issue Feb 26, 2022 · 1 comment

Comments

@varungupta31
Copy link

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?

@varungupta31
Copy link
Author

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.

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

No branches or pull requests

1 participant